One of the most important elements of distributed database architecture is replication.

It determines whether or not the data is consistent / available.



Similar Posts:


linkedin
github
slack

Name Summary
DB replication Transactional replication/Merging replication/Snapshot replication
DB deployment Master-Slave/Multiple-Master/Masterless

Q: What are typical replication mechanisms for RDBMS?

Name Summary
Transactional replication Users receive full initial copies of the database and then receive periodic updates
Snapshot replication simply takes a “snapshot” of the data on one server and moves it to another server
Merging replication Data from two or more databases is combined into a single database
  • Transactional replication: Users receive full initial copies of the database and then receive periodic updates as data changes.

Database mirroring or Mysql Binlog Replication are typical transactional replications.

  • Merging replication: Data from two or more databases is combined into a single database.

Merge replication is primarily designed for mobile applications or distributed server applications that have possible data conflicts.

Common scenarios include: exchanging data with mobile users; consumer point of sale (POS) applications; and integration of data from multiple sites.

  • Snapshot replication: simply takes a “snapshot” of the data on one server and moves that data to another server (or another database on the same server).

Snapshot replication is used to provide the initial data set for transactional and merge replication; it can also be used when complete refreshes of data are appropriate. e.g elasticsearch snapshot feature.

SQL Server 2000 supports three distinct types of replication: snapshot, transactional, and merge, each of which has its own purpose.


Q: What are typical deployment models of replication mechanisms?

Name Summary
Master/Slave  
Multiple-Master  
Masterless Every node is a primary node

Process of Master/Slave Replication Model:

  1. Writes are executed on master node(s), then replicate to slave nodes.
  2. If we allow dirty reads, reads can happen in slave nodes. Otherwise read can only happen in master nodes as well.

Many large scale websites use mysql. They always have lots of reads with few writes. Thus people usually use master/slave model of mysql.

In Master/Slave Replication, master nodes are SPOF(single point of failure).

DB replication

Process of MasterLess Replication Model:

  1. Writes are executed in multiple nodes, which can also be called copies.
  2. If we allow dirty reads, reads can happen in one of the nodes. Otherwise we need to read all replicas.

Couchbase and elasticsearch are using masterless replication model.

Usually they are Quorum Based Voting.


Q: What are typical methods for mysql master HA? What the main logic looks like?

TODO:


Q: Explain the process of Multiple-Master Replication Model.

TODO


Q: Explain the process of db fail-over.

TODO


More Reading:

  1. database replication
  2. Introduction to Database Replication
  3. Distributed Databases and Replication Design
  4. Replication (computing) by wikipedia
  5. SQL Server Replication

Share It, If You Like It.

Leave a Reply

Your email address will not be published. Required fields are marked *