欢迎来到尧图网

客户服务 关于我们

您的位置:首页 > 汽车 > 新车 > ElasticSearch 在不同集群之间进行数据迁移

ElasticSearch 在不同集群之间进行数据迁移

2025/5/1 18:09:55 来源:https://blog.csdn.net/xirigh/article/details/143208845  浏览:    关键词:ElasticSearch 在不同集群之间进行数据迁移

ElasticSearch 在不同集群之间进行数据迁移

在两台集群分别安装s3插件,以允许数据上传至s3

elasticsearch-plugin install repository-s3

在es配置文件jvm.options中添加如下内容:

-Des.allow_insecure_settings=true

重启es

备份数据

此方法可以用于es数据的备份

在源集群上创建快照存储库my_minio_repo

# my_minio_repo 为快照存储库名称
curl -X PUT "http://192.168.1.101:9200/_snapshot/my_minio_repo" -H 'Content-Type: application/json' -d '{"type": "s3","settings": {  # minio的配置"bucket": "es-bak","base_path": "snapshots", "endpoint": "http://xxxx:9000","access_key": "user","secret_key": "password","path_style": true}
}'

创建快照

# ss_20241024 为快照名称
# my_minio_repo 为存储库名称
# wait_for_completion=false为不需要等待快照完全生成,任务创建完成即返回
curl -X PUT "http://192.168.4.223:29203/_snapshot/my_minio_repo/ss_20241024?wait_for_completion=false"

恢复数据

在目标集群上创建快照存储库

# my_minio_repo 为快照存储库名称
curl -X PUT "http://192.168.1.102:9200/_snapshot/my_minio_repo" -H 'Content-Type: application/json' -d '{"type": "s3","settings": {  # minio的配置"bucket": "es-bak","base_path": "snapshots", "endpoint": "http://xxxx:9000","access_key": "user","secret_key": "password","path_style": true}
}'

从快照恢复数据

# ss_20241024 为快照名称
# my_minio_repo 为存储库名称
# indices 为要恢复快照的索引,多个用逗号连接
# rename_pattern 为要匹配的索引名正则,可选
# rename_replacement  给索引名加前缀 prefix_  可选
curl -X POST "http://192.168.1.2:9200/_snapshot/my_minio_repo/ss_20241024/_restore" -H 'Content-Type: application/json' -d '{"indices": "index1,index2,index3","rename_pattern": "(index1|index2|index3)","rename_replacement": "prefix_$1"
}'

版权声明:

本网仅为发布的内容提供存储空间,不对发表、转载的内容提供任何形式的保证。凡本网注明“来源:XXX网络”的作品,均转载自其它媒体,著作权归作者所有,商业转载请联系作者获得授权,非商业转载请注明出处。

我们尊重并感谢每一位作者,均已注明文章来源和作者。如因作品内容、版权或其它问题,请及时与我们联系,联系邮箱:809451989@qq.com,投稿邮箱:809451989@qq.com

热搜词