es的备份与恢复
2021-10-15 本文已影响0人
one_8274
指定index进行备份
- 设置备份保存路径。如下设置备份文件夹名为graph_backup,存储文件路径/data/duser/industry_es_backup
PUT /_snapshot/my_backup
{
"type": "fs",
"settings": {
"location": "/data/duser/industry_es_backup"
}
}
- 指定index进行备份
PUT /_snapshot/my_backup/snapshot_graph
{
"indices": "devjanus_qiye_mixedcodeqiye1607495310,devjanus_renwu_mixedcoderenwu1607485038,devjanus_industry_supply_chain_1130_mixedcodeindustry_supply_chain_11301606705883"
}
快照恢复
- 创建设置快照文件夹
curl -XPUT -u username:password
"http://host:9200/_snapshot/my_backup" -H 'Content-Type:
application/json' -d '
{
"type": "fs",
"settings": {
"location": "/data/duser/preprocess/es"
}
}
- 将生成的快照压缩文件夹进行解压
- 进行相关快照恢复,并重命名指定index
## 如下修改前缀
POST /_snapshot/my_backup/snapshot_graph/_restore
{
"indices":
"devjanus_qiye_mixedcodeqiye1607495310,devjanus_renwu_mixedcoderenwu1607485
038,devjanus_industry_supply_chain_1130_mixedcodeindustry_supply_chain_1130
1606705883",
"rename_pattern": "devjanus_(.+)",
"rename_replacement": "a_zc_$1"
}
## 如下也是替换前缀
POST /_snapshot/my_backup/snapshot_industry/_restore
{
"indices":
"industry_company_v1,industry_v2,main_product_cal_v6,product_v2,company_finance
_cal_v4",
"rename_pattern": "(.+)_v[0-9]",
"rename_replacement": "a_zc_$1"
}