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.

  • mertn@lemmy.world
    link
    fedilink
    English
    arrow-up
    1
    ·
    12 hours ago

    My backup tooling just shuts down the container and associated db, then rysncs it all somwhere safe and restarts the container. Am I missing somethoing critical by not doing a db dump in the middle of that?

    • Zikeji@programming.dev
      link
      fedilink
      English
      arrow-up
      1
      ·
      12 hours ago

      Most of the time that’s perfectly fine, but if the database were in the middle of an operation you risk corruption.

      • mertn@lemmy.world
        link
        fedilink
        English
        arrow-up
        1
        ·
        7 hours ago

        The last thing I want is database corruption. That is why I “docker compose down” before I make a backup then “docker compose up” when the backup is complete. Is that not good enough? Do I have to do something else?

        • Zikeji@programming.dev
          link
          fedilink
          English
          arrow-up
          1
          ·
          edit-2
          1 hour ago

          Yes that’s good enough! Sorry I missed your statement about shutting down first. To clarify I leave mine running since a dump can recover if it gets corrupt.

          Basically my backup contains the database and the SQL dump (or equivalent) - that way I don’t need to shutdown the service.