2.1 ES集群的好处
es天然支持集群模式,其好处主要有两个:
1.能够增大系统的容量,如内存、磁盘,使得 es集群可以支持PB级的数据;
2.能够提高系统可用性,即使部分节点停止服务,整个集群依然可以正常服务;
2.2 ES如何组集群
单节点ES,如下图所示;
如果单节点出现问题,服务就不可用了,如何新增一个 es 节点加入集群
ELasticsearch 集群是由多个节点组成的,通过cluster.name 设置集群名称,并且用于区分其它的集群,每个节点通过 node.name 指定节点的名称
2.3 ES集群环境部署
2.3.1 环境准备
主机名称 | 外网IP WAN | 内网IP LAN |
es-node1 | 10.0.0.161 | 172.16.1.161 |
es-node2 | 10.0.0.162 | 172.16.1.162 |
es-node3 | 10.0.0.163 | 172.16.1.163 |
2.3.2 安装ES软件
# yum install java -y
# rpm -ivh elasticsearch-7.8.1-x86_64.rpm
2.3.3 node1集群节点配置
[root@es-node1 ~]# vim /etc/elasticsearch/elasticsearch.yml
[root@es-node1 ~]# grep "^[a-zA-Z]" /etc/elasticsearch/elasticsearch.yml
cluster.name: my-application # 集群名称,所有参加集群的节点集群名称应该保持一致
node.name: es-node1 # 节点名称
path.data: /var/lib/elasticsearch # es数据存储路径
path.logs: /var/log/elasticsearch # es日志存储路径
#bootstrap.memory_lock: true # 不使用swap分区
network.host: 172.16.1.161 # 监听在本地ip
http.port: 9200 # 监听在本地端口
discovery.seed_hosts: ["172.16.1.161", "172.16.1.162","172.16.1.163"] #集群主机列表
cluster.initial_master_nodes: ["172.16.1.161", "172.16.1.162","172.16.1.163"] # 仅第一次启动集群时对列表中的主机进行选举
2.3.4 node2集群节点配置
[root@es-node2 ~]# grep "^[a-zA-Z]" /etc/elasticsearch/elasticsearch.yml
cluster.name: my-application
node.name: es-node2
path.data: /var/lib/elasticsearch
path.logs: /var/log/elasticsearch
network.host: 172.16.1.162
http.port: 9200
discovery.seed_hosts: ["172.16.1.161", "172.16.1.162","172.16.1.163"]
cluster.initial_master_nodes: ["172.16.1.161", "172.16.1.162","172.16.1.163"]
2.3.5 node3集群节点配置
[root@es-node3 ~]# grep "^[a-zA-Z]" /etc/elasticsearch/elasticsearch.yml
cluster.name: my-application
node.name: es-node3
path.data: /var/lib/elasticsearch
path.logs: /var/log/elasticsearch
network.host: 172.16.1.163
http.port: 9200
discovery.seed_hosts: ["172.16.1.161", "172.16.1.162","172.16.1.163"]
cluster.initial_master_nodes: ["172.16.1.161", "172.16.1.162","172.16.1.163"]
标签:name,集群,elasticsearch,172.16,ElasticSearch,节点,es,搭建
From: https://blog.51cto.com/u_13236892/7816338