SlideShare a Scribd company logo
1 of 36
XtraDB Cluster


     Chiba.pm #2 at 2013/03/23
                      yoku0825
\こんにちは!/
• I’m yoku0825, working as DBA for the
  company’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」
 「えっ」
「ホットで」
 「えっ」
 「えっ」
orz
くらい、響きが良いですよ
     ね :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)
MySQL Replication topology.

And wsrep takes a automated Full-physical and
Increment-logical data synchronization.
wsrep
• wsrep is the concept for realize following notes(following
  next page)
   – wsrep implementation by cordership named Galera
     Replication, it takes the form of patch for MySQL(there is
     implementation for PostgreSQL, but I don’t know about that).
     And MySQL compiled with Galera Replication patch is
     destributed by cordership, named Galera Cluster for MySQL.
       • http://www.codership.com/content/using-galera-cluster
   – Percona-Server compiled with Galera Replication patch is
     named Percona XtraDB Cluster.
       • http://www.percona.com/software/percona-xtradb-cluster
   – MariaDB compiled with Galera Replication patch is named
     MariaDB Galera Cluster.
       • https://kb.askmonty.org/en/what-is-mariadb-galera-cluster/
Multi Master
• All nodes are writable
  – Of cource, standard MySQL Replication is so.
  – But you write into table on Replication Slave, its
    updates(INSERT, UPDATE, DELETE, and so) are not
    replicated to any node without its own Slave Server.
    This means it breaks consistency, so we can’t allow to
  write Replication Slave by read_only option variable.
  – wsrep library certs consistency when you write into
    table on any node by using (Virtual) Synchronous
    Replication.
(Virtual) Synchronous
• All nodes have same data (DAI-TAI) anytime
   – When you write some data into some node, wsrep library
      hooks InnoDB API and writes wsrep’s binary log(Galera
      Cache) in row-based binary log, before it answers commit
      request.
   – Galera Cache is pushed through Communication-Path and
      confirmed “Can it execute with integrity, without conflict
      of update?” on all other nodes.
   – When wsrep gets that confirmation(Certification) on all
      other nodes, its update is committed at last.
      Otherwise, when wsrep received Certification Failure, its
   transaction will rollback(=return Error: 1213 “Deadlock found
   when trying to get lock.”) and any node doesn’t update to
   keep consistency.
(Virtual) Synchronous
• Why it called “Virtual” Synchronous?
  – It has a little rag between Certification and Real-
    Write into Disk.
  – The server which is received to write request at
    first writes its data into disk and notifies “its data
    is committed”. All other servers can write into disk
    after that notification(because of keeping it
    transaction 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 Certification can work in multi thread.
   – Statement-Based Replication can’t detect even if
     replication has lost data consistency. Do you face
     Error:1032 “Can’t find record in `tablename`”?
• Not only Galera Cache, but also “binary log” for using
  standard replication.
   – It inherits some weakpoint of standard RBR.
• MySQL 5.6 improves Multi Thread SQL_Thread but it
  works only separated Database-Level.
State Snapshot Transfer(SST)
• It is full data copy from joined cluster node to joining
  cluster node, automated by wsrep library.
   – You can choise “rsync”(physical copy, need
     lock), “mysqldump”(logical copy, need lock too), “custom
     script”.
   – XtraDB Cluster can use xtrabackup(physical copy, without
     lock) as “custom script”. It makes adding new node and
     coming back downed node are lock-free and almost
     automation.
• If wsrep detects “impossible(=can’t certificate) update”
  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
  node to joining cluster node, automated by wsrep
  library.
  – When cluster node leave and come back shortly,
    wsrep doesn’t need SST if they have enough Galera
    Cache covered all over its downtime.
  – IST doesn’t need any locks and need any reads
    physical data file, because of IST uses only Galera
    Cache. And 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 all, when
  – “OMG! Master is down! Get to switchover now!”
     • There’s nothing to do you’ve already prepared your LVS
       configure.
  – “OMG! There is some different data between Master
    and Slave!”
     • wsrep have already fixed it before you know that, you can
       see 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, you can keep you don’t know that.
Combination with
              Standard Replication
• wsrep hooks only InnoDB write method, it means
  wsrep 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
     update through Galera Cache and inside out, you have to
     put log-slave-updates in your my.cnf.
   – And you have to know, wsrep doesn’t
     support(correctly, “does ignore”) except of updates into
     InnoDB.
How is it?
Do you feel something WAK-WAK?
勿論弱点も(いっぱい)ありま
      す
                      I/Oに負荷が偏るとか
                wsrepの部分の日本語情報少ないとか
        xtrabackupと連携させるのにinnobackupexいじるとか
          xtrabackup使わないとSSTでリードロックかかるし
 RBR前提なのでバイナリログでっかいとかPrimary Keyが無いと悲惨とか
        更新がかかったノードにしかバイナリログ無いとか
     InnoDB(XtraDB)以外のデータはそもそも同期されないとか
性能は?
     tpcc-mysqlで叩いた感じ、Semi-Sync(M/S)の3割引くらいでした
        ネットワーク帯域とかバイナリログの保管場所にも注意
              LVS通した分のオーバーヘッドもたぶんある
       パラレルレプリケーションする為にそれなりのコアが必要
         (1行が1スレッド使うから、1万行更新するクエリは…)
サーバまたぎの更新がlock waitじゃなくてCertification Failure(=Deadlock扱い)になるの
                        で、
             アプリ側でハンドルしてやらないといけない
( ´-`).oO(難易度的には
                   ndbcluster(=MySQL
Cluster)と
                   良い勝負かな)
              異論はあると思う
でも楽しそうですよね!

  何より響きが良い
ところでみなさん
お気付きでしょうか
実はこれ、Perlの話じゃないんで
         す
    “Percona” =~ /^Per/
           But
    “Percona” != “Perl”
Chiba.pm #1 で話していた
書き捨てMySQLモニターツー
            ル
  https://github.com/yoku0825/my_collector
挫折しましたorz

だってCactiあるんだもん
でもたまに役に立ちます

 Cactiよりドリルダウンしたいとき
金曜日に地味に機能追加してみたりした

スローログ数えるやつも地味に使ってる
https://github.com/yoku0825/my_slowlog
あ、あと
この前MyNA会で
「俺はVimmer」って言いました
         が
あれは嘘です

     嘘っていうか、
Vimしか使えない消極的Vimmer

.vimrcもgtags関連しか入れてない
Terapad最高!

Perlスクリプトもてらぱで書く
ご清聴ありがとうございました

     オチなし

More Related Content

What's hot

MySQL HA with PaceMaker
MySQL HA with  PaceMakerMySQL HA with  PaceMaker
MySQL HA with PaceMakerKris Buytaert
 
Percona XtraDB Cluster vs Galera Cluster vs MySQL Group Replication
Percona XtraDB Cluster vs Galera Cluster vs MySQL Group ReplicationPercona XtraDB Cluster vs Galera Cluster vs MySQL Group Replication
Percona XtraDB Cluster vs Galera Cluster vs MySQL Group ReplicationKenny Gryp
 
Webinar slides: Introducing Galera 3.0 - Now supporting MySQL 5.6
Webinar slides: Introducing Galera 3.0 - Now supporting MySQL 5.6Webinar slides: Introducing Galera 3.0 - Now supporting MySQL 5.6
Webinar slides: Introducing Galera 3.0 - Now supporting MySQL 5.6Severalnines
 
9 DevOps Tips for Going in Production with Galera Cluster for MySQL - Slides
9 DevOps Tips for Going in Production with Galera Cluster for MySQL - Slides9 DevOps Tips for Going in Production with Galera Cluster for MySQL - Slides
9 DevOps Tips for Going in Production with Galera Cluster for MySQL - SlidesSeveralnines
 
Highly Available MySQL/PHP Applications with mysqlnd
Highly Available MySQL/PHP Applications with mysqlndHighly Available MySQL/PHP Applications with mysqlnd
Highly Available MySQL/PHP Applications with mysqlndJervin Real
 
Percona Toolkit for Effective MySQL Administration
Percona Toolkit for Effective MySQL AdministrationPercona Toolkit for Effective MySQL Administration
Percona Toolkit for Effective MySQL AdministrationMydbops
 
Repair & Recovery for your MySQL, MariaDB & MongoDB / TokuMX Clusters - Webin...
Repair & Recovery for your MySQL, MariaDB & MongoDB / TokuMX Clusters - Webin...Repair & Recovery for your MySQL, MariaDB & MongoDB / TokuMX Clusters - Webin...
Repair & Recovery for your MySQL, MariaDB & MongoDB / TokuMX Clusters - Webin...Severalnines
 
Galera Replication Demystified: How Does It Work?
Galera Replication Demystified: How Does It Work?Galera Replication Demystified: How Does It Work?
Galera Replication Demystified: How Does It Work?Frederic Descamps
 
Galera cluster for high availability
Galera cluster for high availability Galera cluster for high availability
Galera cluster for high availability Mydbops
 
Galera explained 3
Galera explained 3Galera explained 3
Galera explained 3Marco Tusa
 
Plny12 galera-cluster-best-practices
Plny12 galera-cluster-best-practicesPlny12 galera-cluster-best-practices
Plny12 galera-cluster-best-practicesDimas Prasetyo
 
3 周彦偉-隨需而變 我所經歷的my sql架構變遷﹣周彥偉﹣acmug@2015.12台北
3 周彦偉-隨需而變 我所經歷的my sql架構變遷﹣周彥偉﹣acmug@2015.12台北3 周彦偉-隨需而變 我所經歷的my sql架構變遷﹣周彥偉﹣acmug@2015.12台北
3 周彦偉-隨需而變 我所經歷的my sql架構變遷﹣周彥偉﹣acmug@2015.12台北Ivan Tu
 
Migrating to XtraDB Cluster
Migrating to XtraDB ClusterMigrating to XtraDB Cluster
Migrating to XtraDB Clusterpercona2013
 
Reducing Risk When Upgrading MySQL
Reducing Risk When Upgrading MySQLReducing Risk When Upgrading MySQL
Reducing Risk When Upgrading MySQLKenny Gryp
 
Percon XtraDB Cluster in a nutshell
Percon XtraDB Cluster in a nutshellPercon XtraDB Cluster in a nutshell
Percon XtraDB Cluster in a nutshellFrederic Descamps
 
Ansible is Our Wishbone(Automate DBA Tasks With Ansible)
Ansible is Our Wishbone(Automate DBA Tasks With Ansible)Ansible is Our Wishbone(Automate DBA Tasks With Ansible)
Ansible is Our Wishbone(Automate DBA Tasks With Ansible)M Malai
 
Introduction to MariaDB MaxScale
Introduction to MariaDB MaxScaleIntroduction to MariaDB MaxScale
Introduction to MariaDB MaxScaleI Goo Lee
 
Webinar Slides : Migrating to MySQL, MariaDB Galera and/or Percona XtraDB Clu...
Webinar Slides : Migrating to MySQL, MariaDB Galera and/or Percona XtraDB Clu...Webinar Slides : Migrating to MySQL, MariaDB Galera and/or Percona XtraDB Clu...
Webinar Slides : Migrating to MySQL, MariaDB Galera and/or Percona XtraDB Clu...Severalnines
 

What's hot (20)

Oss4b - pxc introduction
Oss4b   - pxc introductionOss4b   - pxc introduction
Oss4b - pxc introduction
 
MySQL HA with PaceMaker
MySQL HA with  PaceMakerMySQL HA with  PaceMaker
MySQL HA with PaceMaker
 
Percona XtraDB Cluster vs Galera Cluster vs MySQL Group Replication
Percona XtraDB Cluster vs Galera Cluster vs MySQL Group ReplicationPercona XtraDB Cluster vs Galera Cluster vs MySQL Group Replication
Percona XtraDB Cluster vs Galera Cluster vs MySQL Group Replication
 
Webinar slides: Introducing Galera 3.0 - Now supporting MySQL 5.6
Webinar slides: Introducing Galera 3.0 - Now supporting MySQL 5.6Webinar slides: Introducing Galera 3.0 - Now supporting MySQL 5.6
Webinar slides: Introducing Galera 3.0 - Now supporting MySQL 5.6
 
9 DevOps Tips for Going in Production with Galera Cluster for MySQL - Slides
9 DevOps Tips for Going in Production with Galera Cluster for MySQL - Slides9 DevOps Tips for Going in Production with Galera Cluster for MySQL - Slides
9 DevOps Tips for Going in Production with Galera Cluster for MySQL - Slides
 
Highly Available MySQL/PHP Applications with mysqlnd
Highly Available MySQL/PHP Applications with mysqlndHighly Available MySQL/PHP Applications with mysqlnd
Highly Available MySQL/PHP Applications with mysqlnd
 
Percona Toolkit for Effective MySQL Administration
Percona Toolkit for Effective MySQL AdministrationPercona Toolkit for Effective MySQL Administration
Percona Toolkit for Effective MySQL Administration
 
Repair & Recovery for your MySQL, MariaDB & MongoDB / TokuMX Clusters - Webin...
Repair & Recovery for your MySQL, MariaDB & MongoDB / TokuMX Clusters - Webin...Repair & Recovery for your MySQL, MariaDB & MongoDB / TokuMX Clusters - Webin...
Repair & Recovery for your MySQL, MariaDB & MongoDB / TokuMX Clusters - Webin...
 
Galera Replication Demystified: How Does It Work?
Galera Replication Demystified: How Does It Work?Galera Replication Demystified: How Does It Work?
Galera Replication Demystified: How Does It Work?
 
Galera cluster for high availability
Galera cluster for high availability Galera cluster for high availability
Galera cluster for high availability
 
Galera explained 3
Galera explained 3Galera explained 3
Galera explained 3
 
Plny12 galera-cluster-best-practices
Plny12 galera-cluster-best-practicesPlny12 galera-cluster-best-practices
Plny12 galera-cluster-best-practices
 
3 周彦偉-隨需而變 我所經歷的my sql架構變遷﹣周彥偉﹣acmug@2015.12台北
3 周彦偉-隨需而變 我所經歷的my sql架構變遷﹣周彥偉﹣acmug@2015.12台北3 周彦偉-隨需而變 我所經歷的my sql架構變遷﹣周彥偉﹣acmug@2015.12台北
3 周彦偉-隨需而變 我所經歷的my sql架構變遷﹣周彥偉﹣acmug@2015.12台北
 
Migrating to XtraDB Cluster
Migrating to XtraDB ClusterMigrating to XtraDB Cluster
Migrating to XtraDB Cluster
 
Reducing Risk When Upgrading MySQL
Reducing Risk When Upgrading MySQLReducing Risk When Upgrading MySQL
Reducing Risk When Upgrading MySQL
 
Percon XtraDB Cluster in a nutshell
Percon XtraDB Cluster in a nutshellPercon XtraDB Cluster in a nutshell
Percon XtraDB Cluster in a nutshell
 
Ansible is Our Wishbone(Automate DBA Tasks With Ansible)
Ansible is Our Wishbone(Automate DBA Tasks With Ansible)Ansible is Our Wishbone(Automate DBA Tasks With Ansible)
Ansible is Our Wishbone(Automate DBA Tasks With Ansible)
 
Introduction to MariaDB MaxScale
Introduction to MariaDB MaxScaleIntroduction to MariaDB MaxScale
Introduction to MariaDB MaxScale
 
JahiaOne - Performance Tuning
JahiaOne - Performance TuningJahiaOne - Performance Tuning
JahiaOne - Performance Tuning
 
Webinar Slides : Migrating to MySQL, MariaDB Galera and/or Percona XtraDB Clu...
Webinar Slides : Migrating to MySQL, MariaDB Galera and/or Percona XtraDB Clu...Webinar Slides : Migrating to MySQL, MariaDB Galera and/or Percona XtraDB Clu...
Webinar Slides : Migrating to MySQL, MariaDB Galera and/or Percona XtraDB Clu...
 

Viewers also liked

MySQL clients
MySQL clientsMySQL clients
MySQL clientsyoku0825
 
Rubyでアプリ開発(2013 0430)
Rubyでアプリ開発(2013 0430)Rubyでアプリ開発(2013 0430)
Rubyでアプリ開発(2013 0430)Shinichirou Nakamura
 
MariaDB+GaleraClusterの運用事例(MySQL勉強会2016-01-28)
MariaDB+GaleraClusterの運用事例(MySQL勉強会2016-01-28)MariaDB+GaleraClusterの運用事例(MySQL勉強会2016-01-28)
MariaDB+GaleraClusterの運用事例(MySQL勉強会2016-01-28)Yuji Otani
 
Galera Cluster for MySQL vs MySQL (NDB) Cluster: A High Level Comparison
Galera Cluster for MySQL vs MySQL (NDB) Cluster: A High Level Comparison Galera Cluster for MySQL vs MySQL (NDB) Cluster: A High Level Comparison
Galera Cluster for MySQL vs MySQL (NDB) Cluster: A High Level Comparison Severalnines
 
MHA for MySQLとDeNAのオープンソースの話
MHA for MySQLとDeNAのオープンソースの話MHA for MySQLとDeNAのオープンソースの話
MHA for MySQLとDeNAのオープンソースの話Yoshinori Matsunobu
 

Viewers also liked (6)

MySQL clients
MySQL clientsMySQL clients
MySQL clients
 
Rubyでアプリ開発(2013 0430)
Rubyでアプリ開発(2013 0430)Rubyでアプリ開発(2013 0430)
Rubyでアプリ開発(2013 0430)
 
MariaDB+GaleraClusterの運用事例(MySQL勉強会2016-01-28)
MariaDB+GaleraClusterの運用事例(MySQL勉強会2016-01-28)MariaDB+GaleraClusterの運用事例(MySQL勉強会2016-01-28)
MariaDB+GaleraClusterの運用事例(MySQL勉強会2016-01-28)
 
Galera Cluster for MySQL vs MySQL (NDB) Cluster: A High Level Comparison
Galera Cluster for MySQL vs MySQL (NDB) Cluster: A High Level Comparison Galera Cluster for MySQL vs MySQL (NDB) Cluster: A High Level Comparison
Galera Cluster for MySQL vs MySQL (NDB) Cluster: A High Level Comparison
 
MyNAができるまで
MyNAができるまでMyNAができるまで
MyNAができるまで
 
MHA for MySQLとDeNAのオープンソースの話
MHA for MySQLとDeNAのオープンソースの話MHA for MySQLとDeNAのオープンソースの話
MHA for MySQLとDeNAのオープンソースの話
 

Similar to Introduction to XtraDB Cluster

Drupal Con My Sql Ha 2008 08 29
Drupal Con My Sql Ha 2008 08 29Drupal Con My Sql Ha 2008 08 29
Drupal Con My Sql Ha 2008 08 29liufabin 66688
 
Migrating and living on rds aurora
Migrating and living on rds auroraMigrating and living on rds aurora
Migrating and living on rds auroraBalazs Pocze
 
Cassandra for Sysadmins
Cassandra for SysadminsCassandra for Sysadmins
Cassandra for SysadminsNathan Milford
 
RDS for MySQL, No BS Operations and Patterns
RDS for MySQL, No BS Operations and PatternsRDS for MySQL, No BS Operations and Patterns
RDS for MySQL, No BS Operations and PatternsLaine Campbell
 
On The Building Of A PostgreSQL Cluster
On The Building Of A PostgreSQL ClusterOn The Building Of A PostgreSQL Cluster
On The Building Of A PostgreSQL ClusterSrihari Sriraman
 
ABRIDGED VERSION - Joys & frustrations of putting 34,000 lines of Haskell in...
 ABRIDGED VERSION - Joys & frustrations of putting 34,000 lines of Haskell in... ABRIDGED VERSION - Joys & frustrations of putting 34,000 lines of Haskell in...
ABRIDGED VERSION - Joys & frustrations of putting 34,000 lines of Haskell in...Saurabh Nanda
 
MySQL 5.7 clustering: The developer perspective
MySQL 5.7 clustering: The developer perspectiveMySQL 5.7 clustering: The developer perspective
MySQL 5.7 clustering: The developer perspectiveUlf Wendel
 
Building Asynchronous Applications
Building Asynchronous ApplicationsBuilding Asynchronous Applications
Building Asynchronous ApplicationsJohan Edstrom
 
Riak add presentation
Riak add presentationRiak add presentation
Riak add presentationIlya Bogunov
 
Sparklife - Life In The Trenches With Spark
Sparklife - Life In The Trenches With SparkSparklife - Life In The Trenches With Spark
Sparklife - Life In The Trenches With SparkIan Pointer
 
MySQL 5.7 Fabric: Introduction to High Availability and Sharding
MySQL 5.7 Fabric: Introduction to High Availability and Sharding MySQL 5.7 Fabric: Introduction to High Availability and Sharding
MySQL 5.7 Fabric: Introduction to High Availability and Sharding Ulf Wendel
 
Amazon Aurora Let's Talk About Performance
Amazon Aurora Let's Talk About PerformanceAmazon Aurora Let's Talk About Performance
Amazon Aurora Let's Talk About PerformanceDanilo Poccia
 
10 Devops-Friendly Database Must-Haves - Dor Laor, ScyllaDB - DevOpsDays Tel ...
10 Devops-Friendly Database Must-Haves - Dor Laor, ScyllaDB - DevOpsDays Tel ...10 Devops-Friendly Database Must-Haves - Dor Laor, ScyllaDB - DevOpsDays Tel ...
10 Devops-Friendly Database Must-Haves - Dor Laor, ScyllaDB - DevOpsDays Tel ...DevOpsDays Tel Aviv
 
High-Performance Storage Services with HailDB and Java
High-Performance Storage Services with HailDB and JavaHigh-Performance Storage Services with HailDB and Java
High-Performance Storage Services with HailDB and Javasunnygleason
 
What's new in Jewel and Beyond
What's new in Jewel and BeyondWhat's new in Jewel and Beyond
What's new in Jewel and BeyondSage Weil
 

Similar to Introduction to XtraDB Cluster (20)

Drupal Con My Sql Ha 2008 08 29
Drupal Con My Sql Ha 2008 08 29Drupal Con My Sql Ha 2008 08 29
Drupal Con My Sql Ha 2008 08 29
 
Migrating and living on rds aurora
Migrating and living on rds auroraMigrating and living on rds aurora
Migrating and living on rds aurora
 
Cassandra for Sysadmins
Cassandra for SysadminsCassandra for Sysadmins
Cassandra for Sysadmins
 
RDS for MySQL, No BS Operations and Patterns
RDS for MySQL, No BS Operations and PatternsRDS for MySQL, No BS Operations and Patterns
RDS for MySQL, No BS Operations and Patterns
 
On The Building Of A PostgreSQL Cluster
On The Building Of A PostgreSQL ClusterOn The Building Of A PostgreSQL Cluster
On The Building Of A PostgreSQL Cluster
 
ABRIDGED VERSION - Joys & frustrations of putting 34,000 lines of Haskell in...
 ABRIDGED VERSION - Joys & frustrations of putting 34,000 lines of Haskell in... ABRIDGED VERSION - Joys & frustrations of putting 34,000 lines of Haskell in...
ABRIDGED VERSION - Joys & frustrations of putting 34,000 lines of Haskell in...
 
Introduction to Galera Cluster
Introduction to Galera ClusterIntroduction to Galera Cluster
Introduction to Galera Cluster
 
MySQL 5.7 clustering: The developer perspective
MySQL 5.7 clustering: The developer perspectiveMySQL 5.7 clustering: The developer perspective
MySQL 5.7 clustering: The developer perspective
 
Building Asynchronous Applications
Building Asynchronous ApplicationsBuilding Asynchronous Applications
Building Asynchronous Applications
 
Riak add presentation
Riak add presentationRiak add presentation
Riak add presentation
 
Sparklife - Life In The Trenches With Spark
Sparklife - Life In The Trenches With SparkSparklife - Life In The Trenches With Spark
Sparklife - Life In The Trenches With Spark
 
The Smug Mug Tale
The Smug Mug TaleThe Smug Mug Tale
The Smug Mug Tale
 
MySQL 5.7 Fabric: Introduction to High Availability and Sharding
MySQL 5.7 Fabric: Introduction to High Availability and Sharding MySQL 5.7 Fabric: Introduction to High Availability and Sharding
MySQL 5.7 Fabric: Introduction to High Availability and Sharding
 
Mysql talk
Mysql talkMysql talk
Mysql talk
 
Amazon Aurora Let's Talk About Performance
Amazon Aurora Let's Talk About PerformanceAmazon Aurora Let's Talk About Performance
Amazon Aurora Let's Talk About Performance
 
Corley scalability
Corley scalabilityCorley scalability
Corley scalability
 
10 Devops-Friendly Database Must-Haves - Dor Laor, ScyllaDB - DevOpsDays Tel ...
10 Devops-Friendly Database Must-Haves - Dor Laor, ScyllaDB - DevOpsDays Tel ...10 Devops-Friendly Database Must-Haves - Dor Laor, ScyllaDB - DevOpsDays Tel ...
10 Devops-Friendly Database Must-Haves - Dor Laor, ScyllaDB - DevOpsDays Tel ...
 
High-Performance Storage Services with HailDB and Java
High-Performance Storage Services with HailDB and JavaHigh-Performance Storage Services with HailDB and Java
High-Performance Storage Services with HailDB and Java
 
What's new in Jewel and Beyond
What's new in Jewel and BeyondWhat's new in Jewel and Beyond
What's new in Jewel and Beyond
 
MySQL highav Availability
MySQL highav AvailabilityMySQL highav Availability
MySQL highav Availability
 

More from yoku0825

逝くぞ最新版、罠の貯蔵は十分か
逝くぞ最新版、罠の貯蔵は十分か逝くぞ最新版、罠の貯蔵は十分か
逝くぞ最新版、罠の貯蔵は十分かyoku0825
 
サーバーが完膚なきまでに死んでもMySQLのデータを失わないための表技
サーバーが完膚なきまでに死んでもMySQLのデータを失わないための表技サーバーが完膚なきまでに死んでもMySQLのデータを失わないための表技
サーバーが完膚なきまでに死んでもMySQLのデータを失わないための表技yoku0825
 
MySQLレプリケーションあれやこれや
MySQLレプリケーションあれやこれやMySQLレプリケーションあれやこれや
MySQLレプリケーションあれやこれやyoku0825
 
MySQL 8.0で憶えておいてほしいこと
MySQL 8.0で憶えておいてほしいことMySQL 8.0で憶えておいてほしいこと
MySQL 8.0で憶えておいてほしいことyoku0825
 
片手間MySQLチューニング戦略
片手間MySQLチューニング戦略片手間MySQLチューニング戦略
片手間MySQLチューニング戦略yoku0825
 
MySQLを割と一人で300台管理する技術
MySQLを割と一人で300台管理する技術MySQLを割と一人で300台管理する技術
MySQLを割と一人で300台管理する技術yoku0825
 
MySQLステータスモニタリング
MySQLステータスモニタリングMySQLステータスモニタリング
MySQLステータスモニタリングyoku0825
 
わかった気になるMySQL
わかった気になるMySQLわかった気になるMySQL
わかった気になるMySQLyoku0825
 
わたしを支える技術
わたしを支える技術わたしを支える技術
わたしを支える技術yoku0825
 
MySQL 5.7の次のMySQL 8.0はどんなものになるだろう
MySQL 5.7の次のMySQL 8.0はどんなものになるだろうMySQL 5.7の次のMySQL 8.0はどんなものになるだろう
MySQL 5.7の次のMySQL 8.0はどんなものになるだろうyoku0825
 
Dockerイメージで誰でも気軽にMroonga体験
Dockerイメージで誰でも気軽にMroonga体験Dockerイメージで誰でも気軽にMroonga体験
Dockerイメージで誰でも気軽にMroonga体験yoku0825
 
MySQLアンチパターン
MySQLアンチパターンMySQLアンチパターン
MySQLアンチパターンyoku0825
 
MySQLerの7つ道具 plus
MySQLerの7つ道具 plusMySQLerの7つ道具 plus
MySQLerの7つ道具 plusyoku0825
 
MySQL 5.7の次のMySQLは
MySQL 5.7の次のMySQLはMySQL 5.7の次のMySQLは
MySQL 5.7の次のMySQLはyoku0825
 
MySQLerの7つ道具
MySQLerの7つ道具MySQLerの7つ道具
MySQLerの7つ道具yoku0825
 
MHAの次を目指す mikasafabric for MySQL
MHAの次を目指す mikasafabric for MySQLMHAの次を目指す mikasafabric for MySQL
MHAの次を目指す mikasafabric for MySQLyoku0825
 
5.7の次のMySQL
5.7の次のMySQL5.7の次のMySQL
5.7の次のMySQLyoku0825
 
mikasafabric for MySQL
mikasafabric for MySQLmikasafabric for MySQL
mikasafabric for MySQLyoku0825
 
とあるイルカの近況報告
とあるイルカの近況報告とあるイルカの近況報告
とあるイルカの近況報告yoku0825
 
MySQL Fabricでぼっこぼこにされたはなし
MySQL FabricでぼっこぼこにされたはなしMySQL Fabricでぼっこぼこにされたはなし
MySQL Fabricでぼっこぼこにされたはなしyoku0825
 

More from yoku0825 (20)

逝くぞ最新版、罠の貯蔵は十分か
逝くぞ最新版、罠の貯蔵は十分か逝くぞ最新版、罠の貯蔵は十分か
逝くぞ最新版、罠の貯蔵は十分か
 
サーバーが完膚なきまでに死んでもMySQLのデータを失わないための表技
サーバーが完膚なきまでに死んでもMySQLのデータを失わないための表技サーバーが完膚なきまでに死んでもMySQLのデータを失わないための表技
サーバーが完膚なきまでに死んでもMySQLのデータを失わないための表技
 
MySQLレプリケーションあれやこれや
MySQLレプリケーションあれやこれやMySQLレプリケーションあれやこれや
MySQLレプリケーションあれやこれや
 
MySQL 8.0で憶えておいてほしいこと
MySQL 8.0で憶えておいてほしいことMySQL 8.0で憶えておいてほしいこと
MySQL 8.0で憶えておいてほしいこと
 
片手間MySQLチューニング戦略
片手間MySQLチューニング戦略片手間MySQLチューニング戦略
片手間MySQLチューニング戦略
 
MySQLを割と一人で300台管理する技術
MySQLを割と一人で300台管理する技術MySQLを割と一人で300台管理する技術
MySQLを割と一人で300台管理する技術
 
MySQLステータスモニタリング
MySQLステータスモニタリングMySQLステータスモニタリング
MySQLステータスモニタリング
 
わかった気になるMySQL
わかった気になるMySQLわかった気になるMySQL
わかった気になるMySQL
 
わたしを支える技術
わたしを支える技術わたしを支える技術
わたしを支える技術
 
MySQL 5.7の次のMySQL 8.0はどんなものになるだろう
MySQL 5.7の次のMySQL 8.0はどんなものになるだろうMySQL 5.7の次のMySQL 8.0はどんなものになるだろう
MySQL 5.7の次のMySQL 8.0はどんなものになるだろう
 
Dockerイメージで誰でも気軽にMroonga体験
Dockerイメージで誰でも気軽にMroonga体験Dockerイメージで誰でも気軽にMroonga体験
Dockerイメージで誰でも気軽にMroonga体験
 
MySQLアンチパターン
MySQLアンチパターンMySQLアンチパターン
MySQLアンチパターン
 
MySQLerの7つ道具 plus
MySQLerの7つ道具 plusMySQLerの7つ道具 plus
MySQLerの7つ道具 plus
 
MySQL 5.7の次のMySQLは
MySQL 5.7の次のMySQLはMySQL 5.7の次のMySQLは
MySQL 5.7の次のMySQLは
 
MySQLerの7つ道具
MySQLerの7つ道具MySQLerの7つ道具
MySQLerの7つ道具
 
MHAの次を目指す mikasafabric for MySQL
MHAの次を目指す mikasafabric for MySQLMHAの次を目指す mikasafabric for MySQL
MHAの次を目指す mikasafabric for MySQL
 
5.7の次のMySQL
5.7の次のMySQL5.7の次のMySQL
5.7の次のMySQL
 
mikasafabric for MySQL
mikasafabric for MySQLmikasafabric for MySQL
mikasafabric for MySQL
 
とあるイルカの近況報告
とあるイルカの近況報告とあるイルカの近況報告
とあるイルカの近況報告
 
MySQL Fabricでぼっこぼこにされたはなし
MySQL FabricでぼっこぼこにされたはなしMySQL Fabricでぼっこぼこにされたはなし
MySQL Fabricでぼっこぼこにされたはなし
 

Introduction to XtraDB Cluster

  • 1. XtraDB Cluster Chiba.pm #2 at 2013/03/23 yoku0825
  • 2. \こんにちは!/ • I’m yoku0825, working as DBA for the company’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!!
  • 3. Today, I talk about Percona XtraDB Cluster
  • 4. Today, I talk about Percona XtraDB Cluster ぺるこな えくすとらでぃーびーくらすたー
  • 5. 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/
  • 6. XtraDB Cluster is implementation of Galera Replication by Percona LLC. What’s Galera Replication? ATO-DE-MATA-DETEKIMASU.
  • 7. 取り敢えず響きが良いですよ ね エクストラディービークラスター
  • 10. orz
  • 11. くらい、響きが良いですよ ね :D XtraDBだけだと ストレージエンジンの 名前なんですけどね
  • 12. 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) MySQL Replication topology. And wsrep takes a automated Full-physical and Increment-logical data synchronization.
  • 13. wsrep • wsrep is the concept for realize following notes(following next page) – wsrep implementation by cordership named Galera Replication, it takes the form of patch for MySQL(there is implementation for PostgreSQL, but I don’t know about that). And MySQL compiled with Galera Replication patch is destributed by cordership, named Galera Cluster for MySQL. • http://www.codership.com/content/using-galera-cluster – Percona-Server compiled with Galera Replication patch is named Percona XtraDB Cluster. • http://www.percona.com/software/percona-xtradb-cluster – MariaDB compiled with Galera Replication patch is named MariaDB Galera Cluster. • https://kb.askmonty.org/en/what-is-mariadb-galera-cluster/
  • 14. Multi Master • All nodes are writable – Of cource, standard MySQL Replication is so. – But you write into table on Replication Slave, its updates(INSERT, UPDATE, DELETE, and so) are not replicated to any node without its own Slave Server. This means it breaks consistency, so we can’t allow to write Replication Slave by read_only option variable. – wsrep library certs consistency when you write into table on any node by using (Virtual) Synchronous Replication.
  • 15. (Virtual) Synchronous • All nodes have same data (DAI-TAI) anytime – When you write some data into some node, wsrep library hooks InnoDB API and writes wsrep’s binary log(Galera Cache) in row-based binary log, before it answers commit request. – Galera Cache is pushed through Communication-Path and confirmed “Can it execute with integrity, without conflict of update?” on all other nodes. – When wsrep gets that confirmation(Certification) on all other nodes, its update is committed at last. Otherwise, when wsrep received Certification Failure, its transaction will rollback(=return Error: 1213 “Deadlock found when trying to get lock.”) and any node doesn’t update to keep consistency.
  • 16. (Virtual) Synchronous • Why it called “Virtual” Synchronous? – It has a little rag between Certification and Real- Write into Disk. – The server which is received to write request at first writes its data into disk and notifies “its data is committed”. All other servers can write into disk after that notification(because of keeping it transaction can rollback)
  • 17. 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 Certification can work in multi thread. – Statement-Based Replication can’t detect even if replication has lost data consistency. Do you face Error:1032 “Can’t find record in `tablename`”? • Not only Galera Cache, but also “binary log” for using standard replication. – It inherits some weakpoint of standard RBR. • MySQL 5.6 improves Multi Thread SQL_Thread but it works only separated Database-Level.
  • 18. State Snapshot Transfer(SST) • It is full data copy from joined cluster node to joining cluster node, automated by wsrep library. – You can choise “rsync”(physical copy, need lock), “mysqldump”(logical copy, need lock too), “custom script”. – XtraDB Cluster can use xtrabackup(physical copy, without lock) as “custom script”. It makes adding new node and coming back downed node are lock-free and almost automation. • If wsrep detects “impossible(=can’t certificate) update” why data is mismatch just then wsrep execute SST and keeps consistency over the cluster.
  • 19. Incremental State Transfer(IST) • It is incremental data copy from joined cluster node to joining cluster node, automated by wsrep library. – When cluster node leave and come back shortly, wsrep doesn’t need SST if they have enough Galera Cache covered all over its downtime. – IST doesn’t need any locks and need any reads physical data file, because of IST uses only Galera Cache. And Galera Cache is maybe hot cache ‘coz it is “nearest updates for cluster”, IST is very faster than SST.
  • 20. Flat Topology + Automated SST = • You don’t be annoyed at all, when – “OMG! Master is down! Get to switchover now!” • There’s nothing to do you’ve already prepared your LVS configure. – “OMG! There is some different data between Master and Slave!” • wsrep have already fixed it before you know that, you can see 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, you can keep you don’t know that.
  • 21. Combination with Standard Replication • wsrep hooks only InnoDB write method, it means wsrep 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 update through Galera Cache and inside out, you have to put log-slave-updates in your my.cnf. – And you have to know, wsrep doesn’t support(correctly, “does ignore”) except of updates into InnoDB.
  • 22. How is it? Do you feel something WAK-WAK?
  • 23. 勿論弱点も(いっぱい)ありま す I/Oに負荷が偏るとか wsrepの部分の日本語情報少ないとか xtrabackupと連携させるのにinnobackupexいじるとか xtrabackup使わないとSSTでリードロックかかるし RBR前提なのでバイナリログでっかいとかPrimary Keyが無いと悲惨とか 更新がかかったノードにしかバイナリログ無いとか InnoDB(XtraDB)以外のデータはそもそも同期されないとか
  • 24. 性能は? tpcc-mysqlで叩いた感じ、Semi-Sync(M/S)の3割引くらいでした ネットワーク帯域とかバイナリログの保管場所にも注意 LVS通した分のオーバーヘッドもたぶんある パラレルレプリケーションする為にそれなりのコアが必要 (1行が1スレッド使うから、1万行更新するクエリは…) サーバまたぎの更新がlock waitじゃなくてCertification Failure(=Deadlock扱い)になるの で、 アプリ側でハンドルしてやらないといけない
  • 25. ( ´-`).oO(難易度的には ndbcluster(=MySQL Cluster)と 良い勝負かな) 異論はあると思う
  • 28. 実はこれ、Perlの話じゃないんで す “Percona” =~ /^Per/ But “Percona” != “Perl”
  • 29. Chiba.pm #1 で話していた 書き捨てMySQLモニターツー ル https://github.com/yoku0825/my_collector
  • 34. あれは嘘です 嘘っていうか、 Vimしか使えない消極的Vimmer .vimrcもgtags関連しか入れてない