环境 RedHat6.5 64位 IP MySQL5.7 9.1.8.155 /usr/local/mysql 9.1.8.154
环境
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 = mysqlport = 3306server_id = 1socket=/data/mysql/mysql.sockbasedir =/usr/local/mysql #安装目录datadir =/data/mysql #数据仓库地址lower_case_table_names=1log-bin = mysql-bin### ---------------db that need replicatebinlog_do_db = zdhtst1replicate-do-db = zdhtst1binlog_do_db = zdhtst2replicate-do-db = zdhtst2binlog_do_db = jeecgreplicate-do-db = jeecg### ---------------db that need replicatebinlog-ignore-db = mysqlreplicate-ignore-db = mysql#auto-increment-increment = 2#auto-increment-offset = 2
[root@zdhhadba ~]# mysql -uroot -p111111 -S /data/mysql/mysql.sockmysql: [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 1427861Server 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 itsaffiliates. Other names may be trademarks of their respectiveowners.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: 0Master_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: mysqlExecuted_Gtid_Set: 1 row in set (0.00 sec)
9.1.8.154 配置
[root@zdhhadbb ~]# cat /etc/my.cnf [mysqld]user = mysqlport = 3306server_id = 2socket=/data/mysql/mysql.sockbasedir =/usr/local/mysql #安装目录datadir =/data/mysql #数据仓库地址lower_case_table_names=1log-bin = mysql-bin### ---------------db that need replicatebinlog_do_db = zdhtst1replicate-do-db = zdhtst1binlog_do_db = zdhtst2replicate-do-db = zdhtst2binlog_do_db = jeecgreplicate-do-db = jeecg### ---------------db that need replicatebinlog-ignore-db = mysqlreplicate-ignore-db = mysql#auto-increment-increment = 2#auto-increment-offset = 2
[root@zdhhadbb ~]# mysql -uroot -pmusingtec -S /data/mysql/mysql.sockmysql: [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 1427672Server 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 itsaffiliates. Other names may be trademarks of their respectiveowners.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: 0Master_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: mysqlExecuted_Gtid_Set: 1 row in set (0.00 sec)mysql>