移除数据节点
移除node前可以先exclude要移除的node
l cluster:
cluster.routing.allocation.exclude._name : node1
l Index:
index.routing.allocation.exclude._name: node1
index.routing.allocation.require.node_type: hot
技巧:以上参数可根据_ip、_host等来进行配置 以上参数可实现hot-warn
目标:迁移替换stock-es生产环境容器10.10.21.171到新物理机
步骤:
1、使用elastic-dump备份stock-es生产环境所有业务索引settings mappings和文档数据
2、rolling迁移stock-es节点10.10.21.171,从物理机10.10.37.16到10.10.45.18
3、确认stock-es集群状态,预期集群状态为yellow,进行副本分片的拷贝
4、业务端确认服务状态
5、等待副本分片拷贝完毕,整个es节点替换工程完成
极端情况:2-5步骤中间,stock-es集群中已有节点发生故障,造成索引分片不完整,索引数据无法被读写
查看集群中没有主分片的索引
curl 10.10.21.171:9200/_cat/indices|grep red
使用步骤1备份出的索引信息进行索引恢复
索引备份脚本
while read LINE
do
echo $LINE
elasticdump --input=http://10.10.21.171:9200/$LINE --output=/data/$LINE\_setting.json --type=settings
elasticdump --input=http://10.10.21.171:9200/$LINE --output=/data/$LINE\_mapping.json --type=mapping
elasticdump --input=http://10.10.21.171:9200/$LINE --output=/data/$LINE.json --type=data --limit=2000
done < a.txt
cat a.txt
perf_announce
found_cn
screener_us
warrant_hk
perf_notice
us_ext_post
us_option
stock_hk
us_ext_pre
perf_disclosure
bond_cn
stock_cn
screener_hk
screener_cn
perf_express
event
stock_us
otc_cn
us_option_delay