标签:-- http backup eve 变量 rom ever inpu output
1.主要文件
[root@k8s elasticsearch]# tree
.
├── backup_es.sh
├── indices_file.txt
├── recover_es.sh
└── vars_config.conf
2.变量文件
[root@k8s elasticsearch]# cat vars_config.conf INDEX_FILE="/opt/elasticsearch/indices_file.txt" ELASTICSEARCHDUMP_CMD="/usr/local/node-v10.16.2-linux-x64/bin/elasticdump" OUTPUT_DIR="/data/backup/elasticsearch$(date +%Y%m%d%H%M%S)" INPUT_DIR="/data/backup/elasticsearch$(date +%Y%m%d%H%M%S)" BACKUP_ESURL="http://192.168.1.49:9200" REVOVER_ESURL="http://192.168.1.144:9200"
3.索引名文件
[root@k8s elasticsearch]# cat indices_file.txt
mytest09
4.备份脚本
[root@k8s elasticsearch]# cat backup_es.sh #!/bin/bash source ./vars_config.conf #backup every index in the index file for index in `cat $indices_file` do $ELASTICSEARCHDUMP_CMD --input=${BACKUP_ESURL}/$index --output=${OUTPUT_DIR}/${index}.map --type=mapping --limit=10000 --concurrency=1 $ELASTICSEARCHDUMP_CMD --input=${BACKUP_ESURL}/$index --output=${OUTPUT_DIR}/${index}.settings --type=settings --limit=10000 --concurrency=1 $ELASTICSEARCHDUMP_CMD --input=${BACKUP_ESURL}/$index --output=${OUTPUT_DIR}/${index}.data --type=data --limit=10000 --concurrency=1 done
5.恢复脚本
[root@k8s elasticsearch]# cat recover_es.sh #!/bin/bash source ./vars_config.conf #recover data from json file for es for index in `cat ${INDEX_FILE}` do $ELASTICSEARCHDUMP_CMD --input=${INPUT_DIR}/${index}.settings --output=${REVOVER_ESURL}/$index --type=settings --limit=10000 --concurrency=20 $ELASTICSEARCHDUMP_CMD --input=${INPUT_DIR}/${index}.map --output=${REVOVER_ESURL}/$index --type=mapping --limit=10000 --concurrency=20 $ELASTICSEARCHDUMP_CMD --input=${INPUT_DIR}/${index}.data --output=${REVOVER_ESURL}/$index --type=data --limit=10000 --concurrency=20 done
标签:-- http backup eve 变量 rom ever inpu output
原文地址:https://www.cnblogs.com/hixiaowei/p/11804169.html