Elasticsearch data backup #5074
-
Hello community, just wanted to share possible way of backups of ES data, I did not tested backup and restore with large amount of data, only few GB maybe, but still, maybe someone will get an idea to improve the way. Note: Please do test it first on your test environment before production, and of course create a backup/snapshots, whatever. My architecture is Manager + Heavy Nodes, so I guess this guide is for that setup as I am not sure if all the files are the same for other types. 1) Create Curator YML file This configuration will first delete all snapshots that are older than 7 days, so we can keep it weekly update which I suggest, because it would be better to keep more smaller backups, than one big, as the big one can take a lot of time for backup depending of your resources and of course there is higher risk for something to happen during the backup so you would need to start all over. If you want to keep more, play a bit with Create a Curator config file in
Apply changes with 2) Create Curator BASH script Then you need to create a Curator BASH script that will execute the Curator script through the Docker. This was basically just a copy and edited version of some other script that came with SO.
3) ES backup folder For this part I will first show config files and then explain how it works (at least I believe it works like this hehe). for the purpose of example, let's say you have mounted shared backup folder at location Then inside the Elasticsearch container create a) Then edit Then edit
Then use Now explanation: When a curator creates a snapshot, a noticed that it create it inside the Docker container, not the outside of it, therefor the only folder where we are able to write data is 4) Create a cronjob Make a copy of
Apply changes with And I believe this is it. You can go through Curator Documentation here to see more options to make it more personalized to your environment, as this was more for testing purposes. Feel free to propose changes or if something should be different. Cheers |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments 16 replies
-
I was trying to roll through this setup to test on my test cluster since you gratiously let me know you posted this out there; however, I hit a snag.
I would also like to note that it might be clearer for some newer users that if the two config files are not present in the local folders you need to copy them over from default.
Thanks again for writing up what you have so far, would love to get this working. |
Beta Was this translation helpful? Give feedback.
-
@facyber Thank you for this guide. I've gotten really close following it! One question: How do you register the snapshot repository? (my_repository in your example) Elasticsearch Documentation gives examples like
But I cannot figure how to channel that through docker or is it possible to do with so-elasticsearch-query? This is the error I currently get when the CRON tries to run:
My install is:
|
Beta Was this translation helpful? Give feedback.
-
@SaoPauloooo @facyber Yes, this was quite helpful, i spent several hours trying to figure out why elastic couldn't see my repo before I found this discussion. The key thing I was missing was having the mount point bound to the container. A couple of extra things I found:
It would be nice if there were a way to specify the repos in the pillar files and not have to maintain local copies of the salt files. I tried adding some jinja2 magic to defaults.yaml to pick it up out of the pillar for the searchnode, but something about the way salt parses/loads that file doesn't seem to handle complete jinja2 syntax. How SO maps the salt and pillar files into the working config files are still a bit of unobvious to me. |
Beta Was this translation helpful? Give feedback.
I was trying to roll through this setup to test on my test cluster since you gratiously let me know you posted this out there; however, I hit a snag.
Error:
unable to find user root: no matching entries in passwd file