Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

mysql replication - slave server on one database

I couldn't find an answer to my question.

I have 2 mysql servers.

  1. Master server
  2. Slave server

Now i want to add another Slave server but i have other website running on that server.

Can i replicate just one database?

like image 511
sabansaulic Avatar asked Dec 22 '11 14:12

sabansaulic


People also ask

Which MySQL utility copies the master instance to a slave instance on the same host?

MySQL replication is a process that enables data from one MySQL database server (the master) to be copied automatically to one or more MySQL database servers (the slaves).

What is MySQL master-slave replication?

What Is Master-Slave Replication? The master-slave replication process enables database administrators to replicate or copy data stored in more than one server simultaneously. This helps the database administrator to create a live backup of the database all the time.


1 Answers

Yes you can

If you want to replicate just one database from master, you can set replicate-do-db in your /etc/my.cnf or set replicate-do-db as mysql argument, for example:

replicate-do-db=db01

If you have multi databases to be replicated, /etc/my.cnf should be like this:

replicate-do-db=db01
replicate-do-db=db02

If you just want slave to ignore some database, you can set replicate-ignore-db:

replicate-ignore-db=db01

More details on MySQL document: http://dev.mysql.com/doc/refman/5.1/en/replication-options-slave.html#option_mysqld_replicate-do-db

like image 126
Frank Fang Avatar answered Sep 29 '22 11:09

Frank Fang