8 ES扩展集群节点
8.1 环境准备
主机名称 | 外网IP WAN | 内网IP LAN |
es-node4 | 10.0.0.164 | 172.16.1.164 |
es-node5 | 10.0.0.165 | 172.16.1.165 |
8.2 节点扩展1配置
[root@es-node4 ~]# grep "^[a-zA-Z]" /etc/elasticsearch/elasticsearch.yml
cluster.name: my-application
node.name: es-node-4
path.data: /var/lib/elasticsearch
path.logs: /var/log/elasticsearch
network.host: 172.16.1.164
http.port: 9200
discovery.seed_hosts: ["172.16.1.161", "172.16.1.162","172.16.1.163"] # 从这些主机中发现集群加入组织,可以写多个
node.data: true # 存储节点
node.master: false # 不参与master选举
8.3 节点扩展2配置
只充当路由节点 Coordinating
[root@es-node5 ~]# grep "^[a-zA-Z]" /etc/elasticsearch/elasticsearch.yml
cluster.name: my-application
node.name: es-node5
path.data: /var/lib/elasticsearch
path.logs: /var/log/elasticsearch
network.host: 172.16.1.165
http.port: 9200
discovery.seed_hosts: ["172.16.1.161", "172.16.1.162","172.16.1.163"]
node.data: false # 不存储
node.master: false # 不参与竞选
8.4 节点扩展检查
通过 cerebor检查集群扩展后的状态;如果出现集群无法加入、或者加入集群被拒绝,尝试删除/var/lib/elasticsearch 下的文件,然后重启 es;
如果将 data节点修改为 Coordinating 节点;需要清理数据,否则无法启动;
# repurpose 重新调整
[root@web02 ~]# /usr/share/elasticsearch/bin/elasticsearch-node repurpose
------------------------------------------------------------------------
WARNING: Elasticsearch MUST be stopped before running this tool.
Found 1 indices (1 shards and 1 index metadata) to clean up
Use -v to see list of paths and indices affected
Node is being re-purposed as no-master and no-data. Clean-up of index data will be performed.
Do you want to proceed? Confirm [y/N] y
Node successfully repurposed to no-master and no-data.