＼こんにちは！／ • I’m yoku0825, working as DBA for the compan y’s web services. • Husband of my wife :) • Father of my sun :) • I love MySQL too match, such as I can’t log-in PostgreSQL and Oracle :( • Maybe Perl Monger, seldom wrote codes but!!
Today, I talk about Percona XtraDB Cluster
Today, I talk about Percona XtraDB Cluster ぺるこな えくすとらでぃーびーくらすたー
Do you know Percona LLC? Famous their work are Percona-Toolkit, for MySQL Utility Tools, and Percona-Server, extended MySQL clone. http://www.percona.com/
XtraDB Cluster is implementation of Galera Replication by Percona LLC. What’s Galera Replication? ATO-DE-MATA-DETEKIMASU.
「あ、XtraDB」 「えっ」 「ホットで」 「えっ」 「えっ」
くらい、響きが良いですよね :D XtraDBだけだと ストレージエンジンの 名前なんですけどね
Percona XtraDB Cluster Clustered by – Multi Master – (Virtual) Synchronous – Parallel in Row-Level Write Set Replication(wsrep) So it makes flat(no nodes are specific as Master or Slave) MySQ L Replication topology. And wsrep takes a automated Full-physical and Increment-logic al data synchronization.
Multi Master • Al nodes are writable – Of cource, standard MySQL Replication is so. – But you write into table on Replication Slave, its upda tes(INSERT, UPDATE, DELETE, and so) are not replicat ed to any node without its own Slave Server. This means it breaks consistency, so we can’t allow t o write Replication Slave by read_only option variable. – wsrep library certs consistency when you write into t able on any node by using (Virtual) Synchronous Repl ication.
(Virtual) Synchronous • All nodes have same data (DAI-TAI) anytime – When you write some data into some node, wsrep library hooks I nnoDB API and writes wsrep’s binary log(Galera Cache) in row-ba sed binary log, before it answers commit request. – Galera Cache is pushed through Communication-Path and confir med “Can it execute with integrity, without conflict of update?” o n al other nodes. – When wsrep gets that confirmation(Certification) on al other no des, its update is committed at last. Otherwise, when wsrep received Certification Failure, its transac tion wil rol back(=return Error: 1213 “Deadlock found when trying to get lock.”) and any node doesn’t update to keep consistency.
(Virtual) Synchronous • Why it cal ed “Virtual” Synchronous? – It has a little rag between Certification and Real-W rite into Disk. – The server which is received to write request at fir st writes its data into disk and notifies “its data is c ommitted”. All other servers can write into disk aft er that notification(because of keeping it transacti on can rollback)
Parallel in Row-Level • Any updates logged in Galera Cache is Row-Based Binary log – It makes each Certification is isolated in Row-Level, it makes each C ertification can work in multi thread. – Statement-Based Replication can’t detect even if replication has los t data consistency. Do you face Error:1032 “Can’t find record in `ta blename`”? • Not only Galera Cache, but also “binary log” for using standa rd replication. – It inherits some weakpoint of standard RBR. • MySQL 5.6 improves Multi Thread SQL_Thread but it works o nly separated Database-Level.
State Snapshot Transfer(SST) • It is full data copy from joined cluster node to joining c luster node, automated by wsrep library. – You can choise “rsync”(physical copy, need lock), “mysqldu mp”(logical copy, need lock too), “custom script”. – XtraDB Cluster can use xtrabackup(physical copy, without lo ck) as “custom script”. It makes adding new node and comi ng back downed node are lock-free and almost automation. • If wsrep detects “impossible(=can’t certificate) updat e” why data is mismatch just then wsrep execute SST and keeps consistency over the cluster.
Incremental State Transfer(IST) • It is incremental data copy from joined cluster no de to joining cluster node, automated by wsrep li brary. – When cluster node leave and come back shortly, wsr ep doesn’t need SST if they have enough Galera Cach e covered all over its downtime. – IST doesn’t need any locks and need any reads physic al data file, because of IST uses only Galera Cache. An d Galera Cache is maybe hot cache ‘coz it is “nearest updates for cluster”, IST is very faster than SST.
Flat Topology + Automated SST = • You don’t be annoyed at al , when – “OMG! Master is down! Get to switchover now!” • There’s nothing to do you’ve already prepared your LVS confi gure. – “OMG! There is some different data between Master a nd Slave!” • wsrep have already fixed it before you know that, you can se e only the fact SST is done. – “OMG! Today is Christmas but I don’t have Girlfriend!” • I’m very veeeeery sorry. If I don’t introduce XtraDB Cluster, yo u can keep you don’t know that.
Combination with Standard Replication • wsrep hooks only InnoDB write method, it means w srep is separated from MySQL standard Replication. – Each node joining XtraDB Cluster can be Slave of another mysqld. – Any mysqld can be Slave of node joining XtraDB Cluster. – But XtraDB Cluster Node doesn’t have binary log for upda te through Galera Cache and inside out, you have to put l og-slave-updates in your my.cnf. – And you have to know, wsrep doesn’t support(correctly, “does ignore”) except of updates into InnoDB.