Versions Compared

Key

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

Table of Contents

...

  • StatefulSet
    • Used to manage Stateful applications. 
    • Guarantees fixed numbering for a POD. 
    • Using headless service, PODs were registered with their own unique FQDN in DNS; this makes it possible for other PODs to find a POD even after a restart (albeit with a 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 this Kubernetes example to replicate MySQL server; this was modified to suit the needs for SDN-C DB.

...

  • 2 init containers:
    • init-mysql
      1. Generates special MySQL config files based on an Ordinal index. (the ordinal index is saved in server-id.cnf)
      2. Uses config-map to copy the master.cnf/slave.cnf files to the conf.d directory.
    • clone-mysql:
      1. Performs a clone operation the first time the Slave comes up, assuming that Master already has some data on it when the Slave starts.
      2. Uses the OpenSource tool Percona for this jobHot backup the data from previous MySQL pod using binlog which is powered by Percona xtrabackup (https://www.percona.com/software/mysql-database/percona-xtrabackup)
  • 2 containers:
    • mysqld:
      • Actual MySQL server
    • xtrabackup Xtrabackup sidecar:
      1. Handles all of the replication between this server and the Master.
      2. Handles requests from other Pods for data cloning.

...

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

The other option is to use GTID-based replication.

...