Description:
I am using the Master-Master Replication concept. Suppose that the Master 1 is A and Master 2 is B.
I have completed some configurations like setting server id, enabling log_bin and setting binlog_do_db (since we are going to replicate only a single database). Using the SQL command for changing the master, bin log, and position, I have set the changes at both the ends. And with this Master Master Replication has been implemented and I am able to see the changes done at either of the side.
Problem :
After changing/updating any table in database on either side the MASTER_LOG_POS changes
However the MASTER_LOG_FILE remains the same in both ends.
Since the MASTER_LOG_POS changes at both the ends, we are NOT ABLE to get the replication successfully.
How to repeat:
SHOW SLAVE STATUS; SHOW MASTER STATUS; -- on each machine
Do some INSERT or UPDATE.
SHOW SLAVE STATUS; SHOW MASTER STATUS; -- on each machine (again)
------------------ Master 1 Status ----------------------
mysql> show master status;
+------------------+----------+----------------+------------------+
| File | Position | Binlog_Do_DB | Binlog_Ignore_DB |
+------------------+----------+----------------+------------------+
| mysql-bin.000004 | 107 | rex_posdb | |
+------------------+----------+----------------+------------------+
1 row in set (0.00 sec)
mysql> show slave status\G;
*************************** 1. row ***************************
Slave_IO_State: Waiting for master to send event
Master_Host: rex.com
Master_User: slave_users
Master_Port: 3306
Connect_Retry: 60
Master_Log_File: mysql-bin.000019
Read_Master_Log_Pos: 4590
Relay_Log_File: user-home-relay-bin.000006
Relay_Log_Pos: 253
Relay_Master_Log_File: mysql-bin.000019
Slave_IO_Running: Yes
Slave_SQL_Running: No
Replicate_Do_DB:
Replicate_Ignore_DB:
Replicate_Do_Table:
Replicate_Ignore_Table:
Replicate_Wild_Do_Table:
Replicate_Wild_Ignore_Table:
Last_Errno: 1269
Last_Error: Error 'Can't revoke all privileges for one or mor
e of the requested users' on query. Default database: ''. Query: 'REVOKE ALL PRI
VILEGES, GRANT OPTION FROM 'horde'@'localhost''
Skip_Counter: 0
Exec_Master_Log_Pos: 3603
Relay_Log_Space: 1706
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: NULL
Master_SSL_Verify_Server_Cert: No
Last_IO_Errno: 0
Last_IO_Error:
Last_SQL_Errno: 1269
Last_SQL_Error: Error 'Can't revoke all privileges for one or mor
e of the requested users' on query. Default database: ''. Query: 'REVOKE ALL PRI
VILEGES, GRANT OPTION FROM 'horde'@'localhost''
Replicate_Ignore_Server_Ids:
Master_Server_Id: 1391195877
1 row in set (0.00 sec)
After Update/Insert
mysql> show master status;
+------------------+----------+----------------+------------------+
| File | Position | Binlog_Do_DB | Binlog_Ignore_DB |
+------------------+----------+----------------+------------------+
| mysql-bin.000004 | 516 | rex_posdb | |
+------------------+----------+----------------+------------------+
1 row in set (0.00 sec)
------------------ Master 2 Status ----------------------
mysql> show master status;
+------------------+----------+----------------+------------------+
| File | Position | Binlog_Do_DB | Binlog_Ignore_DB |
+------------------+----------+----------------+------------------+
| mysql-bin.000019 | 4590 | rex_posdb | |
+------------------+----------+----------------+------------------+
1 row in set (0.00 sec)
mysql> show slave status\G;
*************************** 1. row ***************************
Slave_IO_State: Waiting for master to send event
Master_Host: 59.177.113.206
Master_User: rex_slave
Master_Port: 3306
Connect_Retry: 60
Master_Log_File: mysql-bin.000004
Read_Master_Log_Pos: 107
Relay_Log_File: server-relay-bin.000006
Relay_Log_Pos: 253
Relay_Master_Log_File: mysql-bin.000004
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: 107
Relay_Log_Space: 556
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: 145454345
1 row in set (0.00 sec)
ERROR:
No query specified
After Update/Insert
+------------------+----------+----------------+------------------+
| File | Position | Binlog_Do_DB | Binlog_Ignore_DB |
+------------------+----------+----------------+------------------+
| mysql-bin.000019 | 4999 | rex_posdb | |
+------------------+----------+----------------+------------------+
1 row in set (0.01 sec)
Description: I am using the Master-Master Replication concept. Suppose that the Master 1 is A and Master 2 is B. I have completed some configurations like setting server id, enabling log_bin and setting binlog_do_db (since we are going to replicate only a single database). Using the SQL command for changing the master, bin log, and position, I have set the changes at both the ends. And with this Master Master Replication has been implemented and I am able to see the changes done at either of the side. Problem : After changing/updating any table in database on either side the MASTER_LOG_POS changes However the MASTER_LOG_FILE remains the same in both ends. Since the MASTER_LOG_POS changes at both the ends, we are NOT ABLE to get the replication successfully. How to repeat: SHOW SLAVE STATUS; SHOW MASTER STATUS; -- on each machine Do some INSERT or UPDATE. SHOW SLAVE STATUS; SHOW MASTER STATUS; -- on each machine (again) ------------------ Master 1 Status ---------------------- mysql> show master status; +------------------+----------+----------------+------------------+ | File | Position | Binlog_Do_DB | Binlog_Ignore_DB | +------------------+----------+----------------+------------------+ | mysql-bin.000004 | 107 | rex_posdb | | +------------------+----------+----------------+------------------+ 1 row in set (0.00 sec) mysql> show slave status\G; *************************** 1. row *************************** Slave_IO_State: Waiting for master to send event Master_Host: rex.com Master_User: slave_users Master_Port: 3306 Connect_Retry: 60 Master_Log_File: mysql-bin.000019 Read_Master_Log_Pos: 4590 Relay_Log_File: user-home-relay-bin.000006 Relay_Log_Pos: 253 Relay_Master_Log_File: mysql-bin.000019 Slave_IO_Running: Yes Slave_SQL_Running: No Replicate_Do_DB: Replicate_Ignore_DB: Replicate_Do_Table: Replicate_Ignore_Table: Replicate_Wild_Do_Table: Replicate_Wild_Ignore_Table: Last_Errno: 1269 Last_Error: Error 'Can't revoke all privileges for one or mor e of the requested users' on query. Default database: ''. Query: 'REVOKE ALL PRI VILEGES, GRANT OPTION FROM 'horde'@'localhost'' Skip_Counter: 0 Exec_Master_Log_Pos: 3603 Relay_Log_Space: 1706 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: NULL Master_SSL_Verify_Server_Cert: No Last_IO_Errno: 0 Last_IO_Error: Last_SQL_Errno: 1269 Last_SQL_Error: Error 'Can't revoke all privileges for one or mor e of the requested users' on query. Default database: ''. Query: 'REVOKE ALL PRI VILEGES, GRANT OPTION FROM 'horde'@'localhost'' Replicate_Ignore_Server_Ids: Master_Server_Id: 1391195877 1 row in set (0.00 sec) After Update/Insert mysql> show master status; +------------------+----------+----------------+------------------+ | File | Position | Binlog_Do_DB | Binlog_Ignore_DB | +------------------+----------+----------------+------------------+ | mysql-bin.000004 | 516 | rex_posdb | | +------------------+----------+----------------+------------------+ 1 row in set (0.00 sec) ------------------ Master 2 Status ---------------------- mysql> show master status; +------------------+----------+----------------+------------------+ | File | Position | Binlog_Do_DB | Binlog_Ignore_DB | +------------------+----------+----------------+------------------+ | mysql-bin.000019 | 4590 | rex_posdb | | +------------------+----------+----------------+------------------+ 1 row in set (0.00 sec) mysql> show slave status\G; *************************** 1. row *************************** Slave_IO_State: Waiting for master to send event Master_Host: 59.177.113.206 Master_User: rex_slave Master_Port: 3306 Connect_Retry: 60 Master_Log_File: mysql-bin.000004 Read_Master_Log_Pos: 107 Relay_Log_File: server-relay-bin.000006 Relay_Log_Pos: 253 Relay_Master_Log_File: mysql-bin.000004 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: 107 Relay_Log_Space: 556 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: 145454345 1 row in set (0.00 sec) ERROR: No query specified After Update/Insert +------------------+----------+----------------+------------------+ | File | Position | Binlog_Do_DB | Binlog_Ignore_DB | +------------------+----------+----------------+------------------+ | mysql-bin.000019 | 4999 | rex_posdb | | +------------------+----------+----------------+------------------+ 1 row in set (0.01 sec)