Posts

Showing posts from April, 2019

MYSQL Chaining

This describes setting up a new chain with mysql replication.
This is the basic layout. (M master, S1 slave of master, S2 slave of S1)
M <- S1 <- S2
Creating a chain:
On S1: stop slave; systemctl disable mysqld; show slave status\G # COPY THIS TO TEXT FILE show mater status\G # COPY THIS TO TEXT FILE
service mysqld stop;
Create an image of S1, this will be S2. In GCP go to the VM instance of S1, click on its disk, click create Image. ========================================
Log into your new image, S2:
edit /etc/my.cnf, add a way to skip the start of a slave.[mysqld] skip-slave-start
Remove the old UUID, this needs to be unique, so delete it, rm -f /var/lib/mysql/auto.cnf
change the server-id to anything unique vi /etc/my.cnf, find "server-id" change it to something unique EG ** server-id=1552009061
systemctl enable mysqld; #ensure mysql will start on boot
service mysqld start;
reset slave;
Set the new master position. These should be the numbers from step 1.
CHANGE MASTER TO…