While elastic search is usually run as a cluster, for the sake of this tutorial I am showing the _snapshot and _restore tools.
mkdir /mnt/backups/my_backup
chmod 777 -R /mnt/backups/
Must available on all nodes.
curl -XPUT 'http://localhost:9200/_snapshot/my_backup' -d '{
"type": "fs",
"settings": {
"location": "/mnt/backups/my_backup",
"compress": true
}
}'
[root@centos-base mnt]# curl -XGET 'http://localhost:9200/_snapshot/my_backup?pretty'
{
"my_backup" : {
"type" : "fs",
"settings" : {
"compress" : "true",
"location" : "/mnt/backups/my_backup"
}
}
}
curl -XGET 'http://localhost:9200/_snapshot?pretty' {
"my_backup" : {
"type" : "fs",
"settings" : {
"compress" : "true",
"location" : "/mnt/backups/my_backup"
}
}
}
_____________________________________________________________________________________________
changing
curl -XPUT 'http://localhost:9200/_snapshot/my_backup' -d '{
"type": "fs",
"settings": {
"location": "/mnt/backups/my_backup",
"compress": true,
"verify":true
}
}'
curl -XPUT "localhost:9200/_snapshot/my_backup/snapshot_`date | tr -d " " | tr -d ":" | tr '[:upper:]' '[:lower:]' `?wait_for_completion=true&pretty"
_____________________________________________________________________________________________
restoring
mkdir -p /mnt/backups/my_backup
chmod -R 777 /mnt/backups/
Create repository
-----------------------
curl -XPUT 'http://localhost:9200/_snapshot/my_backup' -d '{
"type": "fs",
"settings": {
"location": "/mnt/backups/my_backup",
"compress": true,
"verify":true
}
}'
restore from file system
--------------------------------
curl -XPOST "localhost:9200/_snapshot/my_backup/snapshot_satapr25223454cest2015/_restore"
nJoy 😉
