Asynchronous Replication:?
- Data is written to the primary database, and changes are replicated to
secondary databases after a delay.
- Advantages: Better performance due to less replication overhead.
- Disadvantages: Potential for data loss or inconsistency in the event of a
failure.
Tools for Replication:
- SQL Server: Use Always On Availability Groups or Transactional Replication.
- PostgreSQL: Use Streaming Replication or Logical Replication.
- MySQL: Use MySQL Replication or Group Replication.
- MongoDB: Use Replica Sets for automatic failover and high availability.
Example (PostgreSQL Streaming Replication):
# On Master Node
wal_level = replica
archive_mode = on
archive_command = 'cp %p /var/lib/postgresql/archive/%f'
# On Standby Node
primary_conninfo = 'host=master_ip port=5432 user=replication_user
password=replication_password'
Database Scaling & Performance