SlideShare a Scribd company logo
1 of 44
Download to read offline
What's new
                        in MySQL 5.5 and 5.6
                                 replication
                                  Giuseppe Maxia
                                  Continuent, Inc


   ©Continuent 2012.


Tuesday, April 17, 12                               1
AGENDA

                        •   5.5
                            •   semi-synchronous replication

                        •   5.6
                            •   delayed replication

                            •   server UUID

                            •   crash-safe slave

                            •   multi-thread slave

                            •   Global transaction identi!ers



   ©Continuent 2012                                   2


Tuesday, April 17, 12                                           2
DA
     AG
        EN              semi-synch replication




Tuesday, April 17, 12                            3
semi-synchronous
                                  replication


                        • Available in 5.5 and higher
                        • Makes sure that at least one slave has
                          copied the data.
                        • Increases reliability


Tuesday, April 17, 12                                              4
client
                                                           master   transaction
                                               1                    with regular
                                    commit                           replication



                                               execute     2

                                                                      slave
                         returns
        4               to client
                                             binary log        3



                                      5      replication
                                                                               5
Tuesday, April 17, 12                                                              5
client                                     transaction
                                                           master
                                                1                          with semi-
                                    commit                               synchronous
                                                                           replication

                                               execute     2

                                                                          slave
                  7      returns
                        to client
                                             binary log        3

                                                sends
                                     4       transaction            relay log     5
                                               to slave


                                            gets
                        6             acknowledgement
                                                                                      6
Tuesday, April 17, 12                                                                    6
semi-synchronous
                              replication in practice



                        • installation:
                          •   it’s a plugin.

                          •   Actually, two plugins




Tuesday, April 17, 12                                   7
semi-synch replication install
  # in the master
  plugin-load=rpl_semi_sync_master=semisync_master.so
  rpl_semi_sync_master_enabled=1



  # in each slave
  plugin-load=rpl_semi_sync_slave=semisync_slave.so
  rpl_semi_sync_slave_enabled=1



  # restar all servers




Tuesday, April 17, 12                                    8
semi-synch replication check
  # in the master
  show variables like 'rpl_semi%';
  +------------------------------------+-------+
  | Variable_name                      | Value |
  +------------------------------------+-------+
  | rpl_semi_sync_master_enabled       | ON    |
  | rpl_semi_sync_master_timeout       | 10000 |
  | rpl_semi_sync_master_trace_level   | 32    |
  | rpl_semi_sync_master_wait_no_slave | ON    |
  +------------------------------------+-------+




Tuesday, April 17, 12                                  9
semi-synch replication check
  show status like "rpl_semi_%tx";
  +-----------------------------+-------+
  | variable_name               | value |
  +-----------------------------+-------+
  | RPL_SEMI_SYNC_MASTER_NO_TX | 0      |
  | RPL_SEMI_SYNC_MASTER_YES_TX | 0     |
  +-----------------------------+-------+




Tuesday, April 17, 12                                  10
semi-synch replication test
  master> create table t1 ( i int);
  Query OK, 0 rows affected (0.01 sec)

  master> show status like "rpl_semi_%tx";
  +-----------------------------+-------+
  | Variable_name               | Value |
  +-----------------------------+-------+
  | Rpl_semi_sync_master_no_tx | 0      |
  | Rpl_semi_sync_master_yes_tx | 1     |
  +-----------------------------+-------+




Tuesday, April 17, 12                                 11
disabling semi-synch
  # for each slave

  set global rpl_semi_sync_slave_enabled=0;
  stop slave io_thread;
  start slave io_thread;




Tuesday, April 17, 12                          12
disabled semi-synch replication test
  master> insert into t1 values (1);
  Query OK, 1 row affected (10.00 sec)

  master> show status like "rpl_semi_%tx";
  +-----------------------------+-------+
  | Variable_name               | Value |
  +-----------------------------+-------+
  | Rpl_semi_sync_master_no_tx | 1      |
  | Rpl_semi_sync_master_yes_tx | 1     |
  +-----------------------------+-------+
  2 rows in set (0.00 sec)




Tuesday, April 17, 12                         13
disabled semi-synch replication test
  master> insert into t1 values (2);
  Query OK, 1 row affected (0.01 sec)

  master> show status like "rpl_semi_%tx";
  +-----------------------------+-------+
  | Variable_name               | Value |
  +-----------------------------+-------+
  | Rpl_semi_sync_master_no_tx | 2      |
  | Rpl_semi_sync_master_yes_tx | 1     |
  +-----------------------------+-------+
  2 rows in set (0.00 sec)




Tuesday, April 17, 12                         14
re-enabling semi-synch
  # in one slave

  set global rpl_semi_sync_slave_enabled=1;
  stop slave io_thread;
  start slave io_thread;




Tuesday, April 17, 12                            15
reenabled semi-synch replication test
  master> insert into t1 values (3);
  Query OK, 1 row affected (0.01 sec)

  master> show status like "rpl_semi_%tx";
  +-----------------------------+-------+
  | Variable_name               | Value |
  +-----------------------------+-------+
  | Rpl_semi_sync_master_no_tx | 2      |
  | Rpl_semi_sync_master_yes_tx | 2     |
  +-----------------------------+-------+
  2 rows in set (0.00 sec)




Tuesday, April 17, 12                        16
DA
     AG
        EN              delayed replication




Tuesday, April 17, 12                         17
delayed replication in practice
  STOP SLAVE;
  change master to master_delay=60;
  START SLAVE;

  SHOW SLAVE STATUSG
  (...)
                                    SQL_Delay: 60
                           SQL_Remaining_Delay: NULL




Tuesday, April 17, 12                                     18
delayed replication in practice
  master >                 use test;
  master >                 create table t2 (i int);



  SHOW SLAVE STATUSG
  (...)
                                    SQL_Delay: 60
                           SQL_Remaining_Delay: 55

  slave> SHOW TABLES FROM test;
  +----------------+
  | Tables_in_test |
  +----------------+
  | t1             |
  +----------------+
Tuesday, April 17, 12                                     19
delayed replication in practice
  # after 1 minute

  SHOW SLAVE STATUSG
  (...)
                                     SQL_Delay: 60
                           SQL_Remaining_Delay: NULL

  slave> SHOW TABLES FROM test;
  +----------------+
  | Tables_in_test |
  +----------------+
  | t1             |
  | t2             |
  +----------------+


Tuesday, April 17, 12                                     20
DA
     AG
        EN              Server UUID




Tuesday, April 17, 12                 21
testing some replication
     make_replication_sandbox mysql-5.6.5-m8-
     osx10.7-.tar.gz
     ....
     ....
     replication directory installed in
     $HOME/sandboxes/rsandbox_mysql-5_6_5




Tuesday, April 17, 12                              22
testing some replication
     ~/sandboxes/rsandbox_mysql-5_6_5/s1
     show slave statusG
     ******** 1. row ***************************
          Slave_IO_State: Waiting for master to send event
                        Master_Host: 127.0.0.1
                        Master_User: rsandbox
                        Master_Port: 12630
                      Connect_Retry: 60
                   Master_Log_File: mysql-bin.000001
               Read_Master_Log_Pos: 2524
                    Relay_Log_File: mysql_sandbox12631-
     relay-bin.000002
                      Relay_Log_Pos: 2677
             Relay_Master_Log_File: mysql-bin.000001
                  Slave_IO_Running: Yes
                 Slave_SQL_Running: Yes


Tuesday, April 17, 12                                        23
testing some replication
     ~/sandboxes/rsandbox_mysql-5_6_5/s1
     show slave statusG
     ....
     Master_Server_Id: 1
     Master_UUID: be3c022a-726f-11e1-a26a-a64f991393aa
     Master_Info_File: /Users/gmax/sandboxes/
     rsandbox_mysql-5_6_5/node1/data/master.info
     SQL_Delay: 0
     SQL_Remaining_Delay: NULL
     Slave_SQL_Running_State: Slave has read all relay
     log; waiting for the slave I/O thread to update it




Tuesday, April 17, 12                                     24
DA
     AG
        EN              crash safe slave




Tuesday, April 17, 12                      25
uncovering replication
                              features
     show variables like '%info%';
     +---------------------------+----------------+
     | Variable_name              | Value          |
     +---------------------------+----------------+
     | master_info_repository     | FILE           |
     | relay_log_info_file        | relay-log.info |
     | relay_log_info_repository | FILE            |
     | sync_master_info           | 0              |
     | sync_relay_log_info        | 0              |
     +---------------------------+----------------+
     show variables like '%worker%';
     +------------------------+-------+
     | Variable_name          | Value |
     +------------------------+-------+
     | slave_parallel_workers | 0      |
     +------------------------+-------+

Tuesday, April 17, 12                                  26
uncovering replication
                              features
     STOP SLAVE;

     set global master_info_repository='table';
     Query OK, 0 rows affected (0.00 sec)

     slave1 [localhost] {msandbox} ((none)) > set global
     relay_log_info_repository='table';
     Query OK, 0 rows affected (0.00 sec)

     slave1 [localhost] {msandbox} ((none)) > set global
     slave_parallel_workers=3;
     Query OK, 0 rows affected (0.00 sec)




Tuesday, April 17, 12                                      27
fixing replication tables
     use mysql;

     slave1 [localhost] {msandbox} (mysql) > alter table
     slave_master_info engine=innodb;
     Query OK, 1 row affected (0.01 sec)
     Records: 1 Duplicates: 0 Warnings: 0

     slave1 [localhost] {msandbox} (mysql) > alter table
     slave_relay_log_info engine=innodb;
     Query OK, 1 row affected (0.01 sec)
     Records: 1 Duplicates: 0 Warnings: 0

     slave1 [localhost] {msandbox} (mysql) > alter table
     slave_worker_info engine=innodb;
     Query OK, 0 rows affected (0.01 sec)
     Records: 0 Duplicates: 0 Warnings: 0


Tuesday, April 17, 12                                      28
Look at the new features
     show slave statusG
     ....
     ....
     Master_UUID: be3c022a-726f-11e1-a26a-
     a64f991393aa
     Master_Info_File:
     mysql.slave_master_info




Tuesday, April 17, 12                              29
Look at the new features
     select * from mysql.slave_master_infoG
     *************************** 1. row ******
                   Master_id: 101
             Number_of_lines: 22
             Master_log_name: mysql-bin.000001
              Master_log_pos: 2524
                        Host: 127.0.0.1
                   User_name: rsandbox
               User_password: rsandbox
                        Port: 12630
     ....
                   Heartbeat: 1800
                        Bind:
          Ignored_server_ids: 0
          Uuid: be3c022a-726f-11e1-a26a-a64f991393aa
                 Retry_count: 86400


Tuesday, April 17, 12                                  30
Look at the new features
     select * from mysql.slave_relay_log_infoG
     *************************** 1. row ***************
             Master_id: 101
       Number_of_lines: 6
        Relay_log_name: ./mysql_sandbox12631-relay-bin.
     000002
         Relay_log_pos: 2677
       Master_log_name: mysql-bin.000001
        Master_log_pos: 2524
             Sql_delay: 0
     Number_of_workers: 3




Tuesday, April 17, 12                                     31
Look at the new features
     select * from mysql.slave_worker_infoG
     ************** 3. row *********************
                       Master_id: 101
                       Worker_id: 2
                  Relay_log_name: ./mysql_sandbox12631-relay-
     bin.000003
                   Relay_log_pos: 1394
                 Master_log_name: mysql-bin.000001
                  Master_log_pos: 3651
      Checkpoint_relay_log_name: ./mysql_sandbox12631-relay-
     bin.000003
       Checkpoint_relay_log_pos: 1199
     Checkpoint_master_log_name: mysql-bin.000001
      Checkpoint_master_log_pos: 3456
                Checkpoint_seqno: 0
          Checkpoint_group_size: 64
        Checkpoint_group_bitmap:



Tuesday, April 17, 12                                           32
DA
     AG
        EN              multi-threaded slave




Tuesday, April 17, 12                          33
facts about multiple threaded slave
                a.k.a. parallel replication

                        • Requires MySQL 5.6 in both master and
                          slave
                        • Parallel replication with a 5.5 master will
                          slow down replication
                        • Data gets parallelized by schema

Tuesday, April 17, 12                                                   34
enabling multi-threaded slave
     set global slave_parallel_workers=10;

     show variables like '%worker%';
     +------------------------+-------+
     | Variable_name          | Value |
     +------------------------+-------+
     | slave_parallel_workers | 10    |
     +------------------------+-------+

     stop slave; start slave;



Tuesday, April 17, 12                        35
DA
     AG
        EN              global transaction identifier




Tuesday, April 17, 12                                  36
global transaction identifier
    • Requires MySQL 5.6 in both master and slave
    • requires all servers in the cluster to run these
            options:
          • log-bin
          • log-slave-updates
          • gtid-mode=ON
          • disable-gtid-unsafe-statements

Tuesday, April 17, 12                                    37
global transaction identifier issues

          • Can't work with:
           • non-transactional updates.
           • temporary tables within transactions
           • CREATE TABLE ... SELECT
          • disable-gtid-unsafe-statements will make the server
                  fail on any of the above cases.



Tuesday, April 17, 12                                             38
enabling global transaction identifiers
     # change my.cnf in ALL nodes
     # (master and slaves)

     [mysqld]
     log-bin
     log-slave-updates
     gtid-mode=ON
     disable-gtid-unsafe-statements

     # restart the servers




Tuesday, April 17, 12                              39
testing global transaction identifiers
     create table t1 (i int not null primary key);
     show binlog eventsG
     ********* 3. row ***************************
        Log_name: mysql-bin.000002
             Pos: 147
      Event_type: Gtid
       Server_id: 1
     End_log_pos: 191
            Info: SET
     @@SESSION.GTID_NEXT='44556A96-8417-11E1-9589-2BD5ACDD51FD:1'
     ********* 4. row ***************************
        Log_name: mysql-bin.000002
             Pos: 191
      Event_type: Query
       Server_id: 1
     End_log_pos: 305
            Info: use `test`; create table t1 (i int not null primary
     key)




Tuesday, April 17, 12                                                   40
testing global transaction identifiers
     SHOW SLAVE STATUSG
     (...)
           Retrieved_Gtid_Set: 44556A96-8417-11E1-9589-2BD5ACDD51FD:1-2
            Executed_Gtid_Set: 44556A96-8417-11E1-9589-2BD5ACDD51FD:1-2




Tuesday, April 17, 12                                                     41
DEMO




Tuesday, April 17, 12          42
ADVERTISING


   ©Continuent 2012          43


Tuesday, April 17, 12                 43
WE ARE HIRING!
    • Cluster implementation engineer
    • QA engineer
    • Documentation writer


      http://www.continuent.com/about/careers

   ©Continuent 2012      44


Tuesday, April 17, 12                           44

More Related Content

What's hot

PostgreSQL Performance Tuning
PostgreSQL Performance TuningPostgreSQL Performance Tuning
PostgreSQL Performance Tuningelliando dias
 
MySQL Multi-Source Replication for PL2016
MySQL Multi-Source Replication for PL2016MySQL Multi-Source Replication for PL2016
MySQL Multi-Source Replication for PL2016Wagner Bianchi
 
Athenticated smaba server config with open vpn
Athenticated smaba server  config with open vpnAthenticated smaba server  config with open vpn
Athenticated smaba server config with open vpnChanaka Lasantha
 
Learning MySQL 5.7
Learning MySQL 5.7Learning MySQL 5.7
Learning MySQL 5.7Jervin Real
 
FOSDEM 2012: MySQL synchronous replication in practice with Galera
FOSDEM 2012: MySQL synchronous replication in practice with GaleraFOSDEM 2012: MySQL synchronous replication in practice with Galera
FOSDEM 2012: MySQL synchronous replication in practice with GaleraFromDual GmbH
 
12c for Developers - Feb 2014
12c for Developers - Feb 201412c for Developers - Feb 2014
12c for Developers - Feb 2014Connor McDonald
 
Arp Dan Ipconfig Syntax
Arp Dan Ipconfig  SyntaxArp Dan Ipconfig  Syntax
Arp Dan Ipconfig Syntaxguestcc37e8c
 
PostgreSQL Portland Performance Practice Project - Database Test 2 Tuning
PostgreSQL Portland Performance Practice Project - Database Test 2 TuningPostgreSQL Portland Performance Practice Project - Database Test 2 Tuning
PostgreSQL Portland Performance Practice Project - Database Test 2 TuningMark Wong
 
005 cluster monitoring
005 cluster monitoring005 cluster monitoring
005 cluster monitoringScott Miao
 
23769377 lab-bgp-juniper
23769377 lab-bgp-juniper23769377 lab-bgp-juniper
23769377 lab-bgp-junipercavang_3004
 
Out of the box replication in postgres 9.4
Out of the box replication in postgres 9.4Out of the box replication in postgres 9.4
Out of the box replication in postgres 9.4Denish Patel
 
Db2 V12 incompatibilities_&_improvements_over_V11
Db2 V12 incompatibilities_&_improvements_over_V11Db2 V12 incompatibilities_&_improvements_over_V11
Db2 V12 incompatibilities_&_improvements_over_V11Abhishek Verma
 
Comandos
ComandosComandos
Comandos1 2d
 
Upgrade 10204-to-10205 on-2-node_rac_linux_x86_64_detail-steps_v0.1
Upgrade 10204-to-10205 on-2-node_rac_linux_x86_64_detail-steps_v0.1Upgrade 10204-to-10205 on-2-node_rac_linux_x86_64_detail-steps_v0.1
Upgrade 10204-to-10205 on-2-node_rac_linux_x86_64_detail-steps_v0.1Raheel Syed
 
NIC 2013 - Hyper-V Replica
NIC 2013 - Hyper-V ReplicaNIC 2013 - Hyper-V Replica
NIC 2013 - Hyper-V ReplicaKristian Nese
 
DB2 Basic Commands - UDB
DB2 Basic Commands - UDBDB2 Basic Commands - UDB
DB2 Basic Commands - UDBSrinimf-Slides
 
Mastering PostgreSQL Administration
Mastering PostgreSQL AdministrationMastering PostgreSQL Administration
Mastering PostgreSQL AdministrationEDB
 
HBaseCon 2013: A Developer’s Guide to Coprocessors
HBaseCon 2013: A Developer’s Guide to CoprocessorsHBaseCon 2013: A Developer’s Guide to Coprocessors
HBaseCon 2013: A Developer’s Guide to CoprocessorsCloudera, Inc.
 

What's hot (20)

PostgreSQL Performance Tuning
PostgreSQL Performance TuningPostgreSQL Performance Tuning
PostgreSQL Performance Tuning
 
MySQL Multi-Source Replication for PL2016
MySQL Multi-Source Replication for PL2016MySQL Multi-Source Replication for PL2016
MySQL Multi-Source Replication for PL2016
 
Ns2leach
Ns2leachNs2leach
Ns2leach
 
Athenticated smaba server config with open vpn
Athenticated smaba server  config with open vpnAthenticated smaba server  config with open vpn
Athenticated smaba server config with open vpn
 
Learning MySQL 5.7
Learning MySQL 5.7Learning MySQL 5.7
Learning MySQL 5.7
 
FOSDEM 2012: MySQL synchronous replication in practice with Galera
FOSDEM 2012: MySQL synchronous replication in practice with GaleraFOSDEM 2012: MySQL synchronous replication in practice with Galera
FOSDEM 2012: MySQL synchronous replication in practice with Galera
 
12c for Developers - Feb 2014
12c for Developers - Feb 201412c for Developers - Feb 2014
12c for Developers - Feb 2014
 
Arp Dan Ipconfig Syntax
Arp Dan Ipconfig  SyntaxArp Dan Ipconfig  Syntax
Arp Dan Ipconfig Syntax
 
PostgreSQL Portland Performance Practice Project - Database Test 2 Tuning
PostgreSQL Portland Performance Practice Project - Database Test 2 TuningPostgreSQL Portland Performance Practice Project - Database Test 2 Tuning
PostgreSQL Portland Performance Practice Project - Database Test 2 Tuning
 
005 cluster monitoring
005 cluster monitoring005 cluster monitoring
005 cluster monitoring
 
23769377 lab-bgp-juniper
23769377 lab-bgp-juniper23769377 lab-bgp-juniper
23769377 lab-bgp-juniper
 
Out of the box replication in postgres 9.4
Out of the box replication in postgres 9.4Out of the box replication in postgres 9.4
Out of the box replication in postgres 9.4
 
Git tutorial
Git tutorialGit tutorial
Git tutorial
 
Db2 V12 incompatibilities_&_improvements_over_V11
Db2 V12 incompatibilities_&_improvements_over_V11Db2 V12 incompatibilities_&_improvements_over_V11
Db2 V12 incompatibilities_&_improvements_over_V11
 
Comandos
ComandosComandos
Comandos
 
Upgrade 10204-to-10205 on-2-node_rac_linux_x86_64_detail-steps_v0.1
Upgrade 10204-to-10205 on-2-node_rac_linux_x86_64_detail-steps_v0.1Upgrade 10204-to-10205 on-2-node_rac_linux_x86_64_detail-steps_v0.1
Upgrade 10204-to-10205 on-2-node_rac_linux_x86_64_detail-steps_v0.1
 
NIC 2013 - Hyper-V Replica
NIC 2013 - Hyper-V ReplicaNIC 2013 - Hyper-V Replica
NIC 2013 - Hyper-V Replica
 
DB2 Basic Commands - UDB
DB2 Basic Commands - UDBDB2 Basic Commands - UDB
DB2 Basic Commands - UDB
 
Mastering PostgreSQL Administration
Mastering PostgreSQL AdministrationMastering PostgreSQL Administration
Mastering PostgreSQL Administration
 
HBaseCon 2013: A Developer’s Guide to Coprocessors
HBaseCon 2013: A Developer’s Guide to CoprocessorsHBaseCon 2013: A Developer’s Guide to Coprocessors
HBaseCon 2013: A Developer’s Guide to Coprocessors
 

Similar to Mysql 5.5 and 5.6 replication

MySQL Replication Overview -- PHPTek 2016
MySQL Replication Overview -- PHPTek 2016MySQL Replication Overview -- PHPTek 2016
MySQL Replication Overview -- PHPTek 2016Dave Stokes
 
Solving the C20K Problem: PHP Performance and Scalability
Solving the C20K Problem: PHP Performance and ScalabilitySolving the C20K Problem: PHP Performance and Scalability
Solving the C20K Problem: PHP Performance and Scalabilitywebhostingguy
 
Solving the C20K Problem: PHP Performance and Scalability
Solving the C20K Problem: PHP Performance and ScalabilitySolving the C20K Problem: PHP Performance and Scalability
Solving the C20K Problem: PHP Performance and Scalabilitywebhostingguy
 
Rails Application Optimization Techniques & Tools
Rails Application Optimization Techniques & ToolsRails Application Optimization Techniques & Tools
Rails Application Optimization Techniques & Toolsguest05c09d
 
Reducing Risk When Upgrading MySQL
Reducing Risk When Upgrading MySQLReducing Risk When Upgrading MySQL
Reducing Risk When Upgrading MySQLKenny Gryp
 
Thoughts on consistency models
Thoughts on consistency modelsThoughts on consistency models
Thoughts on consistency modelsrogerbodamer
 
Oracle中加速索引创建或重建的方法
Oracle中加速索引创建或重建的方法Oracle中加速索引创建或重建的方法
Oracle中加速索引创建或重建的方法maclean liu
 
Tips and Tricks for SAP Sybase ASE
Tips and Tricks for SAP Sybase ASETips and Tricks for SAP Sybase ASE
Tips and Tricks for SAP Sybase ASEDon Brizendine
 
MySQL Replication — Advanced Features / Петр Зайцев (Percona)
MySQL Replication — Advanced Features / Петр Зайцев (Percona)MySQL Replication — Advanced Features / Петр Зайцев (Percona)
MySQL Replication — Advanced Features / Петр Зайцев (Percona)Ontico
 
Demystifying postgres logical replication percona live sc
Demystifying postgres logical replication percona live scDemystifying postgres logical replication percona live sc
Demystifying postgres logical replication percona live scEmanuel Calvo
 
MySQL Replication Update -- Zendcon 2016
MySQL Replication Update -- Zendcon 2016MySQL Replication Update -- Zendcon 2016
MySQL Replication Update -- Zendcon 2016Dave Stokes
 
Postgres Vienna DB Meetup 2014
Postgres Vienna DB Meetup 2014Postgres Vienna DB Meetup 2014
Postgres Vienna DB Meetup 2014Michael Renner
 
MySQL Replication Basics -Ohio Linux Fest 2016
MySQL Replication Basics -Ohio Linux Fest 2016MySQL Replication Basics -Ohio Linux Fest 2016
MySQL Replication Basics -Ohio Linux Fest 2016Dave Stokes
 
MySQL 101 PHPTek 2017
MySQL 101 PHPTek 2017MySQL 101 PHPTek 2017
MySQL 101 PHPTek 2017Dave Stokes
 
Perforce Administration: Optimization, Scalability, Availability and Reliability
Perforce Administration: Optimization, Scalability, Availability and ReliabilityPerforce Administration: Optimization, Scalability, Availability and Reliability
Perforce Administration: Optimization, Scalability, Availability and ReliabilityPerforce
 
Exactly-Once Financial Data Processing at Scale with Flink and Pinot
Exactly-Once Financial Data Processing at Scale with Flink and PinotExactly-Once Financial Data Processing at Scale with Flink and Pinot
Exactly-Once Financial Data Processing at Scale with Flink and PinotFlink Forward
 
Replication features, technologies and 3rd party Extinction
Replication features, technologies and 3rd party ExtinctionReplication features, technologies and 3rd party Extinction
Replication features, technologies and 3rd party ExtinctionBen Mildren
 
MySQL 5.7 innodb_enhance_partii_20160527
MySQL 5.7 innodb_enhance_partii_20160527MySQL 5.7 innodb_enhance_partii_20160527
MySQL 5.7 innodb_enhance_partii_20160527Saewoong Lee
 
My sql replication advanced techniques presentation
My sql replication advanced techniques presentationMy sql replication advanced techniques presentation
My sql replication advanced techniques presentationepee
 
MariaDB High Availability
MariaDB High AvailabilityMariaDB High Availability
MariaDB High AvailabilityMariaDB plc
 

Similar to Mysql 5.5 and 5.6 replication (20)

MySQL Replication Overview -- PHPTek 2016
MySQL Replication Overview -- PHPTek 2016MySQL Replication Overview -- PHPTek 2016
MySQL Replication Overview -- PHPTek 2016
 
Solving the C20K Problem: PHP Performance and Scalability
Solving the C20K Problem: PHP Performance and ScalabilitySolving the C20K Problem: PHP Performance and Scalability
Solving the C20K Problem: PHP Performance and Scalability
 
Solving the C20K Problem: PHP Performance and Scalability
Solving the C20K Problem: PHP Performance and ScalabilitySolving the C20K Problem: PHP Performance and Scalability
Solving the C20K Problem: PHP Performance and Scalability
 
Rails Application Optimization Techniques & Tools
Rails Application Optimization Techniques & ToolsRails Application Optimization Techniques & Tools
Rails Application Optimization Techniques & Tools
 
Reducing Risk When Upgrading MySQL
Reducing Risk When Upgrading MySQLReducing Risk When Upgrading MySQL
Reducing Risk When Upgrading MySQL
 
Thoughts on consistency models
Thoughts on consistency modelsThoughts on consistency models
Thoughts on consistency models
 
Oracle中加速索引创建或重建的方法
Oracle中加速索引创建或重建的方法Oracle中加速索引创建或重建的方法
Oracle中加速索引创建或重建的方法
 
Tips and Tricks for SAP Sybase ASE
Tips and Tricks for SAP Sybase ASETips and Tricks for SAP Sybase ASE
Tips and Tricks for SAP Sybase ASE
 
MySQL Replication — Advanced Features / Петр Зайцев (Percona)
MySQL Replication — Advanced Features / Петр Зайцев (Percona)MySQL Replication — Advanced Features / Петр Зайцев (Percona)
MySQL Replication — Advanced Features / Петр Зайцев (Percona)
 
Demystifying postgres logical replication percona live sc
Demystifying postgres logical replication percona live scDemystifying postgres logical replication percona live sc
Demystifying postgres logical replication percona live sc
 
MySQL Replication Update -- Zendcon 2016
MySQL Replication Update -- Zendcon 2016MySQL Replication Update -- Zendcon 2016
MySQL Replication Update -- Zendcon 2016
 
Postgres Vienna DB Meetup 2014
Postgres Vienna DB Meetup 2014Postgres Vienna DB Meetup 2014
Postgres Vienna DB Meetup 2014
 
MySQL Replication Basics -Ohio Linux Fest 2016
MySQL Replication Basics -Ohio Linux Fest 2016MySQL Replication Basics -Ohio Linux Fest 2016
MySQL Replication Basics -Ohio Linux Fest 2016
 
MySQL 101 PHPTek 2017
MySQL 101 PHPTek 2017MySQL 101 PHPTek 2017
MySQL 101 PHPTek 2017
 
Perforce Administration: Optimization, Scalability, Availability and Reliability
Perforce Administration: Optimization, Scalability, Availability and ReliabilityPerforce Administration: Optimization, Scalability, Availability and Reliability
Perforce Administration: Optimization, Scalability, Availability and Reliability
 
Exactly-Once Financial Data Processing at Scale with Flink and Pinot
Exactly-Once Financial Data Processing at Scale with Flink and PinotExactly-Once Financial Data Processing at Scale with Flink and Pinot
Exactly-Once Financial Data Processing at Scale with Flink and Pinot
 
Replication features, technologies and 3rd party Extinction
Replication features, technologies and 3rd party ExtinctionReplication features, technologies and 3rd party Extinction
Replication features, technologies and 3rd party Extinction
 
MySQL 5.7 innodb_enhance_partii_20160527
MySQL 5.7 innodb_enhance_partii_20160527MySQL 5.7 innodb_enhance_partii_20160527
MySQL 5.7 innodb_enhance_partii_20160527
 
My sql replication advanced techniques presentation
My sql replication advanced techniques presentationMy sql replication advanced techniques presentation
My sql replication advanced techniques presentation
 
MariaDB High Availability
MariaDB High AvailabilityMariaDB High Availability
MariaDB High Availability
 

More from Giuseppe Maxia

MySQL NDB 8.0 clusters in your laptop with dbdeployer
MySQL NDB 8.0 clusters in your laptop with dbdeployerMySQL NDB 8.0 clusters in your laptop with dbdeployer
MySQL NDB 8.0 clusters in your laptop with dbdeployerGiuseppe Maxia
 
Dbdeployer, the universal installer
Dbdeployer, the universal installerDbdeployer, the universal installer
Dbdeployer, the universal installerGiuseppe Maxia
 
Test complex database systems in your laptop with dbdeployer
Test complex database systems in your laptop with dbdeployerTest complex database systems in your laptop with dbdeployer
Test complex database systems in your laptop with dbdeployerGiuseppe Maxia
 
A quick tour of Mysql 8 roles
A quick tour of Mysql 8 rolesA quick tour of Mysql 8 roles
A quick tour of Mysql 8 rolesGiuseppe Maxia
 
Synchronise your data between MySQL and MongoDB
Synchronise your data between MySQL and MongoDBSynchronise your data between MySQL and MongoDB
Synchronise your data between MySQL and MongoDBGiuseppe Maxia
 
Juggle your data with Tungsten Replicator
Juggle your data with Tungsten ReplicatorJuggle your data with Tungsten Replicator
Juggle your data with Tungsten ReplicatorGiuseppe Maxia
 
Tungsten Replicator tutorial
Tungsten Replicator tutorialTungsten Replicator tutorial
Tungsten Replicator tutorialGiuseppe Maxia
 
Preventing multi master conflicts with tungsten
Preventing multi master conflicts with tungstenPreventing multi master conflicts with tungsten
Preventing multi master conflicts with tungstenGiuseppe Maxia
 
MySQL high availability power and usability
MySQL high availability power and usabilityMySQL high availability power and usability
MySQL high availability power and usabilityGiuseppe Maxia
 
Solving MySQL replication problems with Tungsten
Solving MySQL replication problems with TungstenSolving MySQL replication problems with Tungsten
Solving MySQL replication problems with TungstenGiuseppe Maxia
 
State of the art of MySQL replication and clustering
State of the art of MySQL replication and clusteringState of the art of MySQL replication and clustering
State of the art of MySQL replication and clusteringGiuseppe Maxia
 
Testing mysql creatively in a sandbox
Testing mysql creatively in a sandboxTesting mysql creatively in a sandbox
Testing mysql creatively in a sandboxGiuseppe Maxia
 
Lightning talks percona live mysql_2012
Lightning talks percona live mysql_2012Lightning talks percona live mysql_2012
Lightning talks percona live mysql_2012Giuseppe Maxia
 

More from Giuseppe Maxia (20)

MySQL NDB 8.0 clusters in your laptop with dbdeployer
MySQL NDB 8.0 clusters in your laptop with dbdeployerMySQL NDB 8.0 clusters in your laptop with dbdeployer
MySQL NDB 8.0 clusters in your laptop with dbdeployer
 
Test like a_boss
Test like a_bossTest like a_boss
Test like a_boss
 
Dbdeployer, the universal installer
Dbdeployer, the universal installerDbdeployer, the universal installer
Dbdeployer, the universal installer
 
Test complex database systems in your laptop with dbdeployer
Test complex database systems in your laptop with dbdeployerTest complex database systems in your laptop with dbdeployer
Test complex database systems in your laptop with dbdeployer
 
Dbdeployer
DbdeployerDbdeployer
Dbdeployer
 
Dbdeployer
DbdeployerDbdeployer
Dbdeployer
 
A quick tour of Mysql 8 roles
A quick tour of Mysql 8 rolesA quick tour of Mysql 8 roles
A quick tour of Mysql 8 roles
 
MySQL document_store
MySQL document_storeMySQL document_store
MySQL document_store
 
Replication skeptic
Replication skepticReplication skeptic
Replication skeptic
 
Synchronise your data between MySQL and MongoDB
Synchronise your data between MySQL and MongoDBSynchronise your data between MySQL and MongoDB
Synchronise your data between MySQL and MongoDB
 
Juggle your data with Tungsten Replicator
Juggle your data with Tungsten ReplicatorJuggle your data with Tungsten Replicator
Juggle your data with Tungsten Replicator
 
MySQL in your laptop
MySQL in your laptopMySQL in your laptop
MySQL in your laptop
 
Script it
Script itScript it
Script it
 
Tungsten Replicator tutorial
Tungsten Replicator tutorialTungsten Replicator tutorial
Tungsten Replicator tutorial
 
Preventing multi master conflicts with tungsten
Preventing multi master conflicts with tungstenPreventing multi master conflicts with tungsten
Preventing multi master conflicts with tungsten
 
MySQL high availability power and usability
MySQL high availability power and usabilityMySQL high availability power and usability
MySQL high availability power and usability
 
Solving MySQL replication problems with Tungsten
Solving MySQL replication problems with TungstenSolving MySQL replication problems with Tungsten
Solving MySQL replication problems with Tungsten
 
State of the art of MySQL replication and clustering
State of the art of MySQL replication and clusteringState of the art of MySQL replication and clustering
State of the art of MySQL replication and clustering
 
Testing mysql creatively in a sandbox
Testing mysql creatively in a sandboxTesting mysql creatively in a sandbox
Testing mysql creatively in a sandbox
 
Lightning talks percona live mysql_2012
Lightning talks percona live mysql_2012Lightning talks percona live mysql_2012
Lightning talks percona live mysql_2012
 

Recently uploaded

Human Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsHuman Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsMark Billinghurst
 
Unblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesUnblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesSinan KOZAK
 
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 3652toLead Limited
 
How to Remove Document Management Hurdles with X-Docs?
How to Remove Document Management Hurdles with X-Docs?How to Remove Document Management Hurdles with X-Docs?
How to Remove Document Management Hurdles with X-Docs?XfilesPro
 
Install Stable Diffusion in windows machine
Install Stable Diffusion in windows machineInstall Stable Diffusion in windows machine
Install Stable Diffusion in windows machinePadma Pradeep
 
Next-generation AAM aircraft unveiled by Supernal, S-A2
Next-generation AAM aircraft unveiled by Supernal, S-A2Next-generation AAM aircraft unveiled by Supernal, S-A2
Next-generation AAM aircraft unveiled by Supernal, S-A2Hyundai Motor Group
 
Pigging Solutions Piggable Sweeping Elbows
Pigging Solutions Piggable Sweeping ElbowsPigging Solutions Piggable Sweeping Elbows
Pigging Solutions Piggable Sweeping ElbowsPigging Solutions
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking MenDelhi Call girls
 
Pigging Solutions in Pet Food Manufacturing
Pigging Solutions in Pet Food ManufacturingPigging Solutions in Pet Food Manufacturing
Pigging Solutions in Pet Food ManufacturingPigging Solutions
 
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticsKotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticscarlostorres15106
 
Benefits Of Flutter Compared To Other Frameworks
Benefits Of Flutter Compared To Other FrameworksBenefits Of Flutter Compared To Other Frameworks
Benefits Of Flutter Compared To Other FrameworksSoftradix Technologies
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationMichael W. Hawkins
 
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...HostedbyConfluent
 
Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Allon Mureinik
 
CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):comworks
 
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Patryk Bandurski
 
AI as an Interface for Commercial Buildings
AI as an Interface for Commercial BuildingsAI as an Interface for Commercial Buildings
AI as an Interface for Commercial BuildingsMemoori
 
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...shyamraj55
 
Understanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitectureUnderstanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitecturePixlogix Infotech
 

Recently uploaded (20)

Human Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsHuman Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR Systems
 
Unblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesUnblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen Frames
 
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
 
How to Remove Document Management Hurdles with X-Docs?
How to Remove Document Management Hurdles with X-Docs?How to Remove Document Management Hurdles with X-Docs?
How to Remove Document Management Hurdles with X-Docs?
 
Install Stable Diffusion in windows machine
Install Stable Diffusion in windows machineInstall Stable Diffusion in windows machine
Install Stable Diffusion in windows machine
 
Next-generation AAM aircraft unveiled by Supernal, S-A2
Next-generation AAM aircraft unveiled by Supernal, S-A2Next-generation AAM aircraft unveiled by Supernal, S-A2
Next-generation AAM aircraft unveiled by Supernal, S-A2
 
Pigging Solutions Piggable Sweeping Elbows
Pigging Solutions Piggable Sweeping ElbowsPigging Solutions Piggable Sweeping Elbows
Pigging Solutions Piggable Sweeping Elbows
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men
 
Pigging Solutions in Pet Food Manufacturing
Pigging Solutions in Pet Food ManufacturingPigging Solutions in Pet Food Manufacturing
Pigging Solutions in Pet Food Manufacturing
 
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticsKotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
 
Benefits Of Flutter Compared To Other Frameworks
Benefits Of Flutter Compared To Other FrameworksBenefits Of Flutter Compared To Other Frameworks
Benefits Of Flutter Compared To Other Frameworks
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day Presentation
 
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
 
Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)
 
CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):
 
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
 
Vulnerability_Management_GRC_by Sohang Sengupta.pptx
Vulnerability_Management_GRC_by Sohang Sengupta.pptxVulnerability_Management_GRC_by Sohang Sengupta.pptx
Vulnerability_Management_GRC_by Sohang Sengupta.pptx
 
AI as an Interface for Commercial Buildings
AI as an Interface for Commercial BuildingsAI as an Interface for Commercial Buildings
AI as an Interface for Commercial Buildings
 
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
 
Understanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitectureUnderstanding the Laravel MVC Architecture
Understanding the Laravel MVC Architecture
 

Mysql 5.5 and 5.6 replication

  • 1. What's new in MySQL 5.5 and 5.6 replication Giuseppe Maxia Continuent, Inc ©Continuent 2012. Tuesday, April 17, 12 1
  • 2. AGENDA • 5.5 • semi-synchronous replication • 5.6 • delayed replication • server UUID • crash-safe slave • multi-thread slave • Global transaction identi!ers ©Continuent 2012 2 Tuesday, April 17, 12 2
  • 3. DA AG EN semi-synch replication Tuesday, April 17, 12 3
  • 4. semi-synchronous replication • Available in 5.5 and higher • Makes sure that at least one slave has copied the data. • Increases reliability Tuesday, April 17, 12 4
  • 5. client master transaction 1 with regular commit replication execute 2 slave returns 4 to client binary log 3 5 replication 5 Tuesday, April 17, 12 5
  • 6. client transaction master 1 with semi- commit synchronous replication execute 2 slave 7 returns to client binary log 3 sends 4 transaction relay log 5 to slave gets 6 acknowledgement 6 Tuesday, April 17, 12 6
  • 7. semi-synchronous replication in practice • installation: • it’s a plugin. • Actually, two plugins Tuesday, April 17, 12 7
  • 8. semi-synch replication install # in the master plugin-load=rpl_semi_sync_master=semisync_master.so rpl_semi_sync_master_enabled=1 # in each slave plugin-load=rpl_semi_sync_slave=semisync_slave.so rpl_semi_sync_slave_enabled=1 # restar all servers Tuesday, April 17, 12 8
  • 9. semi-synch replication check # in the master show variables like 'rpl_semi%'; +------------------------------------+-------+ | Variable_name | Value | +------------------------------------+-------+ | rpl_semi_sync_master_enabled | ON | | rpl_semi_sync_master_timeout | 10000 | | rpl_semi_sync_master_trace_level | 32 | | rpl_semi_sync_master_wait_no_slave | ON | +------------------------------------+-------+ Tuesday, April 17, 12 9
  • 10. semi-synch replication check show status like "rpl_semi_%tx"; +-----------------------------+-------+ | variable_name | value | +-----------------------------+-------+ | RPL_SEMI_SYNC_MASTER_NO_TX | 0 | | RPL_SEMI_SYNC_MASTER_YES_TX | 0 | +-----------------------------+-------+ Tuesday, April 17, 12 10
  • 11. semi-synch replication test master> create table t1 ( i int); Query OK, 0 rows affected (0.01 sec) master> show status like "rpl_semi_%tx"; +-----------------------------+-------+ | Variable_name | Value | +-----------------------------+-------+ | Rpl_semi_sync_master_no_tx | 0 | | Rpl_semi_sync_master_yes_tx | 1 | +-----------------------------+-------+ Tuesday, April 17, 12 11
  • 12. disabling semi-synch # for each slave set global rpl_semi_sync_slave_enabled=0; stop slave io_thread; start slave io_thread; Tuesday, April 17, 12 12
  • 13. disabled semi-synch replication test master> insert into t1 values (1); Query OK, 1 row affected (10.00 sec) master> show status like "rpl_semi_%tx"; +-----------------------------+-------+ | Variable_name | Value | +-----------------------------+-------+ | Rpl_semi_sync_master_no_tx | 1 | | Rpl_semi_sync_master_yes_tx | 1 | +-----------------------------+-------+ 2 rows in set (0.00 sec) Tuesday, April 17, 12 13
  • 14. disabled semi-synch replication test master> insert into t1 values (2); Query OK, 1 row affected (0.01 sec) master> show status like "rpl_semi_%tx"; +-----------------------------+-------+ | Variable_name | Value | +-----------------------------+-------+ | Rpl_semi_sync_master_no_tx | 2 | | Rpl_semi_sync_master_yes_tx | 1 | +-----------------------------+-------+ 2 rows in set (0.00 sec) Tuesday, April 17, 12 14
  • 15. re-enabling semi-synch # in one slave set global rpl_semi_sync_slave_enabled=1; stop slave io_thread; start slave io_thread; Tuesday, April 17, 12 15
  • 16. reenabled semi-synch replication test master> insert into t1 values (3); Query OK, 1 row affected (0.01 sec) master> show status like "rpl_semi_%tx"; +-----------------------------+-------+ | Variable_name | Value | +-----------------------------+-------+ | Rpl_semi_sync_master_no_tx | 2 | | Rpl_semi_sync_master_yes_tx | 2 | +-----------------------------+-------+ 2 rows in set (0.00 sec) Tuesday, April 17, 12 16
  • 17. DA AG EN delayed replication Tuesday, April 17, 12 17
  • 18. delayed replication in practice STOP SLAVE; change master to master_delay=60; START SLAVE; SHOW SLAVE STATUSG (...) SQL_Delay: 60 SQL_Remaining_Delay: NULL Tuesday, April 17, 12 18
  • 19. delayed replication in practice master > use test; master > create table t2 (i int); SHOW SLAVE STATUSG (...) SQL_Delay: 60 SQL_Remaining_Delay: 55 slave> SHOW TABLES FROM test; +----------------+ | Tables_in_test | +----------------+ | t1 | +----------------+ Tuesday, April 17, 12 19
  • 20. delayed replication in practice # after 1 minute SHOW SLAVE STATUSG (...) SQL_Delay: 60 SQL_Remaining_Delay: NULL slave> SHOW TABLES FROM test; +----------------+ | Tables_in_test | +----------------+ | t1 | | t2 | +----------------+ Tuesday, April 17, 12 20
  • 21. DA AG EN Server UUID Tuesday, April 17, 12 21
  • 22. testing some replication make_replication_sandbox mysql-5.6.5-m8- osx10.7-.tar.gz .... .... replication directory installed in $HOME/sandboxes/rsandbox_mysql-5_6_5 Tuesday, April 17, 12 22
  • 23. testing some replication ~/sandboxes/rsandbox_mysql-5_6_5/s1 show slave statusG ******** 1. row *************************** Slave_IO_State: Waiting for master to send event Master_Host: 127.0.0.1 Master_User: rsandbox Master_Port: 12630 Connect_Retry: 60 Master_Log_File: mysql-bin.000001 Read_Master_Log_Pos: 2524 Relay_Log_File: mysql_sandbox12631- relay-bin.000002 Relay_Log_Pos: 2677 Relay_Master_Log_File: mysql-bin.000001 Slave_IO_Running: Yes Slave_SQL_Running: Yes Tuesday, April 17, 12 23
  • 24. testing some replication ~/sandboxes/rsandbox_mysql-5_6_5/s1 show slave statusG .... Master_Server_Id: 1 Master_UUID: be3c022a-726f-11e1-a26a-a64f991393aa Master_Info_File: /Users/gmax/sandboxes/ rsandbox_mysql-5_6_5/node1/data/master.info SQL_Delay: 0 SQL_Remaining_Delay: NULL Slave_SQL_Running_State: Slave has read all relay log; waiting for the slave I/O thread to update it Tuesday, April 17, 12 24
  • 25. DA AG EN crash safe slave Tuesday, April 17, 12 25
  • 26. uncovering replication features show variables like '%info%'; +---------------------------+----------------+ | Variable_name | Value | +---------------------------+----------------+ | master_info_repository | FILE | | relay_log_info_file | relay-log.info | | relay_log_info_repository | FILE | | sync_master_info | 0 | | sync_relay_log_info | 0 | +---------------------------+----------------+ show variables like '%worker%'; +------------------------+-------+ | Variable_name | Value | +------------------------+-------+ | slave_parallel_workers | 0 | +------------------------+-------+ Tuesday, April 17, 12 26
  • 27. uncovering replication features STOP SLAVE; set global master_info_repository='table'; Query OK, 0 rows affected (0.00 sec) slave1 [localhost] {msandbox} ((none)) > set global relay_log_info_repository='table'; Query OK, 0 rows affected (0.00 sec) slave1 [localhost] {msandbox} ((none)) > set global slave_parallel_workers=3; Query OK, 0 rows affected (0.00 sec) Tuesday, April 17, 12 27
  • 28. fixing replication tables use mysql; slave1 [localhost] {msandbox} (mysql) > alter table slave_master_info engine=innodb; Query OK, 1 row affected (0.01 sec) Records: 1 Duplicates: 0 Warnings: 0 slave1 [localhost] {msandbox} (mysql) > alter table slave_relay_log_info engine=innodb; Query OK, 1 row affected (0.01 sec) Records: 1 Duplicates: 0 Warnings: 0 slave1 [localhost] {msandbox} (mysql) > alter table slave_worker_info engine=innodb; Query OK, 0 rows affected (0.01 sec) Records: 0 Duplicates: 0 Warnings: 0 Tuesday, April 17, 12 28
  • 29. Look at the new features show slave statusG .... .... Master_UUID: be3c022a-726f-11e1-a26a- a64f991393aa Master_Info_File: mysql.slave_master_info Tuesday, April 17, 12 29
  • 30. Look at the new features select * from mysql.slave_master_infoG *************************** 1. row ****** Master_id: 101 Number_of_lines: 22 Master_log_name: mysql-bin.000001 Master_log_pos: 2524 Host: 127.0.0.1 User_name: rsandbox User_password: rsandbox Port: 12630 .... Heartbeat: 1800 Bind: Ignored_server_ids: 0 Uuid: be3c022a-726f-11e1-a26a-a64f991393aa Retry_count: 86400 Tuesday, April 17, 12 30
  • 31. Look at the new features select * from mysql.slave_relay_log_infoG *************************** 1. row *************** Master_id: 101 Number_of_lines: 6 Relay_log_name: ./mysql_sandbox12631-relay-bin. 000002 Relay_log_pos: 2677 Master_log_name: mysql-bin.000001 Master_log_pos: 2524 Sql_delay: 0 Number_of_workers: 3 Tuesday, April 17, 12 31
  • 32. Look at the new features select * from mysql.slave_worker_infoG ************** 3. row ********************* Master_id: 101 Worker_id: 2 Relay_log_name: ./mysql_sandbox12631-relay- bin.000003 Relay_log_pos: 1394 Master_log_name: mysql-bin.000001 Master_log_pos: 3651 Checkpoint_relay_log_name: ./mysql_sandbox12631-relay- bin.000003 Checkpoint_relay_log_pos: 1199 Checkpoint_master_log_name: mysql-bin.000001 Checkpoint_master_log_pos: 3456 Checkpoint_seqno: 0 Checkpoint_group_size: 64 Checkpoint_group_bitmap: Tuesday, April 17, 12 32
  • 33. DA AG EN multi-threaded slave Tuesday, April 17, 12 33
  • 34. facts about multiple threaded slave a.k.a. parallel replication • Requires MySQL 5.6 in both master and slave • Parallel replication with a 5.5 master will slow down replication • Data gets parallelized by schema Tuesday, April 17, 12 34
  • 35. enabling multi-threaded slave set global slave_parallel_workers=10; show variables like '%worker%'; +------------------------+-------+ | Variable_name | Value | +------------------------+-------+ | slave_parallel_workers | 10 | +------------------------+-------+ stop slave; start slave; Tuesday, April 17, 12 35
  • 36. DA AG EN global transaction identifier Tuesday, April 17, 12 36
  • 37. global transaction identifier • Requires MySQL 5.6 in both master and slave • requires all servers in the cluster to run these options: • log-bin • log-slave-updates • gtid-mode=ON • disable-gtid-unsafe-statements Tuesday, April 17, 12 37
  • 38. global transaction identifier issues • Can't work with: • non-transactional updates. • temporary tables within transactions • CREATE TABLE ... SELECT • disable-gtid-unsafe-statements will make the server fail on any of the above cases. Tuesday, April 17, 12 38
  • 39. enabling global transaction identifiers # change my.cnf in ALL nodes # (master and slaves) [mysqld] log-bin log-slave-updates gtid-mode=ON disable-gtid-unsafe-statements # restart the servers Tuesday, April 17, 12 39
  • 40. testing global transaction identifiers create table t1 (i int not null primary key); show binlog eventsG ********* 3. row *************************** Log_name: mysql-bin.000002 Pos: 147 Event_type: Gtid Server_id: 1 End_log_pos: 191 Info: SET @@SESSION.GTID_NEXT='44556A96-8417-11E1-9589-2BD5ACDD51FD:1' ********* 4. row *************************** Log_name: mysql-bin.000002 Pos: 191 Event_type: Query Server_id: 1 End_log_pos: 305 Info: use `test`; create table t1 (i int not null primary key) Tuesday, April 17, 12 40
  • 41. testing global transaction identifiers SHOW SLAVE STATUSG (...) Retrieved_Gtid_Set: 44556A96-8417-11E1-9589-2BD5ACDD51FD:1-2 Executed_Gtid_Set: 44556A96-8417-11E1-9589-2BD5ACDD51FD:1-2 Tuesday, April 17, 12 41
  • 43. ADVERTISING ©Continuent 2012 43 Tuesday, April 17, 12 43
  • 44. WE ARE HIRING! • Cluster implementation engineer • QA engineer • Documentation writer http://www.continuent.com/about/careers ©Continuent 2012 44 Tuesday, April 17, 12 44