First, the backup on a public cloud server ES
1 , create a backup repo
curl -uelastic:'ES&ceshi720' -XPUT "http://172.30.0.17:9200/_snapshot/my_cos_backup" -d '{"type": "cos","setti,"access_key_secret": "Secret","bucket": "estest","region": "ap-guangzhou","compress": true,"chunk_size": "500mb","base_path": "/"}}' -H'Content-Type: application/json'
2, perform snapshot backups
curl -uelastic:'123' -XPUT "http://172.30.0.17:9200/_snapshot/my_cos_backup/snapshot_1?wait_for_completion=true"
=================================
Second, do snapshots on Tencent cloud server
3 , the ES node 1 on the COS on all backup download
Installation coscmd
yum install python-pip -y
pip install coscmd
Configuring coscmd initial parameters
coscmd config -a accesskeyid -s Secret -b estest -r ap-guangzhou
Configuring coscmd optimization parameters
vim /root/.cos.conf
[common]
secret_id = accesskeyid
secret_key = Secret
bucket = estest-1300672061
region = ap-guangzhou
max_thread = 20
part_size = 1
schema = http
verify = md5
anonymous = False
With coscmd will be towed back to the entire bucket locally , temporarily stored in a directory
coscmd download -r / /data/esback
4 , modify all local ES configuration
mkdir -p /data/essnapshot
chown -R elasticsearch:elasticsearch /data/essnapshot
vim config / elasticsearch.yml
Add the line
path.repo: ["/data/essnapshot"]
Restart ES Service
5 , the ES node 1 is mounted on the NFS service
yum install nfs* rpcbind -y
vim /etc/exports
Add the line:
/data/essnapshot *(rw,no_root_squash,no_all_squash,sync)
Restart Service
exportfs -r
service rpcbind restart
service nfs restart
6 , the ES node 2 , 3 mounted on the other nodes and NFS
showmount -e xxxx to see if normal release mount point
Then begin to mount
mkdir -p /data/essnapshot
chown -R elasticsearch:elasticsearch /data/essnapshot
mount -t nfs 10.0.1.111:/data/essnapshot /data/essnapshot1 -o proto=tcp -o nolock
Ensure that all nodes can see / data / essnapshot in the file
7 , in which an ES execute commands, create a backup repo
curl -XPUT 'http://10.0.0.7:9200/_snapshot/my_backup' -d '{"type":"fs","settings":{"location":"/data/essnapshot","compress":"true"}}' -H'Content-Type: application/json'
8 , move the files to the snapshot directory
mv /data/esback/* /data/essnapshot
9、restore
curl -XPOST 'http://10.0.0.7:9200/_snapshot/my_backup/snapshot_1/_restore?wait_for_completion=true'