博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
ubuntu下搭建elasticsearch集群
阅读量:3738 次
发布时间:2019-05-22

本文共 4462 字,大约阅读时间需要 14 分钟。

在Ubuntu 18.04.1 LTS搭建一个简单的elasticsearch集群demo,具体情况如下:

集群名称:elasticsearch-cluster-demo

主节点:1个 node-master-one
数据节点:2个 node-data-one、node-data-two
客户端节点:1个 node-client-one

文章目录

elasticsearch 安装

elasticsearch 的安装可以点击参考文章:

拷贝几个es安装包文件夹,进行相应节点的命名,再进行后续的修改配置。

基本集群配置

node-master-one

# 集群名称cluster.name: elasticsearch-cluster-demo## 节点信息node.name: node-master-onenode.master: truenode.data: false## Path to directory where to store the data (separate multiple locations by comma):# es data 存储路径path.data: /home/environment/elasticsearch-cluster/elasticsearch-master-one/data## Path to log files:# log存储路径path.logs: /home/environment/elasticsearch-cluster/elasticsearch-master-one/logs## Set the bind address to a specific IP (IPv4 or IPv6):# 网路监听network.host: 0.0.0.0http.port: 9200transport.tcp.port: 9300## Pass an initial list of hosts to perform discovery when new node is started:# The default list of hosts is ["127.0.0.1", "[::1]"]# 可以发现当前节点的主节点ip:portdiscovery.zen.ping.unicast.hosts: ["127.0.0.1:9300"]# # Prevent the "split brain" by configuring the majority of nodes (total number of master-eligible nodes / 2 + 1):# 集群最小主节点个数#discovery.zen.minimum_master_nodes: 2## 设置跨域问题,方便使用elasticsearch-head来检测集群状态http.cors.enabled: truehttp.cors.allow-origin: /.*/

node-data-one

# 集群名称cluster.name: elasticsearch-cluster-demo## 节点信息node.name: node-data-onenode.master: falsenode.data: true## Path to directory where to store the data (separate multiple locations by comma):# es data 存储路径path.data: /home/environment/elasticsearch-cluster/elasticsearch-data-one/data## Path to log files:# log存储路径path.logs: /home/environment/elasticsearch-cluster/elasticsearch-data-one/logs## Set the bind address to a specific IP (IPv4 or IPv6):# 网路监听network.host: 0.0.0.0http.port: 9210transport.tcp.port: 9310## Pass an initial list of hosts to perform discovery when new node is started:# The default list of hosts is ["127.0.0.1", "[::1]"]# 可以发现当前节点的主节点ip:portdiscovery.zen.ping.unicast.hosts: ["127.0.0.1:9300"]# # Prevent the "split brain" by configuring the majority of nodes (total number of master-eligible nodes / 2 + 1):# 集群最小主节点个数#discovery.zen.minimum_master_nodes: 2## 设置跨域问题,方便使用elasticsearch-head来检测集群状态http.cors.enabled: truehttp.cors.allow-origin: /.*/

node-data-two

# 集群名称cluster.name: elasticsearch-cluster-demo## 节点信息node.name: node-data-twonode.master: falsenode.data: true## Path to directory where to store the data (separate multiple locations by comma):# es data 存储路径path.data: /home/environment/elasticsearch-cluster/elasticsearch-data/two/data## Path to log files:# log存储路径path.logs: /home/environment/elasticsearch-cluster/elasticsearch-data-two/logs## Set the bind address to a specific IP (IPv4 or IPv6):# 网路监听network.host: 0.0.0.0http.port: 9211transport.tcp.port: 9311## Pass an initial list of hosts to perform discovery when new node is started:# The default list of hosts is ["127.0.0.1", "[::1]"]# 可以发现当前节点的主节点ip:portdiscovery.zen.ping.unicast.hosts: ["127.0.0.1:9300"]# # Prevent the "split brain" by configuring the majority of nodes (total number of master-eligible nodes / 2 + 1):# 集群最小主节点个数#discovery.zen.minimum_master_nodes: 2## 设置跨域问题,方便使用elasticsearch-head来检测集群状态http.cors.enabled: truehttp.cors.allow-origin: /.*/

node-client-one

# 集群名称cluster.name: elasticsearch-cluster-demo## 节点信息node.name: node-client-onenode.master: falsenode.data: false## Path to directory where to store the data (separate multiple locations by comma):# es data 存储路径path.data: /home/environment/elasticsearch-cluster/elasticsearch-client-one/data## Path to log files:# log存储路径path.logs: /home/environment/elasticsearch-cluster/elasticsearch-client-one/logs## Set the bind address to a specific IP (IPv4 or IPv6):# 网路监听network.host: 0.0.0.0http.port: 9220transport.tcp.port: 9320## Pass an initial list of hosts to perform discovery when new node is started:# The default list of hosts is ["127.0.0.1", "[::1]"]# 可以发现当前节点的主节点ip:portdiscovery.zen.ping.unicast.hosts: ["127.0.0.1:9300"]# # Prevent the "split brain" by configuring the majority of nodes (total number of master-eligible nodes / 2 + 1):# 集群最小主节点个数#discovery.zen.minimum_master_nodes: 2## 设置跨域问题,方便使用elasticsearch-head来检测集群状态http.cors.enabled: truehttp.cors.allow-origin: /.*/

集群状态检测

当对每一个es节点的配置修改完以后,便可以启动每个节点,在主节点启动后,便可以使用elasticsearch-head来检测es的集群状态,也可以通过查看es的日志来查看节点自动加入集群的情况。

elasticsearch-head项目托管在github上,安装方式可见项目主页的README.txtile文件。项目地址如下:

安装成功后,在接入输入要连接的集群的某一个主节点的ip与端口,连接成功后即可看见该集群的状态,如下图所示:

在这里插入图片描述

你可能感兴趣的文章
2021-06-04msf结合漏扫模块suggester提权
查看>>
hdfs的api操作
查看>>
mapreduce的组成及原理
查看>>
大数据之Flume
查看>>
关于高可用配置hbase中出现的问题:Name or service not known
查看>>
centOs7下hadoop3.2.2namenode故障不自动转移
查看>>
在高可用的hive下执行bin/schematool -dbType mysql -initSchema报错
查看>>
hbase配置高可用
查看>>
linux下卸载和安装mysql
查看>>
在初始化namenode时:java.net.NoRouteToHostException: 没有到主机的路由;
查看>>
hive-hbase
查看>>
浅谈scala-API的基础概念及简单例子
查看>>
spark的历史服务器配置
查看>>
spark的API操作
查看>>
SparkSql
查看>>
SparkRdd-scala版本
查看>>
spark常见算子
查看>>
scala符号初体验
查看>>
kafka生产者常用参数含义
查看>>
kafka topic消息分配partition规则
查看>>