DEV Community

aliona matveeva
aliona matveeva

Posted on

One Minute Notes: Master-Slave Database Replication

I am staring a new section in my blog — the One Minute Notes, short notes on some important IT topics that will take only one minute to read and get a brief understanding of the concept. In this episode of One Minute Notes, let’s talk about two types of Master-Slave database replication.

Data replication is a process of copying data between application’s databases. This is done for consistency, reliability, and performance of a service.

When replicating, the node where the data is modified and copied from is called master, and the node that receives data copy — a slave.

There are two types of data replication.

Single Master is the type of replication where data is modified on one (master) node only. After the changes are performed, the data from master database is replicated to slave database(s) that have read-only access for its clients.

This is the simple configuration of Master-Slave replication model, as it excludes any risk of conflicts.

Single Master replication is useful when you want to achieve safe data reading or have an always up-to-date database backup.

Some of Single Master replication’s weaknesses are the difficulty of write requests’ scale up and the need of manual failover handling.

Multi Master, in turn, is the configuration where data updating is available for multiple master nodes, that at the same time act as slaves for each other as well. As the data is modified and replicated everywhere “at the same time”, it enhances data’s availability in case one of the masters fail.

In this case it’s important to handle possible conflicts with concurrent changes on system level.

Multi Master replication is useful when you want to improve data writing and provide your service with a quick failover option.

One of main Multi Master replication’s weaknesses is the risk of losing some of transaction in case of one of master nodes failure.


Did you find this One Minute Note helpful? Hit like and follow me to read more of them later🙂

Top comments (1)

Collapse
 
ewoks profile image
Beeblebrox • Edited

can we rephrase this to "main & worker node" or "primary & secondary", instead of master-slave like everywhere across the industry please?