Cannot create repository for snapshot

I am trying to migrate data from ES version: 2.3.4, Build: e455fd0/2016-06-30T11:24:31Z, JVM: 1.8.0_91 to newer ES 5x.
I want to create snasphot a restore it in new ES, but I have problem with creating repository.
I use docker container and I am trying to do the backup from inside the container:
curl -XPUT 'http://IP:9200/_snapshot/my_backup' -d '{
"type": "fs",
"settings": {
"location": "/usr/share/elasticsearch/data/backup/my_backup",
"compress": true
First thing is that when I use localhost instead of IP, I get: "curl: (7) Failed to connect to localhost port 9200: Connection refused", but it works with IP address.

In container, the path exists with full permission (for sure now):
root@9ee4cd3b0527:/usr/share/elasticsearch/data/backup# ls -la
drwxrwxrwx 2 elasticsearch elasticsearch 4096 Mar 1 14:23 my_backup

I have set path.repo in /etc/elasticsearch/elasticsearch.yml

path.repo: ["/usr/share/elasticsearch/data/backup"]

which is also only parameter set there.
I have restart whole docker container, and nothing. When I do http://IP:9200/_nodes/?pretty, there are only logs and home paths:
"path" : {
"logs" : "/usr/share/elasticsearch/logs",
"home" : "/usr/share/elasticsearch"

When I run the CURL command, I get:

{"error":{"root_cause":[{"type":"repository_exception","reason":"[my_backup] failed to create repository"}],"type":"repository_exception","reason":"[my_backup] failed to create repository","caused_by":{"type":"creation_exception","reason":"Guice creation errors:\n\n1) Error injecting constructor, RepositoryException[[my_backup] location [/usr/share/elasticsearch/data/backup/my_backup] doesn't match any of the locations specified by path.repo because this setting is empty]\n at org.elasticsearch.repositories.fs.FsRepository.(Unknown Source)\n while locating org.elasticsearch.repositories.fs.FsRepository\n while locating org.elasticsearch.repositories.Repository\n\n1 error","caused_by":{"type":"repository_exception","reason":"[my_backup] location [/usr/share/elasticsearch/data/backup/my_backup] doesn't match any of the locations specified by path.repo because this setting is empty"}}},"status":500}

I run all commands from inside of container. It is standard container elasticsearch:2
Thank you for you help. I am new to ES and I am lost, even thought I found some similar issues and tried some things (adding REPO_PATH to init script as described here, changing syntax of path.repo ....)


Ok, so I can reply to myself.
I was adding path.repo property into /etc/elasticsearch.yml, but it didn't work. Then I found there is also elasticsearch.yml in /usr/share/elasticsearch/config. I put it there and it works. I don't know why the configuration file is on two locations there.

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.