Configuring Mysql Master-Slave Replication On Ubuntu Linux
Configuring Mysql Master-Slave Replication On Ubuntu Linux
Restart MySQL:
sudo service mysql restart
Create a snapshot and copy it to the slave server:
mysqldump -u root --all-databases --master-data > masterdump.sql
scp masterdump.sql 10.11.12.102:
LinuxTrainingAcademy.com
Slave Server Configuration
On the slave, install MySQL Server:
sudo apt-get install -y mysql-server
Restart MySQL:
sudo service mysql restart
Tell the slave what user, password, and host to use for the master server:
mysql -u root
CHANGE MASTER TO
MASTER_HOST='10.11.12.101',
MASTER_USER='repl',
MASTER_PASSWORD='slavepassword';
exit
Taking it to the next level… (Multi-master Clustering)
If you want to learn how to create a true multi-master MySQL database cluster, check out H
igh Availability for
the LAMP Stack.
LinuxTrainingAcademy.com