【发布时间】:2019-07-03 01:38:00
【问题描述】:
如何恢复弹性搜索快照另一个集群?没有 repository-s3、repository-hdfs、repository-azure、repository-gcs。
【问题讨论】:
标签: elasticsearch kibana snapshot elasticsearch-plugin
如何恢复弹性搜索快照另一个集群?没有 repository-s3、repository-hdfs、repository-azure、repository-gcs。
【问题讨论】:
标签: elasticsearch kibana snapshot elasticsearch-plugin
最后我找到了解决方案。它工作正常。请仔细阅读并执行。 如果您有任何问题,请联系我 waruna94kithruwan@gmail.com。
我有两个弹性搜索集群。我想要将 elastic_01 数据迁移到 elastic_02。 我的意思是 elastic_01 快照恢复到 elastic_02。我们走吧。
重要
(01) 设置 elastic_01 快照设置
$ curl -XPUT '/_snapshot/first_backup' -H 'Content-Type: application/json' -d '{ “类型”:“fs”, “设置”:{ "位置": "/home/snapshot/", “压缩”:真 } }'
(2) 将快照位置添加到 elasticsearch.yml (elastic_01) 编辑 elasticsearch.yml 文件并添加此代码行并保存。
$ path.repo: ["/home/snapshot/"]
(03) 创建快照 (elastic_01)
$ curl -XPUT "/_snapshot/first_backup/snapshot_1?wait_for_completion=true"
(04) 设置 elastic_02 快照设置
$ curl -XPUT '/_snapshot/first_backup' -H 'Content-Type: application/json' -d '{ “类型”:“fs”, “设置”:{ "位置": "/home/snapshot/", “压缩”:真 } }'
(05) 将快照位置添加到 elasticsearch.yml (elastic_02) 编辑 elasticsearch.yml 文件并添加此代码行并保存。
$ path.repo: ["/home/snapshot/"]
(06) 创建快照 (elastic_02)
$ curl -XPUT "/_snapshot/first_backup/snapshot_1?wait_for_completion=true"
(07) 将 elastic_01 快照复制到 >>>> elastic_02
(08) 列表快照
$ curl -XGET '/_snapshot/first_backup/_all?pretty'
(09) 恢复弹性搜索快照
$ curl -XPOST "/_snapshot/first_backup/snapshot_1/_restore?wait_for_completion=true"
【讨论】:
注意:我们需要将参数“include_global_state”设置为“true”以根据链接“https://www.elastic.co/guide/en/elasticsearch/client/curator/current/option_include_gs.html"”恢复模板
curl -X POST "localhost:9200/_snapshot/my_backup/snapshot_1/_restore?pretty" -H 'Content-Type: application/json' -d' { “include_global_state”:真 } '
{ “接受”:真 }
【讨论】:
这个答案是弹性搜索7.14。因此,可以在 NFS 上托管快照存储库。由于您希望将一个集群的快照还原到另一个集群,因此您需要满足以下先决条件:
elasticsearch 用户)所有,并授予适当的权限(chmod -R 777 <appropriate NFS directory> 为 elasticsearch 用户)现在,我将详细说明您复制数据可以采取的步骤。
fs 类型的注册表:PUT http://10.29.61.189:9200/_snapshot/registry1 { "type": "fs", "settings": { "location": "/usr/share/elasticsearch/snapshotrepo", "compress": true } }
PUT http://10.29.61.189:9200/_snapshot/registry1/snapshot_1?wait_for_completion=true { "indices": "employee,manager", "ignore_unavailable": true, "include_global_state": false, "metadata": { "taken_by": "binita", "taken_because": "test snapshot restore" } }
url 类型的注册表。键入 url 将确保相同的注册表(就共享 NFS 路径而言)在目标集群中是只读的。目标集群只能恢复/读取快照信息,不能写入快照。输入http://10.29.59.165:9200/_snapshot/registry1
{ "type": "url", "settings": { "url": "file:/usr/share/elasticsearch/snapshotrepo" } }
发布http://10.29.59.165:9200/_snapshot/registry1/snapshot_1/_restore
更多信息,请参考:https://www.elastic.co/guide/en/elasticsearch/reference/current/snapshots-restore-snapshot.html
【讨论】: