// setup m1->m2->s1 -- conf file used [umshastr@hod03]/export/umesh/server/binaries/mysql-5.6.26: cat m1.cnf m2.cnf s1.cnf #Master [mysqld] pid-file = /export/umesh/server/binaries/mysql-5.6.26/run/master.pid socket = /export/umesh/server/binaries/mysql-5.6.26/run/master.sock log-error=/export/umesh/server/binaries/mysql-5.6.26/log/master.log slow_query_log_file=/export/umesh/server/binaries/mysql-5.6.26/log/slow.log general_log_file=/export/umesh/server/binaries/mysql-5.6.26/log/general.log port = 15000 server-id = 1 basedir = /export/umesh/server/binaries/mysql-5.6.26 datadir = /export/umesh/server/binaries/mysql-5.6.26/master tmpdir = /tmp log-bin = /export/umesh/server/binaries/mysql-5.6.26/log/master-bin log-bin-index = /export/umesh/server/binaries/mysql-5.6.26/log/master-bin.index binlog_format=MIXED #Slave 1 ---max-relay-log-size=6990506 --relay-log-info-repository=TABLE [mysqld] pid-file = /export/umesh/server/binaries/mysql-5.6.26/run/slave.pid socket = /export/umesh/server/binaries/mysql-5.6.26/run/slave.sock log-error=/export/umesh/server/binaries/mysql-5.6.26/log/slave.log port = 15001 server-id = 2 basedir = /export/umesh/server/binaries/mysql-5.6.26 datadir = /export/umesh/server/binaries/mysql-5.6.26/slave tmpdir = /tmp relay-log-index = /export/umesh/server/binaries/mysql-5.6.26/log/slave-relay-bin.index relay-log = /export/umesh/server/binaries/mysql-5.6.26/log/slave-relay-bin binlog_format=MIXED log-bin = /export/umesh/server/binaries/mysql-5.6.26/log/slave-bin log-bin-index = /export/umesh/server/binaries/mysql-5.6.26/log/slave-bin.index log_slave_updates=ON log_slow_slave_statements=ON slow_query_log=ON long_query_time=0 #Slave 2 [mysqld] pid-file = /export/umesh/server/binaries/mysql-5.6.26/run/slave1.pid socket = /export/umesh/server/binaries/mysql-5.6.26/run/slave1.sock log-error=/export/umesh/server/binaries/mysql-5.6.26/log/slave1.log port = 15002 server-id = 3 basedir = /export/umesh/server/binaries/mysql-5.6.26 datadir = /export/umesh/server/binaries/mysql-5.6.26/slave1 tmpdir = /tmp relay-log-index = /export/umesh/server/binaries/mysql-5.6.26/log/slave1-relay-bin.index relay-log = /export/umesh/server/binaries/mysql-5.6.26/log/slave1-relay-bin binlog_format=STATEMENT log_slow_slave_statements=ON slow_query_log=ON long_query_time=0 [umshastr@hod03]/export/umesh/server/binaries/mysql-5.6.26: bin/mysqld_safe --defaults-file=./m1.cnf & [umshastr@hod03]/export/umesh/server/binaries/mysql-5.6.26: bin/mysqld_safe --defaults-file=./m2.cnf --max-relay-log-size=6990506 --relay-log-info-repository=TABLE & [umshastr@hod03]/export/umesh/server/binaries/mysql-5.6.26: bin/mysqld_safe --defaults-file=./s1.cnf & [umshastr@hod03]/export/umesh/server/binaries/mysql-5.6.26: ps aux|grep mysqld_safe umshastr 24095 0.0 0.0 113236 1604 pts/1 S 12:11 0:00 /bin/sh bin/mysqld_safe --defaults-file=./m1.cnf umshastr 24670 0.0 0.0 113236 1616 pts/1 S 12:12 0:00 /bin/sh bin/mysqld_safe --defaults-file=./m2.cnf --max-relay-log-size=6990506 --relay-log-info-repository=TABLE umshastr 24995 0.0 0.0 113236 1600 pts/1 S 12:12 0:00 /bin/sh bin/mysqld_safe --defaults-file=./s1.cnf umshastr 25256 0.0 0.0 112628 972 pts/1 S+ 12:13 0:00 grep --color=auto mysqld_safe -- m1 [umshastr@hod03]/export/umesh/server/binaries/mysql-5.6.26: bin/mysql -uroot -S /export/umesh/server/binaries/mysql-5.6.26/run/master.sock --prompt="m1>" Welcome to the MySQL monitor. Commands end with ; or \g. Your MySQL connection id is 5 Server version: 5.6.26-log MySQL Community Server (GPL) Copyright (c) 2000, 2015, Oracle and/or its affiliates. All rights reserved. Oracle is a registered trademark of Oracle Corporation and/or its affiliates. Other names may be trademarks of their respective owners. Type 'help;' or '\h' for help. Type '\c' to clear the current input statement. m1>CREATE USER 'repl'@'localhost' IDENTIFIED BY 'slavepass'; Query OK, 0 rows affected (0.00 sec) m1>GRANT REPLICATION SLAVE ON *.* TO 'repl'@'localhost'; Query OK, 0 rows affected (0.00 sec) m1> m1>CREATE USER 'repl'@'127.0.0.1' IDENTIFIED BY 'slavepass'; Query OK, 0 rows affected (0.00 sec) m1>GRANT REPLICATION SLAVE ON *.* TO 'repl'@'127.0.0.1'; Query OK, 0 rows affected (0.00 sec) m1>FLUSH PRIVILEGES; Query OK, 0 rows affected (0.00 sec) m1>show master status; +-------------------+----------+--------------+------------------+-------------------+ | File | Position | Binlog_Do_DB | Binlog_Ignore_DB | Executed_Gtid_Set | +-------------------+----------+--------------+------------------+-------------------+ | master-bin.000003 | 813 | | | | +-------------------+----------+--------------+------------------+-------------------+ 1 row in set (0.00 sec) m1> -- m2 [umshastr@hod03]/export/umesh/server/binaries/mysql-5.6.26: bin/mysql -uroot -S /export/umesh/server/binaries/mysql-5.6.26/run/slave.sock --prompt="m2>" Welcome to the MySQL monitor. Commands end with ; or \g. Your MySQL connection id is 2 Server version: 5.6.26-log MySQL Community Server (GPL) Copyright (c) 2000, 2015, Oracle and/or its affiliates. All rights reserved. Oracle is a registered trademark of Oracle Corporation and/or its affiliates. Other names may be trademarks of their respective owners. Type 'help;' or '\h' for help. Type '\c' to clear the current input statement. m2>CREATE USER 'repl'@'localhost' IDENTIFIED BY 'slavepass'; Query OK, 0 rows affected (0.00 sec) m2>GRANT REPLICATION SLAVE ON *.* TO 'repl'@'localhost'; Query OK, 0 rows affected (0.00 sec) m2> m2>CREATE USER 'repl'@'127.0.0.1' IDENTIFIED BY 'slavepass'; Query OK, 0 rows affected (0.00 sec) m2>GRANT REPLICATION SLAVE ON *.* TO 'repl'@'127.0.0.1'; Query OK, 0 rows affected (0.00 sec) m2>FLUSH PRIVILEGES; Query OK, 0 rows affected (0.00 sec) m2>CHANGE MASTER TO -> MASTER_HOST='localhost', -> MASTER_PORT=15000, -> MASTER_USER='repl', -> MASTER_PASSWORD='slavepass', -> MASTER_LOG_FILE='master-bin.000003', -> MASTER_LOG_POS=813; Query OK, 0 rows affected, 2 warnings (0.00 sec) m2>start slave; Query OK, 0 rows affected (0.00 sec) m2>show slave status\G *************************** 1. row *************************** Slave_IO_State: Waiting for master to send event Master_Host: localhost Master_User: repl Master_Port: 15000 Connect_Retry: 60 Master_Log_File: master-bin.000003 Read_Master_Log_Pos: 813 Relay_Log_File: slave-relay-bin.000002 Relay_Log_Pos: 284 Relay_Master_Log_File: master-bin.000003 Slave_IO_Running: Yes Slave_SQL_Running: Yes Replicate_Do_DB: Replicate_Ignore_DB: Replicate_Do_Table: Replicate_Ignore_Table: Replicate_Wild_Do_Table: Replicate_Wild_Ignore_Table: Last_Errno: 0 Last_Error: Skip_Counter: 0 Exec_Master_Log_Pos: 813 Relay_Log_Space: 457 Until_Condition: None Until_Log_File: Until_Log_Pos: 0 Master_SSL_Allowed: No Master_SSL_CA_File: Master_SSL_CA_Path: Master_SSL_Cert: Master_SSL_Cipher: Master_SSL_Key: Seconds_Behind_Master: 0 Master_SSL_Verify_Server_Cert: No Last_IO_Errno: 0 Last_IO_Error: Last_SQL_Errno: 0 Last_SQL_Error: Replicate_Ignore_Server_Ids: Master_Server_Id: 1 Master_UUID: b67a57fd-41a3-11e5-b98c-0010e05f3e06 Master_Info_File: /export/umesh/server/binaries/mysql-5.6.26/slave/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 Master_Retry_Count: 86400 Master_Bind: Last_IO_Error_Timestamp: Last_SQL_Error_Timestamp: Master_SSL_Crl: Master_SSL_Crlpath: Retrieved_Gtid_Set: Executed_Gtid_Set: Auto_Position: 0 1 row in set (0.00 sec) m2> m2>show master status; +------------------+----------+--------------+------------------+-------------------+ | File | Position | Binlog_Do_DB | Binlog_Ignore_DB | Executed_Gtid_Set | +------------------+----------+--------------+------------------+-------------------+ | slave-bin.000003 | 813 | | | | +------------------+----------+--------------+------------------+-------------------+ 1 row in set (0.00 sec) -- s1 [umshastr@hod03]/export/umesh/server/binaries/mysql-5.6.26: bin/mysql -uroot -S /export/umesh/server/binaries/mysql-5.6.26/run/slave1.sock --prompt="s1>" Welcome to the MySQL monitor. Commands end with ; or \g. Your MySQL connection id is 2 Server version: 5.6.26-log MySQL Community Server (GPL) Copyright (c) 2000, 2015, Oracle and/or its affiliates. All rights reserved. Oracle is a registered trademark of Oracle Corporation and/or its affiliates. Other names may be trademarks of their respective owners. Type 'help;' or '\h' for help. Type '\c' to clear the current input statement. s1>CHANGE MASTER TO -> MASTER_HOST='localhost', -> MASTER_PORT=15001, -> MASTER_USER='repl', -> MASTER_PASSWORD='slavepass', -> MASTER_LOG_FILE='slave-bin.000003', -> MASTER_LOG_POS=813; Query OK, 0 rows affected, 2 warnings (0.01 sec) s1>start slave; Query OK, 0 rows affected (0.00 sec) s1>show slave status\G *************************** 1. row *************************** Slave_IO_State: Waiting for master to send event Master_Host: localhost Master_User: repl Master_Port: 15001 Connect_Retry: 60 Master_Log_File: slave-bin.000003 Read_Master_Log_Pos: 813 Relay_Log_File: slave1-relay-bin.000002 Relay_Log_Pos: 283 Relay_Master_Log_File: slave-bin.000003 Slave_IO_Running: Yes Slave_SQL_Running: Yes Replicate_Do_DB: Replicate_Ignore_DB: Replicate_Do_Table: Replicate_Ignore_Table: Replicate_Wild_Do_Table: Replicate_Wild_Ignore_Table: Last_Errno: 0 Last_Error: Skip_Counter: 0 Exec_Master_Log_Pos: 813 Relay_Log_Space: 457 Until_Condition: None Until_Log_File: Until_Log_Pos: 0 Master_SSL_Allowed: No Master_SSL_CA_File: Master_SSL_CA_Path: Master_SSL_Cert: Master_SSL_Cipher: Master_SSL_Key: Seconds_Behind_Master: 0 Master_SSL_Verify_Server_Cert: No Last_IO_Errno: 0 Last_IO_Error: Last_SQL_Errno: 0 Last_SQL_Error: Replicate_Ignore_Server_Ids: Master_Server_Id: 2 Master_UUID: d5152e69-41a3-11e5-b98d-0010e05f3e06 Master_Info_File: /export/umesh/server/binaries/mysql-5.6.26/slave1/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 Master_Retry_Count: 86400 Master_Bind: Last_IO_Error_Timestamp: Last_SQL_Error_Timestamp: Master_SSL_Crl: Master_SSL_Crlpath: Retrieved_Gtid_Set: Executed_Gtid_Set: Auto_Position: 0 1 row in set (0.00 sec) ## Create schema on m1 and confirm that it is replicated on rest 2 instances -- m1 m1>create database test_db; Query OK, 1 row affected (0.00 sec) m1>use test_db; Database changed m1>CREATE TABLE a ( a int) ENGINE=InnoDB; Query OK, 0 rows affected (0.01 sec) -- m2 m2>use test_db Reading table information for completion of table and column names You can turn off this feature to get a quicker startup with -A Database changed m2>show tables; +-------------------+ | Tables_in_test_db | +-------------------+ | a | +-------------------+ 1 row in set (0.00 sec) -- s1 s1>use test_db Reading table information for completion of table and column names You can turn off this feature to get a quicker startup with -A Database changed s1>show tables; +-------------------+ | Tables_in_test_db | +-------------------+ | a | +-------------------+ 1 row in set (0.00 sec) ## [umshastr@hod03]/export/umesh/server/binaries/mysql-5.6.26: bash -c 'seq 2000000 > /tmp/test.csv' [umshastr@hod03]/export/umesh/server/binaries/mysql-5.6.26: wc -l /tmp/test.csv 2000000 /tmp/test.csv [umshastr@hod03]/export/umesh/server/binaries/mysql-5.6.26: -- m1 m1>LOAD DATA CONCURRENT LOCAL INFILE '/tmp/test.csv' INTO TABLE a FIELDS TERMINATED BY '\t' LINES TERMINATED BY '\n'; Query OK, 2000000 rows affected (7.04 sec) Records: 2000000 Deleted: 0 Skipped: 0 Warnings: 0 m1>select count(*) from test_db.a; +----------+ | count(*) | +----------+ | 2000000 | +----------+ 1 row in set (0.62 sec) -- m2 m2>select count(*) from test_db.a; +----------+ | count(*) | +----------+ | 2000000 | +----------+ 1 row in set (0.62 sec) m2>show slave status\G *************************** 1. row *************************** Slave_IO_State: Waiting for master to send event Master_Host: localhost Master_User: repl Master_Port: 15000 Connect_Retry: 60 Master_Log_File: master-bin.000003 Read_Master_Log_Pos: 10043991 Relay_Log_File: slave-relay-bin.000003 Relay_Log_Pos: 3052107 Relay_Master_Log_File: master-bin.000003 Slave_IO_Running: Yes Slave_SQL_Running: Yes Replicate_Do_DB: Replicate_Ignore_DB: Replicate_Do_Table: Replicate_Ignore_Table: Replicate_Wild_Do_Table: Replicate_Wild_Ignore_Table: Last_Errno: 0 Last_Error: Skip_Counter: 0 Exec_Master_Log_Pos: 10043991 Relay_Log_Space: 10043751 Until_Condition: None Until_Log_File: Until_Log_Pos: 0 Master_SSL_Allowed: No Master_SSL_CA_File: Master_SSL_CA_Path: Master_SSL_Cert: Master_SSL_Cipher: Master_SSL_Key: Seconds_Behind_Master: 0 Master_SSL_Verify_Server_Cert: No Last_IO_Errno: 0 Last_IO_Error: Last_SQL_Errno: 0 Last_SQL_Error: Replicate_Ignore_Server_Ids: Master_Server_Id: 1 Master_UUID: b67a57fd-41a3-11e5-b98c-0010e05f3e06 Master_Info_File: /export/umesh/server/binaries/mysql-5.6.26/slave/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 Master_Retry_Count: 86400 Master_Bind: Last_IO_Error_Timestamp: Last_SQL_Error_Timestamp: Master_SSL_Crl: Master_SSL_Crlpath: Retrieved_Gtid_Set: Executed_Gtid_Set: Auto_Position: 0 1 row in set (0.00 sec) -- s1 s1>select count(*) from test_db.a; +----------+ | count(*) | +----------+ | 1392236 | +----------+ 1 row in set (0.43 sec) s1>show slave status\G *************************** 1. row *************************** Slave_IO_State: Waiting for master to send event Master_Host: localhost Master_User: repl Master_Port: 15001 Connect_Retry: 60 Master_Log_File: slave-bin.000003 Read_Master_Log_Pos: 6992139 Relay_Log_File: slave1-relay-bin.000002 Relay_Log_Pos: 6991609 Relay_Master_Log_File: slave-bin.000003 Slave_IO_Running: Yes Slave_SQL_Running: Yes Replicate_Do_DB: Replicate_Ignore_DB: Replicate_Do_Table: Replicate_Ignore_Table: Replicate_Wild_Do_Table: Replicate_Wild_Ignore_Table: Last_Errno: 0 Last_Error: Skip_Counter: 0 Exec_Master_Log_Pos: 6992139 Relay_Log_Space: 6991783 Until_Condition: None Until_Log_File: Until_Log_Pos: 0 Master_SSL_Allowed: No Master_SSL_CA_File: Master_SSL_CA_Path: Master_SSL_Cert: Master_SSL_Cipher: Master_SSL_Key: Seconds_Behind_Master: 0 Master_SSL_Verify_Server_Cert: No Last_IO_Errno: 0 Last_IO_Error: Last_SQL_Errno: 0 Last_SQL_Error: Replicate_Ignore_Server_Ids: Master_Server_Id: 2 Master_UUID: d5152e69-41a3-11e5-b98d-0010e05f3e06 Master_Info_File: /export/umesh/server/binaries/mysql-5.6.26/slave1/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 Master_Retry_Count: 86400 Master_Bind: Last_IO_Error_Timestamp: Last_SQL_Error_Timestamp: Master_SSL_Crl: Master_SSL_Crlpath: Retrieved_Gtid_Set: Executed_Gtid_Set: Auto_Position: 0 1 row in set (0.00 sec)