一、准备
-
本次使用 xxx 的一套ES集群做展示。
-
不区分es版本
-
集群配置信息:
| 配置 | ip | owner | cmdb信息 | ES集群名 | ES版本 | 缓存大小 | 角色 | 分词器 | 密码 | 地址 | 是否交付 |
|---|
| 8C/32G/1000G | 172.23.235.189 | xxx | | oh-order-status-cluster | | 16G | | | elastic:P6UbYWOSj7Xx | | |
| 8C/32G/1000G | 172.23.235.190 | | | | | 16G | | | | | |
| 8C/32G/1000G | 172.23.236.32 | | | | | 16G | | | | | |
| 8C/32G/1000G | 172.23.236.33 | | | | | 16G | | | | | |
| 8C/32G/1000G | 172.23.236.34 | | | | | 16G | | | | | |
| 8C/32G/1000G | 172.23.235.63 | | | | | 16G | cdfhilmrstw | | | | |
| 8C/32G/1000G | 172.23.235.64 | | | | | 16G | | | | | |
| 8C/32G/1000G | 172.23.235.65 | | | | | 16G | | | | | |
| 8C/32G/1000G | 172.23.178.237 | xxx | | oh-order-status-cluster | | 16G | mdl | IK | elastic:123 | 172.23.178.237:9200 | |
| 8C/32G/1000G | 172.23.178.238 | | | | | 16G | mdl | IK | | 172.23.178.238:9200 | |
| 8C/32G/1000G | 172.23.178.239 | | | | | 16G | mdl | IK | | 172.23.178.239:9200 | |
| 8C/32G/1000G | 172.23.178.240 | | | | | 16G | dl | IK | | 172.23.178.240:9200 | |
| 8C/32G/1000G | 172.23.178.241 | | | | | 16G | dl | IK | | 172.23.178.241:9200 | |
| 8C/32G/1000G | 172.23.178.234 | | | | | 16G | dl | IK | | 172.23.178.234:9200 | |
| 8C/32G/1000G | 172.23.178.235 | | | | | 16G | dl | IK | | 172.23.178.235:9200 | |
| 8C/32G/1000G | 172.23.178.236 | | | | | 16G | dl | IK | | 172.23.178.236:9200 | |
-
集群节点信息
[root@qcshelkansible ~]# curl --user elastic:P6UbYWOSj7Xx http:
ip heap.percent ram.percent cpu load_1m load_5m load_15m node.role master name
172.25.235.64 45 66 1 0.12 0.06 0.05 cdfhilrstw - oh-enhancement-64
172.25.235.63 11 68 6 0.08 0.14 0.24 cdfhilmrstw * oh-enhancement-63
172.23.235.189 59 66 0 0.02 0.04 0.05 cdfhilrstw - oh-enhancement-189
172.23.235.65 48 65 1 0.01 0.16 0.26 cdfhilrstw - oh-enhancement-65
172.25.178.234 47 99 1 0.16 0.12 0.14 cdfhilrstw - node06
172.25.236.34 26 66 0 0.00 0.01 0.05 cdfhilrstw - oh-enhancement-34
172.25.178.239 34 99 2 0.12 0.18 0.14 cdfhilmrstw - master03
172.25.178.236 6 99 0 0.08 0.06 0.05 cdfhilrstw - node08
172.25.236.32 40 65 0 0.05 0.15 0.14 cdfhilrstw - oh-enhancement-32
172.25.178.235 9 99 0 0.01 0.04 0.07 cdfhilrstw - node07
172.25.235.190 32 66 0 0.00 0.01 0.05 cdfhilrstw - oh-enhancement-190
172.25.178.238 61 88 2 0.06 0.15 0.23 cdfhilmrstw - master02
172.25.178.240 35 98 1 0.16 0.11 0.13 cdfhilrstw - node04
172.25.178.241 46 94 3 0.14 0.10 0.10 cdfhilrstw - node05
172.25.236.33 19 66 0 0.02 0.03 0.05 cdfhilrstw - oh-enhancement-33
172.25.178.237 69 83 1 0.01 0.02 0.05 cdfhilmrstw - master01
二、操作
-
查看集群实际主的IP和hostname
curl --user elastic:P6UbYWOSj7Xx http://172.25.178.236:9200/_cat/nodes?v
-
查看策略
-
将节点 master oh-enhancement-63 剔除候选主清单
curl -X POST --user elastic:P6UbYWOSj7Xx http://172.25.178.237:9200/_cluster/voting_config_exclusions?node_names=oh-enhancement-63
-
查看修改后的策略
curl -X GET --user elastic:P6UbYWOSj7Xx http://172.25.178.237:9200/_cluster/state?filter_path=metadata.cluster_coordination.voting_config_exclusions
-
如果配置错误,清除策略,没有错误的话跳过此步骤
curl -X DELETE --user elastic:P6UbYWOSj7Xx http://172.25.178.237:9200/_cluster/voting_config_exclusions?wait_for_removal=false
-
完成
三、注意
- node_names 参数为node ID,也就是说为hostname
- voting_config_exclusions 参数同时设置多个node ID的时候使用 逗号 分割
curl -X POST http://172.16.70.34:9200/_cluster/voting_config_exclusions?node_names=ec-master-node-13,ec-master-node-14,ec-master-node-12