Created
October 22, 2014 04:58
-
-
Save rhemz/19e2d683c9dfeaa5ef45 to your computer and use it in GitHub Desktop.
add more databases to slave replication
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
to add more dbs to replicate: | |
- edit /etc/mysql/my.cnf on master | |
* add binlog_do_db = thedb | |
- restart master mysqld instance | |
- on master instance | |
* RESET MASTER (optional) | |
* USE thedb | |
* FLUSH TABLES WITH READ LOCK; | |
* SHOW MASTER STATUS - make note of file & position | |
- dump the db from commandline | |
* mysqldump -u user -p thedb > thedb.sql | |
- on master instance | |
* UNLOCK TABLES | |
- copy sql dump to slave box | |
- on slave instance | |
* STOP SLAVE | |
- import the sql dump into slave mysql instance | |
* mysql -u user -p thedb < thedb.sql | |
- edit /etc/mysql/my.cnf on slave | |
* add matching binlog_do_db entry | |
- restart slave mysqld instance | |
- on slave instance | |
* RESET SLAVE | |
* CHANGE MASTER TO MASTER_HOST='THEIPADDR',MASTER_USER='SLAVEUSER', MASTER_PASSWORD='SLAVEPASS', MASTER_LOG_FILE='mysql-bin.00000X', MASTER_LOG_POS=XXX; - sub in file and position | |
* START SLAVE | |
* SHOW SLAVE STATUS\G |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment