Stop elasticsearch from within a container

I'm launched Graylog, MongoDB, and Elasticsearch docker container stack on a VM. My goal is to move my currently running Graylog instance from a manually installed Graylog instance from an Ubuntu VM, to another Ubtunu VM using these Docker containers for a more lightweight, modular setup. I used the Graylog 4.0 docker install steps from Graylog docs: https://docs.graylog.org/en/4.0/pages/installation/docker.html, which uses the Elasticsearch docker install: https://www.elastic.co/guide/en/elasticsearch/reference/5.5/docker.html

I have a snapshot of my elasticsearch data sent to the /backup directory within my elasticsearch container. I've added path.repo: /backup to my elasticsearch.yml file, and then restarted the container.

When I run:
curl -X PUT -H "content-type:application/json" 'localhost:9200/_snapshot/snapshot' -d '{"type":"fs","settings":{"location":"/backup","compress":true}}'

I get:
{"error":{"root_cause":[{"type":"exception","reason":"failed to create blob container"}],"type":"repository_verification_exception","reason":"[snapshot] path is not accessible on master node","caused_by":{"type":"exception","reason":"failed to create blob container","caused_by":{"type":"access_denied_exception","reason":"/backup/tests-zZCKO31iRYSYni03DdEwgA"}}},"status":500}

I believe this is because elassticsearch is running. If so, I need to stop the elasticsearch service. But how do I do that from within the container?

Welcome to our community! :smiley:

What is the output from GET _snapshot/?

Thank you for your welcome.

And the answer to your question:
[root@3107e4c11987 elasticsearch]# curl -X GET localhost:9200/_snapshot {"snapshot":{"type":"fs","settings":{"compress":"true","location":"/backup"}}}[root@3107e4c11987 elasticsearch]

Thanks, what are the permissions on that directory?

Whelp, guess what I forgot to do this entire time!

After I changed the directory permissions to elasticsearch, I did get the following:

[root@3107e4c11987 /]# curl -XPUT -H "content-type:application/json" 'http://localhost:9200/_snapshot/snapshot' -d '{"type":"fs","settings":{"location":"/backup","compress":true}}'
{"acknowledged":true}

I was then able to delete pre-existing indices, restore, restart, and bring up graylog with all my data. Glad to know that I'm ready to migrate my server over.