赞
踩
关闭索引命令
curl -XPOST http://ip:9200/索引名称/_close
恢复索引命令
curl -XPOST http://ip:9200/*202205*/_open
遇到问题索引权限问题关闭失败
{"type":"cluster_block_exception","reason":"blocked by: [FORBIDDEN/12/index read-only / allow delete (api)];"}
修改权限
curl -XPUT -H 'Content-Type: application/json' http://127.0.0.1:9200/_all/_settings -d '{"index.blocks.read_only_allow_delete": null}'
备份数据
备份索引数据
注:以下索引名可用*模糊匹配如:*index*
1. 备份索引映射(Mapping)
./elasticdump \
--input=http://127.0.0.1:9200/索引名 \
--output=索引名-mapping.json \
--type=mapping
2. 备份索引数据
./elasticdump \
--input=http://127.0.0.1:9200/索引名 \
--output=索引名-data.json \
--type=data \
--limit=1000
以上两步执行完成后会在当前目录生成"索引名-mapping.json"和"索引名-data.json"两个文件,里面包含指定索引的映射信息和数据
(三)还原索引数据
数据还原时只需要将第二节数据备份中的命令的input和output对调即可
1. 还原索引映射(Mapping)
./elasticdump \
--input=索引名-mapping.json \
--output=http://127.0.0.1:9200/索引名 \
--type=mapping
2. 还原索引数据
./elasticdump \
--input=索引名-data.json \
--output=http://127.0.0.1:9200/索引名\
--type=data \
--limit=1000
curl -XDELETE http://{IP}:9200/索引名
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。