SlideShare a Scribd company logo
1 of 19
Download to read offline
MySQL synchronous replication in
     practice with Galera

FOSDEM MySQL and Friends Devroom
   February 5, 2012, ULB Brussels

           Oli Sennhauser
       Senior MySQL Consultant, FromDual

      oli.sennhauser@fromdual.com
Content
●   Galera Cluster
●   Why Galera?
●   Characteristics
●   Set-up
●   Configuration
●   Starting / stopping
●   SST
●   Information
Galera Cluster
●   Synchronous Multi-Master Replication

                  App      App        App



                    Load balancing (LB)



                 Node 1   Node 2    Node 3
                  wsrep    wsrep      wsrep
                     Galera replication


●   Scaling reads (and writes)
Galera Cluster
●   If one node fails:

                   App      App        App



                     Load balancing (LB)



                  Node 1   Node 2    Node 3
                   wsrep    wsrep      wsrep
                      Galera replication


●   High Availability (HA)
Why Galera?
●   Master-Slave Replication
    ●   Not multi-Master, asynchronous, inconsistencies
●   Master-Master Replication
    ●   Some kind of multi-Master, asynchronous, inconsistencies,
        conflicts
●   MHA, MMM (v1, v2), Tungsten
    ●   Bases on MySQL Replication
●   MySQL Cluster
    ●   Not like InnoDB, Know-How, Network-DB!
●   Active/passive Failover Cluster
    ●   Operations, resources idling
●   Schooner
    ●   Expensive, not sure what technology (Memcached, Replication, ...)
Characteristics
 Synchronous replication
 Based on InnoDB SE (other SE theoretically possible)
 Active-active real multi-master topology
 Read and write to any cluster node
 Automatic membership control
 True parallel replication, on row level
 No slave lag
 No lost transactions
 Read AND write scalability (Read Scale-Out!)
 Patch off MySQL binaries (Codership provides binaries)
 Be aware of Hot Spots on rows
 Higher probability of dead locks
 Full sync blocks for writing → 3 nodes
 Initial sync for very big databases (>>50 Gbyte) with mysqldump → rsync,
 xtrabackup
Set-up
●   3 nodes is recommended
    ●   Or 2 + 1 (2 mysqld + garbd) → SST!!!
    ●   2 nodes → split brain!
●   Codership MySQL + Galera Plug-in (wsrep)
●   User for SST is root!
    ●   We recommend to use your own user.
    ●   On all nodes:
GRANT ALL PRIVILEGES ON *.* TO 'sst'@'%' IDENTIFIED BY 'secret';

GRANT ALL PRIVILEGES ON *.* TO 'sst'@'localhost' IDENTIFIED BY 'secret';
Configuration
●   my.cnf (galera.conf)
default_storage_engine           =   InnoDB
binlog_format                    =   row
innodb_autoinc_lock_mode         =   2
innodb_locks_unsafe_for_binlog   =   1

innodb_flush_log_at_trx_commit = 0
innodb_doublewrite             = 0

query_cache_size                 = 0
query_cache_type                 = 0


# wsrep_provider                   = none
wsrep_provider                   = …/lib/plugin/libgalera_smm.so

# wsrep_cluster_address            = "gcomm://192.168.42.3"
wsrep_cluster_address            = "gcomm://"

wsrep_sst_method                 = mysqldump
wsrep_sst_auth                   = sst:secret
Start nodes
●   First node:
        /etc/init.d/mysql start
●   Other nodes:
        wsrep_cluster_address = "gcomm://192.168.42.1"
        /etc/init.d/mysql start
●   Check with
    ●   MySQL error log (on this AND remote node!)
    ●   SHOW GLOBAL STATUS;
Checks

120131 07:37:17 mysqld_safe Starting mysqld daemon
...
120131 7:37:18 [Note] WSREP: wsrep_load(): loading provider library
                       'libgalera_smm.so'
120131 7:37:18 [Note] WSREP: Start replication
...
120131 7:37:18 [Note] WSREP: Shifting CLOSED -> OPEN (TO: 0)
120131 7:37:18 [Note] .../mysql/bin/mysqld: ready for connections.
...
120131 7:37:23 [Note] WSREP: Quorum results:
        conf_id    = 2,
        members    = 3/3 (joined/total)


SHOW GLOBAL STATUS LIKE 'wsrep%';
+----------------------------+--------------------------------------+
| Variable_name              | Value                                |
+----------------------------+--------------------------------------+
| wsrep_local_state_comment | Synced (6)                            |
| wsrep_cluster_conf_id      | 3                                    |
| wsrep_cluster_size         | 3                                    |
| wsrep_cluster_status       | Primary                              |
| wsrep_connected            | ON                                   |
| wsrep_local_index          | 0                                    |
| wsrep_ready                | ON                                   |
+----------------------------+--------------------------------------+
SST
●    Snapshot State Transfer (SST)
      ●
          Initial full sync between 1st and other nodes
          → mysqldump, rsync, (xtrabackup?, LVM?)
      ●   Blocks the Donor! (→ 3 nodes)
      ●   With v2.0 there is an Incremental State Transfer (IST)
    120131 16:26:42 [Note] WSREP: Quorum results:
            conf_id    = 4,
            members    = 2/3 (joined/total)
    120131 16:26:44 [Note] WSREP: Node 2 (Node 3) requested state transfer from '*any*'.
                                  Selected 0 (Node 1)(SYNCED) as donor.
    120131 16:26:44 [Note] WSREP: Shifting SYNCED -> DONOR/DESYNCED (TO: 2695744)
    120131 16:27:10 [Note] WSREP: 2 (Node 3): State transfer from 0 (Node 1) complete.
    120131 16:27:10 [Note] WSREP: Member 2 (Node 3) synced with group.
    120131 16:27:10 [Note] WSREP: 0 (Node 1): State transfer to 2 (Node 3) complete.
    120131 16:27:10 [Note] WSREP: Shifting DONOR/DESYNCED -> JOINED (TO: 2695744)
    120131 16:27:10 [Note] WSREP: Member 0 (Node 1) synced with group.
    120131 16:27:10 [Note] WSREP: Shifting JOINED -> SYNCED (TO: 2695744)
    120131 16:27:10 [Note] WSREP: Synchronized with group, ready for connections
Restarting a node
●
    2nd and 3rd node → no problem
     st
●
    1 node:

# wsrep_cluster_address = "gcomm://192.168.42.3"

wsrep_cluster_address = "gcomm://



    → This is IMHO non optimal because we
    have 2 different situations:
    ●
        Initial 1st node start
    ●
        1st node restart
Variables
●   Currently (1.1) 27 Variables
SHOW GLOBAL VARIABLES LIKE 'wsrep%';
+--------------------------------+-----------------------------+
| Variable_name                  | Value                       |
+--------------------------------+-----------------------------+
| wsrep_cluster_address          | gcomm://                    |
| wsrep_cluster_name             | Galera-1.0 wsrep-21         |
| wsrep_max_ws_rows              | 131072                      |
| wsrep_max_ws_size              | 1073741824                  |
| wsrep_node_incoming_address    | 192.168.42.1:3306           |
| wsrep_node_name                | Node 1                      |
| wsrep_notify_cmd               |                             |
| wsrep_on                       | ON                          |
| wsrep_provider                 | .../plugin/libgalera_smm.so |
| wsrep_retry_autocommit         | 1                           |
| wsrep_slave_threads            | 1                           |
| wsrep_sst_auth                 | ********                    |
| wsrep_sst_donor                |                             |
| wsrep_sst_method               | mysqldump                   |
| wsrep_sst_receive_address      | AUTO                        |
+--------------------------------+-----------------------------+
wsrep_provider_options
●   evs.debug_log_mask = 0x1;            ●   gcs.fc_factor = 0.5;
●   evs.inactive_check_period = PT0.5S   ●   gcs.fc_limit = 16;
●   evs.inactive_timeout = PT15S;        ●   gcs.fc_master_slave = NO;
●   evs.info_log_mask = 0;               ●   gcs.max_packet_size = 64500;
●   evs.install_timeout = PT15S;         ●   gcs.max_throttle = 0.25;
●   evs.join_retrans_period = PT0.3S;    ●   gcs.recv_q_hard_limit = 9223372036854775807;
●   evs.keepalive_period = PT1S;         ●   gcs.recv_q_soft_limit = 0.25;
●   evs.max_install_timeouts = 1;        ●   gmcast.listen_addr = tcp://127.0.0.1:4567;
●   evs.send_window = 4;                 ●   gmcast.mcast_addr = ;
●   evs.stats_report_period = PT1M;      ●   gmcast.mcast_ttl = 1;
●   evs.suspect_timeout = PT5S;          ●   gmcast.peer_timeout = PT3S;
●   evs.use_aggregate = true;            ●   gmcast.time_wait = PT5S;
●   evs.user_send_window = 2;            ●   gmcast.version = 0;
●   evs.version = 0;                     ●   pc.checksum = true;
●   evs.view_forget_timeout = PT5M;      ●   pc.ignore_quorum = false;
●   gcache.dir = ...;                    ●   pc.ignore_sb = false;
●   gcache.keep_pages_size = 0;          ●   pc.linger = PT2S;
●   gcache.mem_size = 0;                 ●   pc.npvo = false;
●   gcache.name = .../galera.cache;      ●   pc.version = 0;
●   gcache.page_size = 128M;             ●   protonet.backend = asio;
●   gcache.size = 128M;                  ●   protonet.version = 0;
●   gcs.fc_debug = 0;                    ●   replicator.commit_order = 3
Status
●   Currently (1.1) 38 Status information
●   SHOW GLOBAL STATUS LIKE 'wsrep%';
    ●   Cluster status
    ●   Performance metrics
    ●   General information
+----------------------------+--------------------------------------+
| Variable_name              | Value                                |
+----------------------------+--------------------------------------+
| wsrep_last_committed       | 2695744                              |
| wsrep_replicated           | 1                                    |
| wsrep_replicated_bytes     | 576                                  |
| wsrep_received             | 9                                    |
| wsrep_received_bytes       | 1051                                 |
| wsrep_local_commits        | 1                                    |
| wsrep_local_send_queue     | 0                                    |
| wsrep_local_recv_queue     | 0                                    |
| wsrep_flow_control_sent    | 0                                    |
| wsrep_flow_control_recv    | 0                                    |
| wsrep_provider_version     | 22.1.1(r95)                          |
+----------------------------+--------------------------------------+
Load Balancing
●   In your Application (on your own)
●   Connectors
    ●   Connector/J
    ●   PHP: MySQLnd replication and load balancing
        plug-in
●   SW Load Balancer
    ●   GLB, Pen, LVS, HAProxy, MySQL Proxy, SQL
        Relay,
●   HW Load Balancer
Operations
●   2 Modes:
    ●   Master-Master
    ●   Master-Slave
●   Initial configuration (do not mess it up)
●   SST (DB size, NW bandwidth (WAN))
●   Start / restart
●   Deadlocks and hot spots
Galera Replication




●   Graph from Vadim Tkachenko (Percona):
    http://www.mysqlperformanceblog.com/2012/01/19/percona-xtradb-cluster-feature-2-multi-master-replication/
Q&A


                         Questions ?

                         Discussion?

        We have some time for face-to-face talks...

●   FromDual provides neutral and independent:
    ●   Consulting
    ●   Remote-DBA
    ●   Support for MySQL, Galera, Percona Server
    ●   Training                           www.fromdual.com

More Related Content

What's hot

What's hot (20)

MySQL Parallel Replication: inventory, use-cases and limitations
MySQL Parallel Replication: inventory, use-cases and limitationsMySQL Parallel Replication: inventory, use-cases and limitations
MySQL Parallel Replication: inventory, use-cases and limitations
 
MySQL Parallel Replication (LOGICAL_CLOCK): all the 5.7 (and some of the 8.0)...
MySQL Parallel Replication (LOGICAL_CLOCK): all the 5.7 (and some of the 8.0)...MySQL Parallel Replication (LOGICAL_CLOCK): all the 5.7 (and some of the 8.0)...
MySQL Parallel Replication (LOGICAL_CLOCK): all the 5.7 (and some of the 8.0)...
 
MySQL Parallel Replication by Booking.com
MySQL Parallel Replication by Booking.comMySQL Parallel Replication by Booking.com
MySQL Parallel Replication by Booking.com
 
MySQL/MariaDB Parallel Replication: inventory, use-case and limitations
MySQL/MariaDB Parallel Replication: inventory, use-case and limitationsMySQL/MariaDB Parallel Replication: inventory, use-case and limitations
MySQL/MariaDB Parallel Replication: inventory, use-case and limitations
 
MySQL Indexierung CeBIT 2014
MySQL Indexierung CeBIT 2014MySQL Indexierung CeBIT 2014
MySQL Indexierung CeBIT 2014
 
MySQL Replication Troubleshooting for Oracle DBAs
MySQL Replication Troubleshooting for Oracle DBAsMySQL Replication Troubleshooting for Oracle DBAs
MySQL Replication Troubleshooting for Oracle DBAs
 
MySQLドライバの改良と軽量O/Rマッパーの紹介
MySQLドライバの改良と軽量O/Rマッパーの紹介MySQLドライバの改良と軽量O/Rマッパーの紹介
MySQLドライバの改良と軽量O/Rマッパーの紹介
 
MariaDB Server on macOS - FOSDEM 2022 MariaDB Devroom
MariaDB Server on macOS -  FOSDEM 2022 MariaDB DevroomMariaDB Server on macOS -  FOSDEM 2022 MariaDB Devroom
MariaDB Server on macOS - FOSDEM 2022 MariaDB Devroom
 
The New MariaDB Offering - MariaDB 10, MaxScale and more
The New MariaDB Offering - MariaDB 10, MaxScale and moreThe New MariaDB Offering - MariaDB 10, MaxScale and more
The New MariaDB Offering - MariaDB 10, MaxScale and more
 
Consistency between Engine and Binlog under Reduced Durability
Consistency between Engine and Binlog under Reduced DurabilityConsistency between Engine and Binlog under Reduced Durability
Consistency between Engine and Binlog under Reduced Durability
 
Almost Perfect Service Discovery and Failover with ProxySQL and Orchestrator
Almost Perfect Service Discovery and Failover with ProxySQL and OrchestratorAlmost Perfect Service Discovery and Failover with ProxySQL and Orchestrator
Almost Perfect Service Discovery and Failover with ProxySQL and Orchestrator
 
How Booking.com avoids and deals with replication lag
How Booking.com avoids and deals with replication lagHow Booking.com avoids and deals with replication lag
How Booking.com avoids and deals with replication lag
 
Lessons Learned: Troubleshooting Replication
Lessons Learned: Troubleshooting ReplicationLessons Learned: Troubleshooting Replication
Lessons Learned: Troubleshooting Replication
 
Automated master failover
Automated master failoverAutomated master failover
Automated master failover
 
M|18 Under the Hood: Galera Cluster
M|18 Under the Hood: Galera ClusterM|18 Under the Hood: Galera Cluster
M|18 Under the Hood: Galera Cluster
 
More on bpftrace for MariaDB DBAs and Developers - FOSDEM 2022 MariaDB Devroom
More on bpftrace for MariaDB DBAs and Developers - FOSDEM 2022 MariaDB DevroomMore on bpftrace for MariaDB DBAs and Developers - FOSDEM 2022 MariaDB Devroom
More on bpftrace for MariaDB DBAs and Developers - FOSDEM 2022 MariaDB Devroom
 
Gdb basics for my sql db as (percona live europe 2019)
Gdb basics for my sql db as (percona live europe 2019)Gdb basics for my sql db as (percona live europe 2019)
Gdb basics for my sql db as (percona live europe 2019)
 
The consequences of sync_binlog != 1
The consequences of sync_binlog != 1The consequences of sync_binlog != 1
The consequences of sync_binlog != 1
 
Demystifying MySQL Replication Crash Safety
Demystifying MySQL Replication Crash SafetyDemystifying MySQL Replication Crash Safety
Demystifying MySQL Replication Crash Safety
 
Nine Circles of Inferno or Explaining the PostgreSQL Vacuum
Nine Circles of Inferno or Explaining the PostgreSQL VacuumNine Circles of Inferno or Explaining the PostgreSQL Vacuum
Nine Circles of Inferno or Explaining the PostgreSQL Vacuum
 

Viewers also liked (6)

MySQL Backup
MySQL BackupMySQL Backup
MySQL Backup
 
Internet Briefing 2011: NoSQL with MySQL
Internet Briefing 2011: NoSQL with MySQLInternet Briefing 2011: NoSQL with MySQL
Internet Briefing 2011: NoSQL with MySQL
 
DOAG 2011: MySQL Replication
DOAG 2011: MySQL ReplicationDOAG 2011: MySQL Replication
DOAG 2011: MySQL Replication
 
FROSCON 2011: MySQL Performance Tuning
FROSCON 2011: MySQL Performance TuningFROSCON 2011: MySQL Performance Tuning
FROSCON 2011: MySQL Performance Tuning
 
FROSCON 2011: MySQL Replication
FROSCON 2011: MySQL ReplicationFROSCON 2011: MySQL Replication
FROSCON 2011: MySQL Replication
 
Indexierung mit MySQL
Indexierung mit MySQLIndexierung mit MySQL
Indexierung mit MySQL
 

Similar to FOSDEM 2012: MySQL synchronous replication in practice with Galera

Highload Perf Tuning
Highload Perf TuningHighload Perf Tuning
Highload Perf Tuning
HighLoad2009
 
pg_proctab: Accessing System Stats in PostgreSQL
pg_proctab: Accessing System Stats in PostgreSQLpg_proctab: Accessing System Stats in PostgreSQL
pg_proctab: Accessing System Stats in PostgreSQL
Command Prompt., Inc
 

Similar to FOSDEM 2012: MySQL synchronous replication in practice with Galera (20)

Tek tutorial
Tek tutorialTek tutorial
Tek tutorial
 
DPC Tutorial
DPC TutorialDPC Tutorial
DPC Tutorial
 
MySQL Galera 集群
MySQL Galera 集群MySQL Galera 集群
MySQL Galera 集群
 
New features in Performance Schema 5.7 in action
New features in Performance Schema 5.7 in actionNew features in Performance Schema 5.7 in action
New features in Performance Schema 5.7 in action
 
Galera Cluster Best Practices for DBA's and DevOps Part 1
Galera Cluster Best Practices for DBA's and DevOps Part 1Galera Cluster Best Practices for DBA's and DevOps Part 1
Galera Cluster Best Practices for DBA's and DevOps Part 1
 
Galera explained 3
Galera explained 3Galera explained 3
Galera explained 3
 
Perf Tuning Short
Perf Tuning ShortPerf Tuning Short
Perf Tuning Short
 
Migrating to XtraDB Cluster
Migrating to XtraDB ClusterMigrating to XtraDB Cluster
Migrating to XtraDB Cluster
 
ProxySQL in the Cloud
ProxySQL in the CloudProxySQL in the Cloud
ProxySQL in the Cloud
 
Percona Live UK 2014 Part III
Percona Live UK 2014  Part IIIPercona Live UK 2014  Part III
Percona Live UK 2014 Part III
 
Advanced percona xtra db cluster in a nutshell... la suite plsc2016
Advanced percona xtra db cluster in a nutshell... la suite plsc2016Advanced percona xtra db cluster in a nutshell... la suite plsc2016
Advanced percona xtra db cluster in a nutshell... la suite plsc2016
 
Nagios Conference 2014 - Troy Lea - Monitoring VMware Virtualization Using vMA
Nagios Conference 2014 - Troy Lea - Monitoring VMware Virtualization Using vMANagios Conference 2014 - Troy Lea - Monitoring VMware Virtualization Using vMA
Nagios Conference 2014 - Troy Lea - Monitoring VMware Virtualization Using vMA
 
Highload Perf Tuning
Highload Perf TuningHighload Perf Tuning
Highload Perf Tuning
 
pg_proctab: Accessing System Stats in PostgreSQL
pg_proctab: Accessing System Stats in PostgreSQLpg_proctab: Accessing System Stats in PostgreSQL
pg_proctab: Accessing System Stats in PostgreSQL
 
pg_proctab: Accessing System Stats in PostgreSQL
pg_proctab: Accessing System Stats in PostgreSQLpg_proctab: Accessing System Stats in PostgreSQL
pg_proctab: Accessing System Stats in PostgreSQL
 
Percona XtraDB 集群安装与配置
Percona XtraDB 集群安装与配置Percona XtraDB 集群安装与配置
Percona XtraDB 集群安装与配置
 
MySQLinsanity
MySQLinsanityMySQLinsanity
MySQLinsanity
 
MariaDB Auto-Clustering, Vertical and Horizontal Scaling within Jelastic PaaS
MariaDB Auto-Clustering, Vertical and Horizontal Scaling within Jelastic PaaSMariaDB Auto-Clustering, Vertical and Horizontal Scaling within Jelastic PaaS
MariaDB Auto-Clustering, Vertical and Horizontal Scaling within Jelastic PaaS
 
Linux Systems Performance 2016
Linux Systems Performance 2016Linux Systems Performance 2016
Linux Systems Performance 2016
 
Advanced Percona XtraDB Cluster in a nutshell... la suite
Advanced Percona XtraDB Cluster in a nutshell... la suiteAdvanced Percona XtraDB Cluster in a nutshell... la suite
Advanced Percona XtraDB Cluster in a nutshell... la suite
 

More from FromDual GmbH

More from FromDual GmbH (20)

MariaDB/MySQL pitfalls - And how to come out again...
MariaDB/MySQL pitfalls - And how to come out again...MariaDB/MySQL pitfalls - And how to come out again...
MariaDB/MySQL pitfalls - And how to come out again...
 
MariaDB / MySQL tripping hazard and how to get out again?
MariaDB / MySQL tripping hazard and how to get out again?MariaDB / MySQL tripping hazard and how to get out again?
MariaDB / MySQL tripping hazard and how to get out again?
 
PXC 5.5 to MariaDB 10.4 Galera Cluster Migration Workshop
PXC 5.5 to MariaDB 10.4 Galera Cluster Migration WorkshopPXC 5.5 to MariaDB 10.4 Galera Cluster Migration Workshop
PXC 5.5 to MariaDB 10.4 Galera Cluster Migration Workshop
 
IT Tage 2019 MariaDB 10.4 New Features
IT Tage 2019 MariaDB 10.4 New FeaturesIT Tage 2019 MariaDB 10.4 New Features
IT Tage 2019 MariaDB 10.4 New Features
 
MariaDB 10.4 New Features
MariaDB 10.4 New FeaturesMariaDB 10.4 New Features
MariaDB 10.4 New Features
 
MariaDB 10.2 New Features
MariaDB 10.2 New FeaturesMariaDB 10.2 New Features
MariaDB 10.2 New Features
 
MySQL für Oracle DBA's
MySQL für Oracle DBA'sMySQL für Oracle DBA's
MySQL für Oracle DBA's
 
MySQL Backup/Recovery
MySQL Backup/RecoveryMySQL Backup/Recovery
MySQL Backup/Recovery
 
MySQL Beispiele aus der Praxis - Wie setzen Kunden MySQL ein?
MySQL Beispiele aus der Praxis - Wie setzen Kunden MySQL ein?MySQL Beispiele aus der Praxis - Wie setzen Kunden MySQL ein?
MySQL Beispiele aus der Praxis - Wie setzen Kunden MySQL ein?
 
MySQL-Server im Teamwork - Replikation und Cluster
MySQL-Server im Teamwork - Replikation und ClusterMySQL-Server im Teamwork - Replikation und Cluster
MySQL-Server im Teamwork - Replikation und Cluster
 
Der Datenbank-Backup ist gemacht - was nun?
Der Datenbank-Backup ist gemacht - was nun?Der Datenbank-Backup ist gemacht - was nun?
Der Datenbank-Backup ist gemacht - was nun?
 
Weltweite Produktionsdatenverwaltung mit MySQL-Replikation
Weltweite Produktionsdatenverwaltung mit MySQL-ReplikationWeltweite Produktionsdatenverwaltung mit MySQL-Replikation
Weltweite Produktionsdatenverwaltung mit MySQL-Replikation
 
MySQL Performance Tuning für Oracle-DBA's
MySQL Performance Tuning für Oracle-DBA'sMySQL Performance Tuning für Oracle-DBA's
MySQL Performance Tuning für Oracle-DBA's
 
MySQL Security SLAC 2015
MySQL Security SLAC 2015MySQL Security SLAC 2015
MySQL Security SLAC 2015
 
MySQL Performance Tuning für Entwickler
MySQL Performance Tuning für EntwicklerMySQL Performance Tuning für Entwickler
MySQL Performance Tuning für Entwickler
 
MySQL Replikation - Die Eier legende Wollmilchsau?
MySQL Replikation - Die Eier legende Wollmilchsau?MySQL Replikation - Die Eier legende Wollmilchsau?
MySQL Replikation - Die Eier legende Wollmilchsau?
 
Reading MySQL fingerprints
Reading MySQL fingerprintsReading MySQL fingerprints
Reading MySQL fingerprints
 
High-availability with Galera Cluster for MySQL
High-availability with Galera Cluster for MySQLHigh-availability with Galera Cluster for MySQL
High-availability with Galera Cluster for MySQL
 
MySQL Cluster with Galera Cluster for MySQL
MySQL Cluster with Galera Cluster for MySQLMySQL Cluster with Galera Cluster for MySQL
MySQL Cluster with Galera Cluster for MySQL
 
Need for Speed: Mysql indexing
Need for Speed: Mysql indexingNeed for Speed: Mysql indexing
Need for Speed: Mysql indexing
 

Recently uploaded

+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
?#DUbAI#??##{{(☎️+971_581248768%)**%*]'#abortion pills for sale in dubai@
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
Joaquim Jorge
 

Recently uploaded (20)

From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a Fresher
 
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
 
AWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of Terraform
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt Robison
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdf
 
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘
 
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century education
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
 
Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
 
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
 

FOSDEM 2012: MySQL synchronous replication in practice with Galera

  • 1. MySQL synchronous replication in practice with Galera FOSDEM MySQL and Friends Devroom February 5, 2012, ULB Brussels Oli Sennhauser Senior MySQL Consultant, FromDual oli.sennhauser@fromdual.com
  • 2. Content ● Galera Cluster ● Why Galera? ● Characteristics ● Set-up ● Configuration ● Starting / stopping ● SST ● Information
  • 3. Galera Cluster ● Synchronous Multi-Master Replication App App App Load balancing (LB) Node 1 Node 2 Node 3 wsrep wsrep wsrep Galera replication ● Scaling reads (and writes)
  • 4. Galera Cluster ● If one node fails: App App App Load balancing (LB) Node 1 Node 2 Node 3 wsrep wsrep wsrep Galera replication ● High Availability (HA)
  • 5. Why Galera? ● Master-Slave Replication ● Not multi-Master, asynchronous, inconsistencies ● Master-Master Replication ● Some kind of multi-Master, asynchronous, inconsistencies, conflicts ● MHA, MMM (v1, v2), Tungsten ● Bases on MySQL Replication ● MySQL Cluster ● Not like InnoDB, Know-How, Network-DB! ● Active/passive Failover Cluster ● Operations, resources idling ● Schooner ● Expensive, not sure what technology (Memcached, Replication, ...)
  • 6. Characteristics Synchronous replication Based on InnoDB SE (other SE theoretically possible) Active-active real multi-master topology Read and write to any cluster node Automatic membership control True parallel replication, on row level No slave lag No lost transactions Read AND write scalability (Read Scale-Out!) Patch off MySQL binaries (Codership provides binaries) Be aware of Hot Spots on rows Higher probability of dead locks Full sync blocks for writing → 3 nodes Initial sync for very big databases (>>50 Gbyte) with mysqldump → rsync, xtrabackup
  • 7. Set-up ● 3 nodes is recommended ● Or 2 + 1 (2 mysqld + garbd) → SST!!! ● 2 nodes → split brain! ● Codership MySQL + Galera Plug-in (wsrep) ● User for SST is root! ● We recommend to use your own user. ● On all nodes: GRANT ALL PRIVILEGES ON *.* TO 'sst'@'%' IDENTIFIED BY 'secret'; GRANT ALL PRIVILEGES ON *.* TO 'sst'@'localhost' IDENTIFIED BY 'secret';
  • 8. Configuration ● my.cnf (galera.conf) default_storage_engine = InnoDB binlog_format = row innodb_autoinc_lock_mode = 2 innodb_locks_unsafe_for_binlog = 1 innodb_flush_log_at_trx_commit = 0 innodb_doublewrite = 0 query_cache_size = 0 query_cache_type = 0 # wsrep_provider = none wsrep_provider = …/lib/plugin/libgalera_smm.so # wsrep_cluster_address = "gcomm://192.168.42.3" wsrep_cluster_address = "gcomm://" wsrep_sst_method = mysqldump wsrep_sst_auth = sst:secret
  • 9. Start nodes ● First node: /etc/init.d/mysql start ● Other nodes: wsrep_cluster_address = "gcomm://192.168.42.1" /etc/init.d/mysql start ● Check with ● MySQL error log (on this AND remote node!) ● SHOW GLOBAL STATUS;
  • 10. Checks 120131 07:37:17 mysqld_safe Starting mysqld daemon ... 120131 7:37:18 [Note] WSREP: wsrep_load(): loading provider library 'libgalera_smm.so' 120131 7:37:18 [Note] WSREP: Start replication ... 120131 7:37:18 [Note] WSREP: Shifting CLOSED -> OPEN (TO: 0) 120131 7:37:18 [Note] .../mysql/bin/mysqld: ready for connections. ... 120131 7:37:23 [Note] WSREP: Quorum results: conf_id = 2, members = 3/3 (joined/total) SHOW GLOBAL STATUS LIKE 'wsrep%'; +----------------------------+--------------------------------------+ | Variable_name | Value | +----------------------------+--------------------------------------+ | wsrep_local_state_comment | Synced (6) | | wsrep_cluster_conf_id | 3 | | wsrep_cluster_size | 3 | | wsrep_cluster_status | Primary | | wsrep_connected | ON | | wsrep_local_index | 0 | | wsrep_ready | ON | +----------------------------+--------------------------------------+
  • 11. SST ● Snapshot State Transfer (SST) ● Initial full sync between 1st and other nodes → mysqldump, rsync, (xtrabackup?, LVM?) ● Blocks the Donor! (→ 3 nodes) ● With v2.0 there is an Incremental State Transfer (IST) 120131 16:26:42 [Note] WSREP: Quorum results: conf_id = 4, members = 2/3 (joined/total) 120131 16:26:44 [Note] WSREP: Node 2 (Node 3) requested state transfer from '*any*'. Selected 0 (Node 1)(SYNCED) as donor. 120131 16:26:44 [Note] WSREP: Shifting SYNCED -> DONOR/DESYNCED (TO: 2695744) 120131 16:27:10 [Note] WSREP: 2 (Node 3): State transfer from 0 (Node 1) complete. 120131 16:27:10 [Note] WSREP: Member 2 (Node 3) synced with group. 120131 16:27:10 [Note] WSREP: 0 (Node 1): State transfer to 2 (Node 3) complete. 120131 16:27:10 [Note] WSREP: Shifting DONOR/DESYNCED -> JOINED (TO: 2695744) 120131 16:27:10 [Note] WSREP: Member 0 (Node 1) synced with group. 120131 16:27:10 [Note] WSREP: Shifting JOINED -> SYNCED (TO: 2695744) 120131 16:27:10 [Note] WSREP: Synchronized with group, ready for connections
  • 12. Restarting a node ● 2nd and 3rd node → no problem st ● 1 node: # wsrep_cluster_address = "gcomm://192.168.42.3" wsrep_cluster_address = "gcomm:// → This is IMHO non optimal because we have 2 different situations: ● Initial 1st node start ● 1st node restart
  • 13. Variables ● Currently (1.1) 27 Variables SHOW GLOBAL VARIABLES LIKE 'wsrep%'; +--------------------------------+-----------------------------+ | Variable_name | Value | +--------------------------------+-----------------------------+ | wsrep_cluster_address | gcomm:// | | wsrep_cluster_name | Galera-1.0 wsrep-21 | | wsrep_max_ws_rows | 131072 | | wsrep_max_ws_size | 1073741824 | | wsrep_node_incoming_address | 192.168.42.1:3306 | | wsrep_node_name | Node 1 | | wsrep_notify_cmd | | | wsrep_on | ON | | wsrep_provider | .../plugin/libgalera_smm.so | | wsrep_retry_autocommit | 1 | | wsrep_slave_threads | 1 | | wsrep_sst_auth | ******** | | wsrep_sst_donor | | | wsrep_sst_method | mysqldump | | wsrep_sst_receive_address | AUTO | +--------------------------------+-----------------------------+
  • 14. wsrep_provider_options ● evs.debug_log_mask = 0x1; ● gcs.fc_factor = 0.5; ● evs.inactive_check_period = PT0.5S ● gcs.fc_limit = 16; ● evs.inactive_timeout = PT15S; ● gcs.fc_master_slave = NO; ● evs.info_log_mask = 0; ● gcs.max_packet_size = 64500; ● evs.install_timeout = PT15S; ● gcs.max_throttle = 0.25; ● evs.join_retrans_period = PT0.3S; ● gcs.recv_q_hard_limit = 9223372036854775807; ● evs.keepalive_period = PT1S; ● gcs.recv_q_soft_limit = 0.25; ● evs.max_install_timeouts = 1; ● gmcast.listen_addr = tcp://127.0.0.1:4567; ● evs.send_window = 4; ● gmcast.mcast_addr = ; ● evs.stats_report_period = PT1M; ● gmcast.mcast_ttl = 1; ● evs.suspect_timeout = PT5S; ● gmcast.peer_timeout = PT3S; ● evs.use_aggregate = true; ● gmcast.time_wait = PT5S; ● evs.user_send_window = 2; ● gmcast.version = 0; ● evs.version = 0; ● pc.checksum = true; ● evs.view_forget_timeout = PT5M; ● pc.ignore_quorum = false; ● gcache.dir = ...; ● pc.ignore_sb = false; ● gcache.keep_pages_size = 0; ● pc.linger = PT2S; ● gcache.mem_size = 0; ● pc.npvo = false; ● gcache.name = .../galera.cache; ● pc.version = 0; ● gcache.page_size = 128M; ● protonet.backend = asio; ● gcache.size = 128M; ● protonet.version = 0; ● gcs.fc_debug = 0; ● replicator.commit_order = 3
  • 15. Status ● Currently (1.1) 38 Status information ● SHOW GLOBAL STATUS LIKE 'wsrep%'; ● Cluster status ● Performance metrics ● General information +----------------------------+--------------------------------------+ | Variable_name | Value | +----------------------------+--------------------------------------+ | wsrep_last_committed | 2695744 | | wsrep_replicated | 1 | | wsrep_replicated_bytes | 576 | | wsrep_received | 9 | | wsrep_received_bytes | 1051 | | wsrep_local_commits | 1 | | wsrep_local_send_queue | 0 | | wsrep_local_recv_queue | 0 | | wsrep_flow_control_sent | 0 | | wsrep_flow_control_recv | 0 | | wsrep_provider_version | 22.1.1(r95) | +----------------------------+--------------------------------------+
  • 16. Load Balancing ● In your Application (on your own) ● Connectors ● Connector/J ● PHP: MySQLnd replication and load balancing plug-in ● SW Load Balancer ● GLB, Pen, LVS, HAProxy, MySQL Proxy, SQL Relay, ● HW Load Balancer
  • 17. Operations ● 2 Modes: ● Master-Master ● Master-Slave ● Initial configuration (do not mess it up) ● SST (DB size, NW bandwidth (WAN)) ● Start / restart ● Deadlocks and hot spots
  • 18. Galera Replication ● Graph from Vadim Tkachenko (Percona): http://www.mysqlperformanceblog.com/2012/01/19/percona-xtradb-cluster-feature-2-multi-master-replication/
  • 19. Q&A Questions ? Discussion? We have some time for face-to-face talks... ● FromDual provides neutral and independent: ● Consulting ● Remote-DBA ● Support for MySQL, Galera, Percona Server ● Training www.fromdual.com