mysql 5.7 双主配置_MySQL5.7.18 双主配置
環境
RedHat6.5 64位
IP
MySQL5.7
9.1.8.155
/usr/local/mysql
9.1.8.154
/usr/local/mysql
9.1.8.155 配置
[root@zdhhadba ~]# cat /etc/my.cnf
[mysqld]
user = mysql
port = 3306
server_id = 1
socket=/data/mysql/mysql.sock
basedir =/usr/local/mysql #安裝目錄
datadir =/data/mysql #數據倉庫地址
lower_case_table_names=1
log-bin = mysql-bin
### ---------------db that need replicate
binlog_do_db = zdhtst1
replicate-do-db = zdhtst1
binlog_do_db = zdhtst2
replicate-do-db = zdhtst2
binlog_do_db = jeecg
replicate-do-db = jeecg
### ---------------db that need replicate
binlog-ignore-db = mysql
replicate-ignore-db = mysql
#auto-increment-increment = 2
#auto-increment-offset = 2
[root@zdhhadba ~]# mysql -uroot -p111111 -S /data/mysql/mysql.sock
mysql: [Warning] Using a password on the command line interface can be insecure.
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 1427861
Server version: 5.7.18-log MySQL Community Server (GPL)
Copyright (c) 2000, 2017, 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.
mysql> show slave status\G
*************************** 1. row ***************************
Slave_IO_State: Waiting for master to send event
Master_Host: 9.1.8.155
Master_User: repl
Master_Port: 3306
Connect_Retry: 60
Master_Log_File: mysql-bin.000003
Read_Master_Log_Pos: 154
Relay_Log_File: zdhhadba-relay-bin.000007
Relay_Log_Pos: 367
Relay_Master_Log_File: mysql-bin.000003
Slave_IO_Running: Yes
Slave_SQL_Running: Yes
Replicate_Do_DB: zdhtst1,zdhtst2,jeecg
Replicate_Ignore_DB: mysql
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: 154
Relay_Log_Space: 743
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: f6a093d2-4119-11e7-a20d-005056aa3bf3
Master_Info_File: /data/mysql/master.info
SQL_Delay: 0
SQL_Remaining_Delay: NULL
Slave_SQL_Running_State: Slave has read all relay log; waiting for more updates
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
Replicate_Rewrite_DB:
Channel_Name:
Master_TLS_Version:
1 row in set (0.00 sec)
mysql> show master status\G
*************************** 1. row ***************************
File: mysql-bin.000003
Position: 37332794
Binlog_Do_DB: zdhtst1,zdhtst2,jeecg
Binlog_Ignore_DB: mysql
Executed_Gtid_Set:
1 row in set (0.00 sec)
9.1.8.154 配置
[root@zdhhadbb ~]# cat /etc/my.cnf
[mysqld]
user = mysql
port = 3306
server_id = 2
socket=/data/mysql/mysql.sock
basedir =/usr/local/mysql #安裝目錄
datadir =/data/mysql #數據倉庫地址
lower_case_table_names=1
log-bin = mysql-bin
### ---------------db that need replicate
binlog_do_db = zdhtst1
replicate-do-db = zdhtst1
binlog_do_db = zdhtst2
replicate-do-db = zdhtst2
binlog_do_db = jeecg
replicate-do-db = jeecg
### ---------------db that need replicate
binlog-ignore-db = mysql
replicate-ignore-db = mysql
#auto-increment-increment = 2
#auto-increment-offset = 2
[root@zdhhadbb ~]# mysql -uroot -pmusingtec -S /data/mysql/mysql.sock
mysql: [Warning] Using a password on the command line interface can be insecure.
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 1427672
Server version: 5.7.18-log MySQL Community Server (GPL)
Copyright (c) 2000, 2017, 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.
mysql> show slave status\G
*************************** 1. row ***************************
Slave_IO_State: Waiting for master to send event
Master_Host: 9.1.8.154
Master_User: repl
Master_Port: 3306
Connect_Retry: 60
Master_Log_File: mysql-bin.000003
Read_Master_Log_Pos: 37332794
Relay_Log_File: zdhhadbb-relay-bin.000006
Relay_Log_Pos: 37333007
Relay_Master_Log_File: mysql-bin.000003
Slave_IO_Running: Yes
Slave_SQL_Running: Yes
Replicate_Do_DB: zdhtst1,zdhtst2,jeecg
Replicate_Ignore_DB: mysql
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: 37332794
Relay_Log_Space: 38749550
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: e8bda496-4119-11e7-bc47-005056aa2bfe
Master_Info_File: /data/mysql/master.info
SQL_Delay: 0
SQL_Remaining_Delay: NULL
Slave_SQL_Running_State: Slave has read all relay log; waiting for more updates
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
Replicate_Rewrite_DB:
Channel_Name:
Master_TLS_Version:
1 row in set (0.00 sec)
mysql> show master status\G
*************************** 1. row ***************************
File: mysql-bin.000003
Position: 154
Binlog_Do_DB: zdhtst1,zdhtst2,jeecg
Binlog_Ignore_DB: mysql
Executed_Gtid_Set:
1 row in set (0.00 sec)
mysql>
總結
以上是生活随笔為你收集整理的mysql 5.7 双主配置_MySQL5.7.18 双主配置的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: mysql command为sleep时
- 下一篇: 电脑不小心删除的文件怎么恢复如何恢复电脑