Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

Table of Contents

What's desired

For replicating database(MySQL) in SDNC SDN-C following things were needed:

...

  • StatefulSet: 
    • Used to manage Stateful applications. 
    • Guarantees fixed numbering for a POD. 
    • Also using headless service, PODs were registered with there own unique FQDN in DNS; this makes it possible for other PODs to find a POD even after restart (with different IPAddress).
  • Since we were using a single Kubernetes VM, hosting a volume dynamically on the local-store VM for newly spun slaves was not straight-forward (support wasn't inbuilt). However, Kubernetes does support writing external provisioners which did the job for us. This provisioner actually created a virtual NFS Server on top of a local store.The instance of nfs-provisioner will watch for PersistentVolumeClaims that ask for the StorageClass and automatically create NFS-backed  PersistentVolumes for them.

We used Kubernetes example to replicate MySQL server; this was modified to suit the needs for SDNCSDN-C DB.


Internals

For each MYSQL POD, 2 init-containers and 2 containers are spawned.

...

Unfortunately if a master fails, we need to write a script (or an application) to promote one of the slaves to be the master and instruct other slaves and applications to change to the new master. You can see more details here.

Other way is to use GTID based replication.

...