一、自建ES集群下载repository-s3插件(集群所有服务器都要操作)
/usr/share/elasticsearch/bin/elasticsearch-plugin install repository-s3
二、创建华为云OBS
三、创建华为云子账号,并授权OSS管理权限
四、修改elasticsearch的jvm.options(集群所有服务器都要操作)
添加内容
-Des.allow_insecure_settings=true
五、重启elasticsearch(集群所有服务器都要操作)
六、设置OBS为快照仓库
curl -H "Content-Type: application/json" -X PUT http://192.168.1.100:9200/_snapshot/my_backup -d '{"type": "s3","settings": {"endpoint": "obs.cn-north-1.myhuaweicloud.com","access_key": "xxxxxxxxxxxxxxx","secret_key": "xxxxxxxxxxxxxxxxx","bucket": "OBS桶名","compress":"true"}}'
七、创建快照(快照名index_bak)
数据量太大会出问题,只能一个索引一个索引的做快照
curl -XPUT 'http://192.168.1.100:9200/_snapshot/backup/index_bak' -d '{"indices": "index1,index2"}'
八、将OBS的文件传输到OSS上
九、创建OSS存储
十、创建阿里云子账号,给予管理OSS的权限
十一、阿里云elasticsearch设置镜像长裤
curl -H "Content-Type: application/json" -X PUT 'http://elastic:***@es-cn-***.elasticsearch.aliyuncs.com:9200/_snapshot/my_backup/' -d' {"type": "oss","settings": {"endpoint": "http://oss-cn-beijing-internal.aliyuncs.com","access_key_id": "***","secret_access_key": "***","bucket": "OSSBucket 名称","compress":"true"}}'
十二、阿里云elasticsearch导入快照
curl -H "Content-Type: application/json" -X PUT http://elastic:***@es-cn-***.elasticsearch.aliyuncs.com:9200/_snapshot/my_backup/index_bak/_restore