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 synchronous or Asynchronous. But it will happen continuously..

    So this process Syncing data between database servers to increase availability called 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 Master which has permission to Read and Write Data in Database.

    Other side, There will be few database servers called Slaves which has permission only for Read the data.

    Master servers can be one or more... But Slaves will be more than masters,
    (Depends on the purpose and data size)
    master slave


    This master database can Read and Write data 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 are only able to read the 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 master will handle and read data.

    Slaves are fetching chances from master databases to keep them up to date.

    master slave


    Master - Slave is a way to increase the database availability and provide Zero Down time. But it will cost more data storage. Because, When we replicate 5GB of data over 3 servers, It will be 3 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 scalability and availability, Then go with Replication

    Cheers....... 💪💪💪💪

  • thanks brother,, this is very usefull

  • Web Development

    Thanks b6 very useful

  • @dev_lak thanks bro

  • @Malith thx bro

  • Nice article
    Thanks brother

  • @rachitha Thx bro

  • Linux Help

    Good article bro, awesome b6

  • @root Thx dude