Last active
June 8, 2019 20:41
-
-
Save datacharmer/59ea7d3a4f49cb2f38dcbe6924283944 to your computer and use it in GitHub Desktop.
sample master-master setup
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # Configuration node 1 | |
| [mysqld] | |
| user = gmax | |
| port = 25617 | |
| socket = /tmp/mysql_sandbox25617.sock | |
| basedir = /home/gmax/opt/mysql/8.0.16 | |
| datadir = /home/gmax/sandboxes/multi_msb_8_0_16/node1/data | |
| tmpdir = /home/gmax/sandboxes/multi_msb_8_0_16/node1/tmp | |
| pid-file = /home/gmax/sandboxes/multi_msb_8_0_16/node1/data/mysql_sandbox25617.pid | |
| bind-address = 127.0.0.1 | |
| report-host = node-1 | |
| report-port=25617 | |
| log-error=/home/gmax/sandboxes/multi_msb_8_0_16/node1/data/msandbox.err | |
| server-id=100 | |
| relay-log-index=mysql-relay | |
| relay-log=mysql-relay | |
| log-bin=mysql-bin# basic replication options | |
| relay-log-index=mysql-relay | |
| relay-log=mysql-relay | |
| log-bin=mysql-bin | |
| auto-increment-increment=3 | |
| auto-increment-offset=10 | |
| log-slave-updates | |
| mysqlx-port=35617 | |
| mysqlx-socket=/tmp/mysqlx-35617.sock | |
| # -------------- | |
| # Configuration node 2 | |
| [mysqld] | |
| user = gmax | |
| port = 25618 | |
| socket = /tmp/mysql_sandbox25618.sock | |
| basedir = /home/gmax/opt/mysql/8.0.16 | |
| datadir = /home/gmax/sandboxes/multi_msb_8_0_16/node2/data | |
| tmpdir = /home/gmax/sandboxes/multi_msb_8_0_16/node2/tmp | |
| pid-file = /home/gmax/sandboxes/multi_msb_8_0_16/node2/data/mysql_sandbox25618.pid | |
| bind-address = 127.0.0.1 | |
| report-host = node-2 | |
| report-port=25618 | |
| log-error=/home/gmax/sandboxes/multi_msb_8_0_16/node2/data/msandbox.err | |
| server-id=200 | |
| relay-log-index=mysql-relay | |
| relay-log=mysql-relay | |
| log-bin=mysql-bin | |
| auto-increment-increment=3 | |
| auto-increment-offset=10 | |
| log-slave-updates | |
| mysqlx-port=35618 | |
| mysqlx-socket=/tmp/mysqlx-35618.sock | |
| # -------------- | |
| # Execute in node 1 | |
| # Connecting to /home/gmax/sandboxes/multi_msb_8_0_16/node2 | |
| # -------------- | |
| CHANGE MASTER TO master_host="127.0.0.1", | |
| master_port=25618, | |
| master_user="rsandbox", | |
| master_password="rsandbox" | |
| , master_log_file="mysql-bin.000001", master_log_pos=7883, GET_MASTER_PUBLIC_KEY=1 | |
| # Execute in node2 | |
| # Connecting to /home/gmax/sandboxes/multi_msb_8_0_16/node1 | |
| # -------------- | |
| CHANGE MASTER TO master_host="127.0.0.1", | |
| master_port=25617, | |
| master_user="rsandbox", | |
| master_password="rsandbox" | |
| , master_log_file="mysql-bin.000001", master_log_pos=7884, GET_MASTER_PUBLIC_KEY=1 | |
| # See status node 2: | |
| ~/sandboxes/multi_msb_8_0_16/n2 -e 'SHOW SLAVE STATUS\G' | grep "\(Running:\|Master_Log_Pos\|\<Master_Log_File\|Retrieved\|Executed\|Auto_Position\|Master_User\|Master_Port\|Master_Host\)" | |
| Master_Host: 127.0.0.1 | |
| Master_User: rsandbox | |
| Master_Port: 25617 | |
| Master_Log_File: mysql-bin.000001 | |
| Read_Master_Log_Pos: 10099 | |
| Slave_IO_Running: Yes | |
| Slave_SQL_Running: Yes | |
| Exec_Master_Log_Pos: 10099 | |
| Retrieved_Gtid_Set: | |
| Executed_Gtid_Set: | |
| Auto_Position: 0 | |
| # See status node 1 | |
| $ ~/sandboxes/multi_msb_8_0_16/n1 -e 'SHOW SLAVE STATUS\G' | grep "\(Running:\|Master_Log_Pos\|\<Master_Log_File\|Retrieved\|Executed\|Auto_Position\|Master_User\|Master_Port\|Master_Host\)" | |
| Master_Host: 127.0.0.1 | |
| Master_User: rsandbox | |
| Master_Port: 25618 | |
| Master_Log_File: mysql-bin.000001 | |
| Read_Master_Log_Pos: 10098 | |
| Slave_IO_Running: Yes | |
| Slave_SQL_Running: Yes | |
| Exec_Master_Log_Pos: 10098 | |
| Retrieved_Gtid_Set: | |
| Executed_Gtid_Set: | |
| Auto_Position: 0 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment