Configuring the Slave
In order to configure the Slave, open the /etc/mysql/my.conf file, add the following, and save and close that file:
- IP_ADDRESS_OF_MASTER is the actual IP address of the Master server.
- USER is the database administrator with replication privileges.
- USER_PASSWORD is the password associated with the USER.
- DATABASE is the name to be replicated.
This next step requires information returned from the SHOW MASTER STATUS; command that was run. Stop the Slave by issuing these commands:
mysql -u root -p (enter the MySQL admin password)
You must run the following command:
CHANGE MASTER TO MASTER_HOST='IP_ADDRESS_OF_MASTER', MASTER_USER='USER', MASTER_PASSWORD='USER_PASSWORD', MASTER_LOG_FILE='mysql-bin.007', MASTER_LOG_POS=NUMBER;
Where the following applies:
- IP_ADDRESS_OF_MASTER is the actual IP address of the Master
- USER is the MySQL admin user
- USER_PASSWORD is the password for the USER
- NUMBER is the Position Number reported from the SHOW MASTER STATUS command.
Restart the Slave by issuing the command SLAVE START; and then exit the MySQL prompt with the command quit. Now you can follow these steps to make sure everything is working:
1. Issue the command mysql -u root -p (enter the database admin password).
2. Issue the command SHOW SLAVE STATUS;.
You should see something like this:
Slave_IO_Running: Yes Slave_SQL_Running: Yes
If all is set to Yes, you now have a working, replicated MySQL database. Congratulations!
Jack Wallen is an award-winning writer for Techrepublic and Linux.com. As an avid promoter/user of the Linux OS, Jack tries to convert as many users to open source as possible. His current favorite flavor of Linux is Bodhi Linux (a melding of Ubuntu and Enlightenment). When Jack isn't writing about Linux he is hard at work on his other writing career -- writing about zombies, various killers, super heroes, and just about everything else he can manipulate between the folds of reality. You can find Jack's books on Amazon, Barnes & Noble, and Smashwords. Outnumbered in his house one male to two females and three humans to six felines, Jack maintains his sanity by riding his mountain bike and working on his next books. For more news about Jack Wallen, visit his website Get Jack'd.