Rancher state details

Hi. So we have this Rancher rancher/server:stable up and running. Now we need to ensure the state is backed up somewhere :wink: my question is: is entire state of the Rancher contained inside the /var/lib/mysql volume so if I recreate rancher I have complete state as it was when the backup was made?

By the entire state I mean:

  1. rancher specific settings
  2. environments
  3. stacks
  4. container to run (in stacks)

By inspecting the rancher container I noticed it persists /var/lib/cattle as well, nothing special there though. I didn’t have a chance to do a test disaster recovery yet, but I’m planning to.

Yes, but unless you have a filesystem with point-in-time snapshots (e.g. ZFS) you should use something like docker exec -it <server container id> mysqldump cattle > backup.sql.

A straight cp or similar of a mysql data dir where the data is changing as it’s is being read for the copy is not crash-consistent and may not even load if you try to use it.