1
votes

Trying to set up replication master - slave.

Master my.cnf

[mysqld]
bind-address = 0.0.0.0
port = 3306
server-id = 1
log-bin = /var/lib/mysql/mysql-bin
replicate-do-db = Test

Slave my.cnf

[mysqld]
log_output              = "FILE"
general_log_file        = /var/log/mysql/mysql.log
general_log             = 1
log_bin                 = /var/log/mysql/mysql-bin.log
server-id = 2
relay-log = /var/lib/mysql/mysql-relay-bin
relay-log-index = /var/lib/mysql/mysql-relay-bin.index
replicate-do-db = Test

SHOW SLAVE STATUS shows

Slave_IO_Running: Yes
Slave_SQL_Running: Yes

In relay log i see query executed on master.
And Read_Master_Log_Pos also updates.
But in general_log_file appear only

130530 14:50:25   523 Query     BEGIN
                  523 Query     COMMIT /* implicit, from Xid_log_event */

And changes on master not executed on slave. What i have missed?

1

1 Answers

7
votes

This could be due to the following option:

replicate-do-db = Test

The replicate-do-db option can be very tricky and can sometimes behave in a manner that appears illogical.

It will only replicate statements where the default ((that is, the one selected by USE) database is set. So in your example that would mean that this is replicated:

use Test;

insert into myTable (column) values (value);

But this will not be replicated:

insert into Test.myTable (column) values (value);

Try using the replicate-wild-do-table option instead:

replicate-wild-do-table=Test.%

Hopefully you will get some joy.