One of the most important elements of distributed database architecture is replication.
It determines whether or not the data is consistent / available.
|DB replication||Transactional replication/Merging replication/Snapshot replication|
Q: What are typical replication mechanisms for RDBMS?
|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?
|Masterless||Every node is a primary node|
Process of Master/Slave Replication Model:
- Writes are executed on master node(s), then replicate to slave nodes.
- 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).
Process of MasterLess Replication Model:
- Writes are executed in multiple nodes, which can also be called copies.
- 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?
Q: Explain the process of Multiple-Master Replication Model.
Q: Explain the process of db fail-over.
- database replication
- Introduction to Database Replication
- Distributed Databases and Replication Design
- Replication (computing) by wikipedia
- SQL Server Replication