mysql replication - slave server on one database

前端 未结 2 850
小蘑菇
小蘑菇 2021-02-07 06:37

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 serve

相关标签:
2条回答
  • 2021-02-07 07:04

    Adding these lines to the /etc/my.conf file of the slave machine solved my problem. Thanks.

    replicate-do-db=Refill
    

    However, please note that after doing this i had to restart both the databases and update the new file name and position from the master server by typing below command:

    mysql> show master status;
    

    Add this information to your MySQL on slave machine and start slave.

    0 讨论(0)
  • 2021-02-07 07:12

    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

    0 讨论(0)
提交回复
热议问题