Hello,

As the title suggests, how do you manage your DBs for docker services.

Do you spin a new DB for every new docker cluster or do you have a centralized DB that is accessible to the docker clusters.

What are the pros and cons of both method?

For the moment, I spin a new DB for every services as I feel it is easier to backup the service in case of a problem.

  • JC1@lemmy.ca
    link
    fedilink
    English
    arrow-up
    4
    ·
    5 hours ago

    I work per stack. Each stack can have multiple services/containers. So one db per stack. I usually work with the compose file provided by the app I want to run and they usually provide their database container in those. My persistent data for a stack is in a single folder for every services. For backup, I only have to backup the compose and environment files and also the persistent folder and that’s it. Every stack is independent from each other so it’s easier to move them from a server to another if I want to use more than one server.

    I used to use only one db container for all db. It worked well, until I had a data corruption issue. I had to rollback from a backup for all services that used this db. Then I moved to 1 db per stack and it happened again, but this time, only that stack was impacted, so no big deal. Just did a rollback and everything was fine.