Member-only story

Kubernetes StatefulSets

Ishan Liyanage
3 min readDec 11, 2020

Before we talk about stateful sets and why we need it, lets just start with simple server. We are going to deploy a database.

So we install and set up MySQL in the server and create the database.

Other applications can use it and write data. We are going to have high available (HA) set up to reduce failures. So we deploy additional servers and installed MySQL on those servers.

Now we have the blank database on the new servers. So how do we replicate data from original database to new databases?

We will use MySQL replication to do so. There are plenty of examples in the web for you to know nitty-gritty of setting up the MySQL replication and I am not gonna talk about it here.

The most common way is to have single Master and multiple Slaves. In other words we will write to Master and we can read either from Master or any Slave.

So the Master server set up first before we setting up the Slaves. Then we perform the initial clone of the database from the Master. Then enable continuous replication so what ever the updates in the Master will be replicated in the Slave.

Then we set up the second Slave. Instead of doing the same and clone data from the Master, we can now clone from the first Slave. This will reduce the load on the Master server. Finally we can enable continuous replication from the Master in to Slave 2.

Create an account to read the full story.

The author made this story available to Medium members only.
If you’re new to Medium, create a new account to read this story on us.

Or, continue in mobile web

Already have an account? Sign in

Ishan Liyanage
Ishan Liyanage

Written by Ishan Liyanage

Passionate Technical Lead, Senior Software Developer and free and open source software advocate. Based in Singapore.

No responses yet

Write a response