patternsqlMinor
Mysql thinks Master & Slave have the same server-id
Viewed 0 times
sametheslavethinksmysqlmasterserverhave
Problem
I've been setting up a
Each of the two slaves have exactly the same configuration, other than the hostname,
I really don't understand, because I have all of the server IDs miles apart
I'm setting them in my
Thanks in advance :) Tom.
master->slave_a->slave_b relationship and having a little trouble. I currently have the master->slave_a replication working fine.Each of the two slaves have exactly the same configuration, other than the hostname,
server-id setting. When ever I try and start the slave on slave_b I have the following error pop up:Fatal error: The slave I/O thread stops because master and slave have equal MySQL server ids; these ids must be different for replication to work (or the --replicate-same-server-id option must be used on slave but this does not always make sense; please check the manual before using it).I really don't understand, because I have all of the server IDs miles apart
1->2626->2629 (m->s->s).I'm setting them in my
/etc/mysql/conf.d/replication.cnf file - and it seems to be being included, but I have no idea how I can check which server id mysql is picking up.Thanks in advance :) Tom.
Solution
The server_id of the Master is recorded in its binary logs along with each query it executed to completion. To see those server_id values in the binary log, you run mysqlbinlog against any binary log.
Since Master -> Slave_A works fine, here is what you can do to clean things up between Slave_A and Slave_B:
On Slave_A, run the following in mysql:
On Slave_A, run the following in the OS:
On Slave_A, run the following in mysql:
This will get Slave_B to stare at the correct values for server_id, and also reestablish MySQL Replication.
BTW You need to make sure binary logging is disabled on Slave_B since it is not necessary for a Slave unless Slave_B is going to a Master to some other Slave.
Since Master -> Slave_A works fine, here is what you can do to clean things up between Slave_A and Slave_B:
On Slave_A, run the following in mysql:
mysql> STOP SLAVE;
mysql> RESET MASTER;On Slave_A, run the following in the OS:
$ echo "STOP SLAVE;" > /root/MyData.sql
$ mysqldump -u... -p... --master-data=1 --routines --triggers --all-databases >> /root/MyData.sql
$ echo "START SLAVE;" >> /root/MyData.sql
$ mysql -hSlave_B -u... -p... -A < /root/MyData.sqlOn Slave_A, run the following in mysql:
mysql> START SLAVE;This will get Slave_B to stare at the correct values for server_id, and also reestablish MySQL Replication.
BTW You need to make sure binary logging is disabled on Slave_B since it is not necessary for a Slave unless Slave_B is going to a Master to some other Slave.
Code Snippets
mysql> STOP SLAVE;
mysql> RESET MASTER;$ echo "STOP SLAVE;" > /root/MyData.sql
$ mysqldump -u... -p... --master-data=1 --routines --triggers --all-databases >> /root/MyData.sql
$ echo "START SLAVE;" >> /root/MyData.sql
$ mysql -hSlave_B -u... -p... -A < /root/MyData.sqlmysql> START SLAVE;Context
StackExchange Database Administrators Q#9756, answer score: 4
Revisions (0)
No revisions yet.