What is 🛢Database Replication?
-
Database Replication is a mechanism whereby data is available in more than one location. It means, Having more than one database server and replicating all the data in all available database servers.

Why Database Replication 🙄🙄 ?
The Data-Centers or Large Scale Application Systems are handling millions of queries per second. This kind of continuous huge requests can create very very huge traffic and collision over the network. So there are many possibilities for Server Brake Down or Down Time 😥😥😥 .
To avoid this, If one database server fail, We need to provide data from another server until the failed server up again. And also we can reduce a load of a server by having more database instances âš– .
For that we need no sync data from a main server to other servers. This syncing process can be
synchronousorAsynchronous. But it will happen continuously..So this process
Syncing data between database servers to increase availabilitycalled Replication.
Master - Slave Architecture
In Database Replication, Most Engineers go with a very efficient architecture called Master - Slave.
In this architecture there will be database server called
Masterwhich has permission toReadandWriteData in Database.Other side, There will be few database servers called
Slaveswhich has permission only forReadthe data.Master servers can be one or more... But Slaves will be more than masters,
(Depends on the purpose and data size)

Master
This master database can
ReadandWritedata in Database, But mostly used to write data.When application wants to write the data, The query or request will be forwarded to one of the master server.
And also masters will sync the data to their slaves.
Slaves
Slavesare only able toreadthe data from database. So when application want to read a data, The query or request will be forwarded to one of the slave.When slaves down, and there are no slaves to handle, The
masterwill handle and read data.Slaves are
fetching chancesfrommaster databasesto keep themup to date.
Conclusion
Master - Slaveis a way to increase the database availability and provideZero Down time. But it will cost more data storage. Because, When we replicate5GBof data over3 servers, It will be3 x 5 = 15GB.Current Databases are much faster than before. So it is not compulsory to implement replication for smaller level projects.
But when you want more
scalabilityandavailability, Then go withReplicationCheers....... 💪💪💪💪
-
thanks brother,, this is very usefull
-
Thanks b6 very useful
-
@dev_lak thanks bro
-
@Malith thx bro
-
Nice article
Thanks brother -
@rachitha Thx bro
-
Good article bro, awesome b6
-
@root Thx dude