ElasticSearch数据导出备份

安装ElasticDump

npm install elasticdump -g

数据导出

mkdir -p /home/pppc/esData

elasticdump --input=http://192.168.100.198:9200/mshpshop --output=/home/pppc/esData/mshpshop.log

elasticdump --input=http://192.168.100.198:9200/mprdproduct --output=/home/pppc/esData/mprdproduct.log

elasticdump --input=http://192.168.100.198:9200/mspcspecial --output=/home/pppc/esData/mspcspecial.log

elasticdump --input=http://192.168.100.198:9200/searchwordinfo --output=/home/pppc/esData/searchwordinfo.log

删除数据

curl -XDELETE http://127.0.0.1:9200/mshpshop/

curl -XDELETE http://127.0.0.1:9200/mprdproduct/

curl -XDELETE http://127.0.0.1:9200/mspcspecial/

curl -XDELETE http://127.0.0.1:9200/searchwordinfo/

数据导入

elasticdump --output=http://127.0.0.1:9200/mshpshop --input=/home/pppc/esData/mshpshop.log

elasticdump --output=http://localhost:9200/mprdproduct --input=/home/pppc/esData/mprdproduct.log

elasticdump --output=http://localhost:9200/mspcspecial --input=/home/pppc/esData/mspcspecial.log

elasticdump --output=http://localhost:9200/searchwordinfo --input=/home/pppc/esData/searchwordinfo.log

# 使用elasticdump工具可以实现数据以reindex的方式进行数据的备份与转移:

# index->index:

# elasticdump --input=http://localhost:9200/test --output=http://localhost:9200/test

# index->file:

# elasticdump --input=http://localhost:9200/test --output=./json.log

# file->index:

# elasticdump --input=./json.log --output=http://localhost:9200/test

猜你喜欢

转载自blog.csdn.net/wangjz2008/article/details/114082519