在/usr/local/bin目录下载esm工具。
将脚本也放在/usr/local/bin目录下。
------------------------------------------
vim /usr/local/bin/es-to-es.sh
#!/usr/bin/env bash
set eux
set -o pipefail
workspace="/usr/local/bin"
cd $workspace
allIndex=$(curl -s 'http://10.128.120.171:9200/_cat/indices' |awk '{print $3}')
for index in $allIndex
do
echo "Start migration $index"
./bin/linux64/esm -s http://10.128.120.171:9200 -d http://10.13.133.121:9200 -x $index -y $index -w=5 -b=10 -c 10000 --copy_settings --copy_mappings --force --refresh
echo "$index migration succ"
done
cd /usr/local/bin && nohup ./es-to-es.sh &