0

I do have n nodes managed by Kubernetes, all of them running several containers. A container may contain a database alongside with an application. As containers should be stateless, all data within the container's database would be lost (uppon restart or redeployment via Kubernetes). Hence, I thought of a central database (See Fig. 2.6.2 Management) which contains all Databases for permanent persistence. The idea is to link the Container's Database via Master-Master synchronization to the related permanent persisted database.

As each Node runs docker and boots up the image into a container, how does the container's database initially synchronize all the master's content? It can't be pre-shipped within the image, as the image will be build by an external source, only providing the compiled services and not knowing anything about the actual database(s) structure/source.

The only thing I can currently think of is a sqldump that gets requested by the container on boot-up. (via SMB, SSH,...) But that seems a bit off to me.

enter image description here

4
  • do you share the data over all instances? does each instance need its own database server?
    – Ewan
    Commented Mar 21, 2021 at 9:25
  • Yes, they need to share data across all instances. The idea of the Master-Master config is, that each container has full read-write access. Furthermore, it continues to operate even if other nodes/management node goes down. Due to the DB structure it is possible that 'n' nodes and their containers operate on the same table, not interfering with each other. My assumption: if 'n' nodes with 'n' containers would rely on a single db instance, they aren't failsave.
    – Bin4ry
    Commented Mar 21, 2021 at 15:36
  • hmmm its really tricky/impossible to sync a relational db master-master-master. think about transactions. If you have immutable or sharded data you could maybe do it, but its going to use a lot of bandwidth and disc space for all that duplication. Why not just have a separate base metal database and failover cluster?
    – Ewan
    Commented Mar 21, 2021 at 21:12
  • I decided to go with a cluster, consisting of two databases in master-master config. Guess that strips out a lot of complexity.
    – Bin4ry
    Commented Mar 25, 2021 at 15:55

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.