elasticsearch數據備份恢復
本文主要介紹elasticsearch集群數據備份及恢復,利用共享文件系統,通過快照方式備份。
集群的部署參考:http://hnr520.blog.51cto.com/4484939/1876467
一、配置修改
1.配置文件必須添加如下參數
path.repo: /mnt/backups/es_mybak
二、數據備份
1.創建備份倉庫
curl -XPUT ‘http://192.168.115.11:9200/_snapshot/EsBackup‘ -d ‘{ "type": "fs", "settings": { "location": "/mnt/backups/es_mybak" } }‘ [[email protected]
給我們的倉庫取一個名字,在本例它叫 EsBackup 。
我們指定倉庫的類型應該是一個共享文件系統,這裏采用nfs。
最後,我們提供一個已掛載的設備(/mnt/backups/es_mybak )作為目的地址。
註意:共享文件系統路徑必須確保集群所有節點都可以訪問到。
2.查詢備份倉庫
[[email protected] local]# curl -XGET ‘http://192.168.115.11:9200/_snapshot?pretty‘ { "EsBackup" : { "type" : "fs", "settings" : { "location" : "/mnt/backups/es_mybak" } } }
3.備份所有索引
curl -XPUT ‘http://192.168.115.11:9200/_snapshot/EsBackup/snapshot_all‘ [[email protected]