Database replication can be used in DBMS with a master/slave relationship, where a original master DB syncs and controls the slave DB.
- Master DB usually is WRITE intensive, and all the write operations like Create, Update, Delete, Mutate, must be sent only to Master DB.
- All the slave DBs are READ intensive.
- Most applications have a high read to write ratio, and thus the number of slave databases can be increased to support it.
Advantages
Better Performance
All the write operations will happen on master, and read operations will happen on slaves. It improves performance because more query operations can be done parallely.
Reliability
If any of the DB is destroyed in a natural disaster, the data will be safe, as there are replicas.
High Availability
By deploying the DB replicas in different locations, we ensure that the user always gets the data, even when the DB closer to him is offline.
What if one of the DB goes down?
- If the only slave DB goes down, the Master DB will now handle read operation as well. And once the issue is sorted out, a new slave DB will replace the old one.
- In case of multiple slave DBs, and one of them fails, all the query requests will be forwarded to healthy slaves.
- If the master DB goes down, one of the slave DBs is elected and promoted as the new Master. And immediately a new slave DB is created and replaced.
Top comments (0)