Taking snapshot in Openshift elasticsearch

Hi,

I'm trying to create a repository to take snapshot (https://www.elastic.co/guide/en/elasticsearch/reference/2.4/modules-snapshots.html)

When I execute the curl PUT command to create the repository I'm getting repository_missing_exception error. Could anyone please help why I'm getting repository_missing_exception when I'm actually trying to create the repository. Thank you.

I have very little knowledge in ES, so please bear with me if I have done something incorrectly.

Following is the command I tried.

sh-4.2$ curl --key /etc/elasticsearch/secret/admin-key --cert /etc/elasticsearch/secret/admin-cert --cacert /etc/elasticsearch/secret/admin-ca PUT https://localhost:9200/_snapshot/my_backup{"type":"fs","settings":{"location":"/elasticsearch/persistent/backup_test","compress":true}}
curl: (6) Could not resolve host: PUT; Unknown error
{"error":{"root_cause":[{"type":"repository_missing_exception","reason":"[my_backuptype:fs] missing"}],"type":"repository_missing_exception","reason":"[my_backuptype:fs] missing"},"status":404}No handler found for uri [/_snapshot/my_backupsettings:location:/elasticsearch/persistent/backup_test] and method [GET]{"error":{"root_cause":[{"type":"repository_missing_exception","reason":"[my_backupsettings:compress:true] missing"}],"type":"repository_missing_exception","reason":"[my_backupsettings:compress:true] missing"},"status":404}sh-4.2$
sh-4.2$
sh-4.2$
sh-4.2$
sh-4.2$ curl --key /etc/elasticsearch/secret/admin-key --cert /etc/elasticsearch/secret/admin-cert --cacert /etc/elasticsearch/secret/admin-ca PUT https://localhost:9200/_snapshot/my_backup {"type":"fs","settings":{"location":"/elasticsearch/persistent/backup_test","compress":true}}
curl: (6) Could not resolve host: PUT; Unknown error
{"error":{"root_cause":[{"type":"repository_missing_exception","reason":"[my_backup] missing"}],"type":"repository_missing_exception","reason":"[my_backup] missing"},"status":404}curl: (6) Could not resolve host: type; Unknown error
curl: (6) Could not resolve host: settings:location; Unknown error
curl: (6) Could not resolve host: settings:compress; Unknown error
sh-4.2$
sh-4.2$
sh-4.2$ pwd
/elasticsearch/persistent
sh-4.2$ ls
backup  backup_test  logging-es
sh-4.2$
sh-4.2$ curl --key /etc/elasticsearch/secret/admin-key --cert /etc/elasticsearch/secret/admin-cert --cacert /etc/elasticsearch/secret/admin-ca GET https://localhost:9200/_cat/nodes?v
curl: (6) Could not resolve host: GET; Unknown error
host          ip            heap.percent ram.percent load node.role master name
172.20.23.244 172.20.23.244           59          99 0.05 d         m      logging-es-data-master-5ku70fyl
172.20.13.185 172.20.13.185           42          98 0.25 d         m      logging-es-data-master-tvohg72r
172.20.21.213 172.20.21.213           18          99 0.18 d         *      logging-es-data-master-rcvz8y4i
sh-4.2$ curl --key /etc/elasticsearch/secret/admin-key --cert /etc/elasticsearch/secret/admin-cert --cacert /etc/elasticsearch/secret/admin-ca GET https://localhost:9200/_cat/health?v
curl: (6) Could not resolve host: GET; Unknown error
epoch      timestamp cluster    status node.total node.data shards pri relo init unassign pending_tasks max_task_wait_time active_shards_percent
1543987079 13:17:59  logging-es green           3         3    663 378    0    0        0             0                  -                100.0%
sh-4.2$

I'm not sure about the curl command syntax.
curl: (6) Could not resolve host: PUT - that suggests to me that you're not talking to the host localhost but to PUT.

I would try:

curl --key /etc/elasticsearch/secret/admin-key \
    --cert /etc/elasticsearch/secret/admin-cert \
    --cacert /etc/elasticsearch/secret/admin-ca \
    https://localhost:9200/_cat/health?v

Which can be shortened to:

es_util --query=_cat/health?v

If that helps, then the curl you want might be something like this:

curl --key /etc/elasticsearch/secret/admin-key \
    --cert /etc/elasticsearch/secret/admin-cert \
    --cacert /etc/elasticsearch/secret/admin-ca \
    -XPUT https://localhost:9200/_snapshot/my_backup \
    -d '{"type":"fs","settings":{"location":"/elasticsearch/persistent/backup_test","compress":true}}'

Shortened to:

es_util --query=_snapshot/my_backup -XPUT \
    -d '{"type":"fs","settings":{"location":"/elasticsearch/persistent/backup_test","compress":true}}'
2 Likes

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