es的迁移方案脚本
备份记录
#!/usr/bin/env bash
srcUrl="10.2.67.244:9400"
dstUrl="10.2.38.201:9400"
# Get all indices
indices_file=/opt/dump/indices
curl -XGET "http://elastic:f4SI8SVNOjzT8FBbmlgE@${srcUrl}/_cat/indices/" | awk '{print $3}' > $indices_file
for i in $(cat $indices_file);do
if [[ $i == "."* ]];then
echo "${i} is dont backup"
continue
else
elasticdump --input=http://elastic:f4SI8SVNOjzT8FBbmlgE@${srcUrl}/${i} --output=http://elastic:f4SI8SVNOjzT8FBbmlgE@${dstUrl}/${i} --type=mapping
curl -i -H "Content-Type: application/json" -X PUT -d "{\"index.mapping.total_fields.limit\":\"10000\"}" http://elastic:f4SI8SVNOjzT8FBbmlgE@${dstUrl}/${i}/_settings/
elasticdump --input=http://elastic:f4SI8SVNOjzT8FBbmlgE@${srcUrl}/${i} --output=http://elastic:f4SI8SVNOjzT8FBbmlgE@${dstUrl}/${i} --type=data
fi
done
本文来自博客园,作者:六月OvO,转载请注明原文链接:https://www.cnblogs.com/chenlifan/p/17637441.html