elasticsearch6.8.11备份至minio

1.(所有节点执行)在线安装repository-s3插件
bin/elasticsearch-plugin install repository-s3

修改安装目录的属组
安装完成后重启所有节点服务
2.(所有节点执行)配置access_key,请使用minio的实际access-key权限
bin/elasticsearch-keystore add s3.client.default.access_key
3.(所有节点执行)配置secret_key,请使用minio的实际secret-key权限
bin/elasticsearch-keystore add s3.client.default.secret_key
4.(所有节点执行)所有节点配置文件增加配置如下,endpoint只能填写IP地址,不能填写域名
# minio的api连接地址,不能写域名(域名无法解析),只能写IP地址
s3.client.default.endpoint: 192.168.1.123:9000
s3.client.default.protocol: http


修改安装目录的属组
修改完配置后重启所有节点服务生效
5.创建s3备份仓库
注意:须在minio中提前创建bucket:es-backup
curl -uelastic:f3g5OxRbxcFITUqIQfMc -XPUT 'http://localhost:9200/_snapshot/backup' -H 'Content-Type: application/json' -d '{ "type": "s3", "settings": { "bucket": "es-backup"} }' 
6.查看仓库状态
curl -uelastic:f3g5OxRbxcFITUqIQfMc -XPOST http://localhost:9200/_snapshot/backup/_verify?pretty
7.备份所有索引
curl -uelastic:f3g5OxRbxcFITUqIQfMc -XPUT http://localhost:9200/_snapshot/backup/snapshot_all_3?wait_for_completion=true
8.查看所有备份快照信息
curl -uelastic:f3g5OxRbxcFITUqIQfMc -XGET http://localhost:9200/_snapshot/backup/_all?pretty
9.删除快照
curl -uelastic:f3g5OxRbxcFITUqIQfMc -XDELETE localhost:9200/_snapshot/backup/snapshot_all_4?pretty
10.恢复备份
curl -uelastic:f3g5OxRbxcFITUqIQfMc -XPOST http://localhost:9200/_snapshot/backup/snapshot_all_2/_restore
11.恢复备份中的指定索引
curl -uelastic:f3g5OxRbxcFITUqIQfMc -XPOST http://localhost:9200/_snapshot/backup/snapshot_all_4/_restore -H 'Content-Type: application/json'  -d'{ "indices": "lrh_index","ignore_unavailable": true, "include_global_state": false }'
12.创建索引
curl -uelastic:f3g5OxRbxcFITUqIQfMc -XPUT 'http://localhost:9200/lrh_index' 
13.删除索引
curl -uelastic:f3g5OxRbxcFITUqIQfMc -XDELETE 'http://localhost:9200/lrh_index' 

你可能感兴趣的:(数据库,linux,elasticsearch)