ES切主操作手册

19 阅读2分钟

一、准备

  1. 本次使用 xxx 的一套ES集群做展示。

  1. 不区分es版本

  1. 集群配置信息:

配置ipownercmdb信息ES集群名ES版本缓存大小角色分词器密码地址是否交付
8C/32G/1000G172.23.235.189xxxoh-order-status-cluster16Gelastic:P6UbYWOSj7Xx
8C/32G/1000G172.23.235.19016G
8C/32G/1000G172.23.236.3216G
8C/32G/1000G172.23.236.3316G
8C/32G/1000G172.23.236.3416G
8C/32G/1000G172.23.235.6316Gcdfhilmrstw
8C/32G/1000G172.23.235.6416G
8C/32G/1000G172.23.235.6516G
8C/32G/1000G172.23.178.237xxxoh-order-status-cluster16GmdlIKelastic:123172.23.178.237:9200
8C/32G/1000G172.23.178.23816GmdlIK172.23.178.238:9200
8C/32G/1000G172.23.178.23916GmdlIK172.23.178.239:9200
8C/32G/1000G172.23.178.24016GdlIK172.23.178.240:9200
8C/32G/1000G172.23.178.24116GdlIK172.23.178.241:9200
8C/32G/1000G172.23.178.23416GdlIK172.23.178.234:9200
8C/32G/1000G172.23.178.23516GdlIK172.23.178.235:9200
8C/32G/1000G172.23.178.23616GdlIK172.23.178.236:9200
  1. 集群节点信息

[root@qcshelkansible ~]# curl --user elastic:P6UbYWOSj7Xx http://172.25.178.236:9200/_cat/nodes?v                                     
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           



二、操作

  1. 查看集群实际主的IP和hostname

# 查询目前实际主的ip和hostname
curl --user elastic:P6UbYWOSj7Xx http://172.25.178.236:9200/_cat/nodes?v
  1. 查看策略

  2. 将节点 master oh-enhancement-63 剔除候选主清单

# 将 节点 master oh-enhancement-63 剔除master候选清单
curl -X POST --user elastic:P6UbYWOSj7Xx  http://172.25.178.237:9200/_cluster/voting_config_exclusions?node_names=oh-enhancement-63
  1. 查看修改后的策略

curl -X GET --user elastic:P6UbYWOSj7Xx http://172.25.178.237:9200/_cluster/state?filter_path=metadata.cluster_coordination.voting_config_exclusions
  1. 如果配置错误,清除策略,没有错误的话跳过此步骤

curl -X DELETE --user elastic:P6UbYWOSj7Xx http://172.25.178.237:9200/_cluster/voting_config_exclusions?wait_for_removal=false
  1. 完成




三、注意

  1. node_names 参数为node ID,也就是说为hostname
  2. 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