Question

I didn't know how to describe it so I am calling it semi circle. Here's what I am doing.

Server A
Server B = This is slave of Server A
Server C = This is slave of Server B

When I update something on Server A then it is reflected on Server B. But the same change is not reflected on Server C.

Only when I update something on Server B then change is reflected on Server C.

How do I make it so any changes done on Server A will come to Server B (which is already working) and then it goes to Server C?

EDIT
Upon investigation I found out that when I make some change on Server A then its log file position changes. But when those changes are reflected on Server B then Server B log file position doesn't change. It is because of this reason Server C doesn't know if there has been any change on Server B unless I explicitly change something (insert,update,delete) on Server B.

So is there a way to tell MySQL to increment log file position when Slave is receiving updates from Master?

Was it helpful?

Solution

I think the problem is the following:

Since B is a Slave of A, replication log position changes when something on A is executed and then records the changes to its binlogs. Server B picks up Server A binlog events and executes it.

Why won't Server B just pass it on to Server C ?

Server B need the following option enabled

[mysqld]
log_slave_updates

Whenever you want a server to be a Slave and a Master at the same time, you need log_slave_updates enabled. Here is what the MySQL Documentation says:

Whether updates received by a slave server from a master server should be logged to the slave's own binary log. Binary logging must be enabled on the slave for this variable to have any effect.

In your case, Server B reads Server A's binlog events as recorded in Server B's relay logs, executes those events in Server B and nothing more.

When you enable log_slave_updates on Server B, then the following happens

  • Server B reads Server A's binlog events as recorded in Server B's relay logs
  • Server B executes those events in Server B
  • Server B records the event it executes in Server B's binlogs
  • Server C will receive Server B's binlogs and execute them

I mentioned using log_slave_updates a couple of times before:

Therefore, when you said

It is because of this reason Server C doesn't know if there has been any change on Server B unless I explicitly change something (insert,update,delete) on Server B

The explicitly change something becomes implicit when you use log_slave_updates.

Licensed under: CC-BY-SA with attribution
Not affiliated with dba.stackexchange
scroll top