Most Internet companies , All use MySQL Of InnoDB The engine stores data .
To ensure high availability of database , In order to ensure the expansion of performance , Most companies will use Master slave synchronization , Read / write separation Of MySQL Cluster architecture .
Traditional master-slave synchronization , Read / write separation MySQL The cluster architecture is shown in the figure above :
(1) Main library : The first instance on the left , Provide an instance of the write service ;
(2) Slave Library : Two instances on the right , Provide an instance of the read service ;
How does data replication work at this time ?
Still as shown in the figure above :
(1) The client submits the write operation to the main library ;
(2)Replication: The main library serializes the operation , adopt binlog To the slave library ;
(3) Perform the same sequence of operations from the library , For replica redundancy ;
Traditional master-slave synchronization , Read write separation redundancy mode , What are the problems with database clusters ?
(1) Users should pay attention to cluster details , Implement read-write separation ;
(2) Write library is still single point , Performance cannot be linearly scaled ;
(3) There is a delay in reading the library , Data inconsistency ;
(4) The writing library hung up , From the top of the library , There may be data loss ;
(5) If middleware is introduced ,SQL Ability will be affected ;
(6) O & M complexity ;
(7)…
Since there are so many pain points , Is there a technology , It can solve everyone's problems ?
Galera colony (Galera Cluster) Give birth to .
What is? Galera colony ?
Galera The cluster is based on MySQL InnoDB Synchronous replication :
(1) Sync ;
(2) Multimaster ;
(3) Database cluster ;
Voice over : It can support, for example MariaDB Wait for other databases , This article focuses on MySQL.
As shown in the figure above :
(1)Galera The cluster consists of a set of MySQL The cluster consists of ;
(2)Replication: This group MySQL Server usage Replication plug in To manage database replication ;
(3) The client can read and write to any node in the cluster ;
Galera The official website of the cluster is known as , It and its disadvantages :
(1) Real multi master (True Multi_Master), Any data changes will be copied to other nodes ;
(2) There is no such thing as slave latency (slave lag), Synchronous replication ;
(3) Strong consistency , All nodes are in a consistent state ;
(4) Hot standby , High availability , There is no need to deal with the so-called master-slave failover , There is no need to be empty IP;
(5) No read / write separation is required , You can read and write to any node at any time ;
(6) Support InnoDB;
(7) Transparent to the application ;
(8)…
All in all , In the description on the official website ,Galera Cluster is a highly available , High performance , To ensure data consistency and integrity :
(1) in the light of MySQL Of ;
(2) Based on synchronous authentication (synchronous certification-based);
(3) Multiple copies (replication);
Solution .
online Galera There seems to be less information , Asked some former friends , It doesn't seem to be used much in Internet companies , Ready to write in depth Galera colony , After all, MySQL Another choice after master-slave .
On the official website Galera, What technical points are you interested in ? Guess how it works ? Do you think it is necessary to write further ,or Change the subject ?
The comments told me .
MySQL Kernel related articles :
《 Buffer pool (buffer pool), This time I completely understand !》
《 Write buffer (change buffer), This time I completely understand !》
《 The log buffer (log buffer), This time I completely understand !》