debugsqlMinor
Configured MySQL replication but its not working
Viewed 0 times
butworkingreplicationitsmysqlnotconfigured
Problem
I have configured MySQL master and slave replication setup on 5.5.x.
But for some reason data is not getting replicated properly. What might be the reason?
At Master:
/etc/my.cnf
mysql> show master status;
At Slave:
/etc/my.cnf
mysql> show slave status\G;
```
1. row
Slave_IO_State: Waiting for master to send event
Master_Host: 10.10.0.21
Master_User: replicator
Master_Port: 3306
Connect_Retry: 60
Master_Log_File: mysql-bin.000005
Read_Master_Log_Pos: 198123
Relay_Log_File: CentOS62-relay-bin.000012
Relay_Log_Pos: 198269
Relay_Master_Log_File: mysql-bin.000005
Slave_IO_Running: Yes
Slave_SQL_Running: Yes
Replicate_Do_DB: cmdb,nagios
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: 198123
Relay_Log_Space: 198574
Until_Condition: None
Until_Log_File:
Until_Log_Pos: 0
But for some reason data is not getting replicated properly. What might be the reason?
At Master:
/etc/my.cnf
[mysqld]
log-bin=/var/lib/mysql/mysql-bin.log
server-id=1
innodb_flush_log_at_trx_commit=1
sync_binlog=1
binlog-do-db=cmdb
binlog-do-db=nagiosmysql> show master status;
+------------------+----------+--------------+------------------+
| File | Position | Binlog_Do_DB | Binlog_Ignore_DB |
+------------------+----------+--------------+------------------+
| mysql-bin.000005 | 168019 | cmdb,nagios | |
+------------------+----------+--------------+------------------+At Slave:
/etc/my.cnf
[mysqld]
server-id=2
log-bin=/var/lib/mysql/mysql-bin.log
innodb_flush_log_at_trx_commit=1
sync_binlog=1
report-host=10.10.0.22
replicate-do-db=cmdb
replicate-do-db=nagiosmysql> show slave status\G;
```
1. row
Slave_IO_State: Waiting for master to send event
Master_Host: 10.10.0.21
Master_User: replicator
Master_Port: 3306
Connect_Retry: 60
Master_Log_File: mysql-bin.000005
Read_Master_Log_Pos: 198123
Relay_Log_File: CentOS62-relay-bin.000012
Relay_Log_Pos: 198269
Relay_Master_Log_File: mysql-bin.000005
Slave_IO_Running: Yes
Slave_SQL_Running: Yes
Replicate_Do_DB: cmdb,nagios
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: 198123
Relay_Log_Space: 198574
Until_Condition: None
Until_Log_File:
Until_Log_Pos: 0
Solution
What concerns me here is the use of both
There is no need to use both. I would remove
If you replicate any SQL use fully qualified table names (dbname.tblname) and you use replicate-do-db, MySQL Replication gets confused if you execute
Percona explained this in conjunction with
Percona also suggested reading the replication filtering rules thoroughly.
replicate-do-db on the Slave and binlog-do-db on the Master at the same time.There is no need to use both. I would remove
binlog-do-db from the Master. I would also look over any queries with fully qualified table names. Why ?If you replicate any SQL use fully qualified table names (dbname.tblname) and you use replicate-do-db, MySQL Replication gets confused if you execute
USE dbname.Percona explained this in conjunction with
binlog-do-db and replicate-do-db back in May 2009.Percona also suggested reading the replication filtering rules thoroughly.
Context
StackExchange Database Administrators Q#19236, answer score: 2
Revisions (0)
No revisions yet.