Snapshot repository failure

Hey all,

I'm attempting to setup snapshots on my ES cluster. So I came up with this command:

curl --user admin:secret PUT http://logs.example.com:9200/_snapshot/jf_backup \
'{
    "type": "fs",
        "settings": {
        "location": "/mnt/backup/jf_bacukup/"
    }
}'

Which seems to me like it should work! But instead I'm getting the following error:

curl: (6) Could not resolve host: PUT
{"error":"RemoteTransportException[[JF_ES3][inet[/xx.xx.xx.xx:9300]][cluster:admin/repository/get]]; nested: RepositoryMissingException[[jf_backup] missing]; ","status":404}curl: (3) [globbing] nested brace in column 41

But I checked and verified that the backup directory exists on all 3 hosts:

for i in logs ES2 ES3; do echo "checking repository on: $i"; ssh -qt bluethundr@$i.example.com "/bin/sudo -S /bin/ls -ld /mnt/backup; /bin/sudo -S /bin/ls -ld /mnt/backup/jf_bacukup/"; echo; done
checking repository on: logs
drwxr-xr-x. 3 elasticsearch elasticsearch 4096 Aug 21 18:50 /mnt/backup
drwxr-xr-x. 2 elasticsearch elasticsearch 4096 Aug 21 18:50 /mnt/backup/jf_bacukup/

checking repository on: ES2
drwxr-xr-x. 3 elasticsearch elasticsearch 4096 Aug 21 18:50 /mnt/backup
drwxr-xr-x. 2 elasticsearch elasticsearch 4096 Aug 21 18:50 /mnt/backup/jf_bacukup/

checking repository on: ES3
drwxr-xr-x. 3 elasticsearch elasticsearch 4096 Aug 21 18:50 /mnt/backup
drwxr-xr-x. 2 elasticsearch elasticsearch 4096 Aug 21 18:50 /mnt/backup/jf_bacukup/

So what on Earth could I be doing wrong? I'm pretty sure I'm missing something simple, but I'd appreciate a little help here on what that could be. :smile:

Thanks

Try curl --user admin:secret -XPUT http://logs.example.com:9200/_snapshot/jf_backup.... instead.

You are missing the -X from the command so it things that PUT is the hostname.

Hey! Yep. That did it.

#curl --user admin:secret -XPOST "http://logs.example.com:9200/_snapshot/jf_backup" -d'
> {
>     "type": "fs",
>             "settings": {
>                     "location": "/mnt/backup/jf_bacukup/"
>                         }
> }'
{"acknowledged":true}

Thank you

Sorry one more prob:

#curl --user admin:$ES_PASS -XPUT "http://logs.example.com:9200/jf_backup/snapshot_1"
No handler found for uri [/jf_backup/snapshot_1] and method [PUT]

Shouldn't the snapshot_1 part be arbitrary? Why is this command failing?

Per the docs you need to put _snapshot first.

Got it!

curl --user admin:$ES_PASS -XPUT "http://logs.example.com:9200/_snapshot/jf_backup/snapshot_1"
{"accepted":true}

one more question. I'm getting a failure on retrieving info about the backups using this method:

#curl --user admin:$ES_PASS -XGET "http://logs.example.com:9200/_snapshot/jf_backup/snapshot_1?pretty=true"
{
  "error" : "RemoteTransportException[[JF_ES3][inet[/66.147.235.108:9300]][cluster:admin/snapshot/get]]; nested: ElasticsearchParseException[Failed to derive xcontent]; ",
  "status" : 400
}

That backup was created with the following command:

curl --user admin:$ES_PASS -XPUT "http://logs.exmple.com:9200/_snapshot/jf_backup/snapshot_1"
{"accepted":true}

That command looks alright to me! So why do you think this is failing?

Thanks