Implement Replication with Patroni, etcd and Haproxy
Introduction Database replication is the process of automatically copying and synchronizing data from one database server (called Master or Primary ) to one or more other servers (called Slave , Standby or Replica ). Thus, the way it works is when there are data modification operations on the Master , the changes will be executed equivalently on the Slave . Advantages If you only run a single Database node, you will face many risks that Replication can resolve as follows: High Availability (HA) : If the Master node suffers a hardware failure or power outage, an active Slave node will immediately be elected as the new Master , which is the Failover mechanism helping the system continue running without disruption. Read Scalability : Data writing queries ( INSERT, UPDATE, DELETE ) must be sent to the Master. But reading queries ( SELECT ), which account for most of the system load demand, can be evenly distributed among the Slaves for processing. Disaster Recovery : You can place ...