Take the 2-minute tour ×
Database Administrators Stack Exchange is a question and answer site for database professionals who wish to improve their database skills and learn from others in the community. It's 100% free, no registration required.

I am new to mysql and I have a query in regards to mysql replication.

Currently, I have a master database that replicates to four slave servers at the moment. I would need to set up a few replication servers(as slave) but these will replicate only a few databases. How would approach this issue?

Should I be using something like this on slave /etc/my.cnf?

replicate-ignore-db=db_name

Can I set something on slave configuration stating exactly which databases and tables to be replicated?

Should the changes happen only on the slave configuration or on master as well? The reason being this master server currently replicates whole lot of databases to other slaves which will remain as it is.

share|improve this question
    
should this open --replicate-do-db=db_name as explained here dev.mysql.com/doc/refman/5.0/en/… be the answer> –  mezi Aug 23 '13 at 16:23
add comment

1 Answer

up vote 2 down vote accepted

I would avoid the replicate-do-db option due to the restriction on cross-database replication and users not fully qualifying a database name or not specifying "use dbname;" (it will execute on master but not replicate to slave).

Use this option instead (put it in my.cnf):

replicate-wild-do-table=dbname1.%

replicate-wild-do-table=dbname2.%

Or you can specify the tables, replace % with table name, one on each line. http://dev.mysql.com/doc/refman/5.0/en/replication-options-slave.html#option_mysqld_replicate-wild-do-table

This link should help get you started: http://dev.mysql.com/doc/refman/5.0/en/replication-solutions-partitioning.html

share|improve this answer
    
Many thanks, brilliant answer. –  mezi Aug 29 '13 at 15:46
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.