【笔记】Elasticsearch snapshot(快照)数据迁移
# 设置快照仓库
PUT _snapshot/my_backup
{
"type": "fs",
"settings": {
"location": "/path/to/backup/directory"
}
}
# 创建快照
PUT _snapshot/my_backup/snapshot_1
# 如果需要在目标集群上预先设置仓库(假设仓库类型相同),可以使用以下命令:
PUT _snapshot/my_backup
{
"type": "fs",
"settings": {
"location": "/path/to/target/backup/directory"
}
}
# 恢复快照到目标集群
POST _snapshot/my_backup/snapshot_1/_restore
以上脚本展示了如何在Elasticsearch中设置快照仓库,创建快照,以及如何将快照恢复到目标集群。注意,这些命令需要在Elasticsearch的命令行界面(CLI)或者通过cURL发送到Elasticsearch的API端点。
评论已关闭