MySQL Replication
2 - Select your username/password for replications accounts. You can have one per server if you want, or one for all the
3 - mysql> GRANT REPLICATION SLAVE ON *.*
TO 'USERNAME'@'IPFROMTHESLAVE' IDENTIFIED BY 'PASSWORD';
a) None of the passwords need to be root passwords.
4) In the master server you need to Flush all the tables, this will prevent clients from writing the db so it
[mysqld]
log-bin=mysql-bin
server-id=1
rsync -vrplogDtH /var/lib/mysql /home/slave_db
SHOW MASTER STATUS;
7)
server-id=slave_id
server-id=2
8) Copy the files over from the slave_db folder to the remote location. You can do this doing the following command:
9) Start Mysql and enter to it, write the following changing the values that are needed:
mysql> CHANGE MASTER TO
-> MASTER_HOST='master_host_name',
-> MASTER_USER='replication_user_name',
-> MASTER_PASSWORD='replication_password',
-> MASTER_LOG_FILE='recorded_log_file_name',
-> MASTER_LOG_POS=recorded_log_position;
10) type: START SLAVE;
MySQL Failover solution
Nice Article !! Thank you very much.
Hope you not mind asking few questions,
A) Will this works with my cPanel servers? (cPanel 11)
B) If “Yes” will this setup overwrite by manual cPanel updates?
C) Can I use this as a failover server setup? Where most of my sites are based on MySQl and PHP. But I do use cPanel and fantastico tools. If I synchronise /home folder from server A to server B, will this setup work as a redundant Mysql server when my Server A go down? I need just a cheep mirror server to accept web traffics if my main server down. Until then Server B will be sleep.
Thanks in advance,
Neo Nash