Customizing Replication

You may want to have a setup that is different from the simple two-server setup described previously. There are a number of options that you can apply to either the master or the slave. This lesson does not cover every possibility, but it covers the most commonly used ones.

You may not want to replicate all the databases on the master. For example, some of your databases may not be worthy of replicating, or you may just want to reduce network traffic and only replicate what is critical.

MySQL lets you tell a master server to ignore logging updates on certain named databases. You do this by placing a line in the [mysqld] section of my.cnf, like this:

[mysqld]
...
binlog-ignore-db  = database_name
					

You will need to restart mysqld for the change to take effect. MySQL will now not record updates to the database given by database_name in the binary log. Place several such lines in the configuration file if you want the master to skip logging on several databases.

You can do a similar thing from the slave end. You would place the following line in the my.cnf file on the slave:

[mysqld]
...
replicate-ignore-db  = database_name
					

This tells the slave to skip updates on the given database_name. Place several such lines in the configuration file if you want the slave to ignore several databases.

A further possibility is to configure a slave to also be a master. In such a configuration—a daisy chain—each slave will be the master of the next. Therefore each slave must be configured to produce a binary log of changes it has replicated, so that those updates can be passed down the line to the next slave. You should include the following line in the [mysqld] section of the slave's my.cnf file:

[mysqld]
...
log-slave-updates

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.133.128.168