Dokĉjo KINNE (kinnerc) wrote in mysql,
Dokĉjo KINNE
kinnerc
mysql

Selective Replication in mySQL 5.X

Folks may remember last week when I was asking questions about mysqldumps. I was doing that in order to get a DB backup for a specific database we wanted to replicate on another server, and I've been working on that.

After some hit and miss I think I nearly got it working, at least to a point where the replication started between the Master and the slave. It seemed to work for a few seconds, then bombed when the slave tried to execute a statement that was for a DB that it didn't have in it.

The point is that of all the several databases on the Master machine, at this point we only want to replicate one on the slave machine. I thought I had had that set up in the slave's my.cnf with the line

replicate-do-db - aid #aid is the database we want to replicate

however High Performance MySQL says that this is not the way to do this since filtering will be done on the current default database. "This is not usually what you want." :-)

The book does indicate that "On the slave, the relicate_* options filter events as the slave SQL thread reads them from the relay log." This make sense to me, and at this point it also makes sense that the log coming from the master has every statement coming into the DB. It goes on to say that "You can replicate or ignore one or more databases (emphasis mine)...based on LIKE pattern matching syntax." There is where I lose it. I understand how to use the LIKE syntax in mySQL statements, but not in this environment.

Is it possible to set up a small battery of statements in the slave my.cnf along the lines of:

replicate_ignore_table = .%

Would that do it?

Is anyone basically doing replication in a simple Master-Slave relationship where you are only replicating one DB? If so, how are you doing it?

THANKS, folks!
  • Post a new comment

    Error

    default userpic
  • 2 comments