Appunti veloci senza troppi commenti….

Sul MASTER

skip-innodb
default-storage-engine = MyISAM

Si NON AMO INNODB!

server-id=1

log-bin = mysql-bin
binlog-ignore-db = “mysql”
binlog-ignore-db = “sys”
binlog-ignore-db = “performance_schema”

systemctl restart mysql.service

grant replication slave on . TO ‘slaveuser’@’%’ identified by ‘xxxxxxxxxxxxxxx’;
SE mysql è versione 8
CREATE USER ‘thesalveusername’@’%’ identified by ‘XXXXX’;
grant replication slave on . TO ‘thesalveusername’@’%’;

FLUSH TABLES WITH READ LOCK;

creare i dump dei db e copiarli sulla macchina slave

SHOW MASTER STATUS;
ci darà le informazioni sul nome file di log e sulla posizione da cui far partire la replicazione

UNLOCK TABLES;

Sullo SLAVE

skip-innodb
default-storage-engine = MyISAM

server-id = 2

SLAVE STOP;
CHANGE MASTER TO MASTER_HOST=’192.168.1.54′,
MASTER_PORT=3306,
MASTER_USER=’thesalveusername’,
MASTER_PASSWORD=’ddddddddd’;
START SLAVE;
SHOW SLAVE STATUS\G

on mysql8

STOP SLAVE;
CHANGE MASTER TO MASTER_HOST=’30.31.32.33′,
MASTER_PORT=3306,
MASTER_USER=’thesalveusername’,
MASTER_PASSWORD=’xxxxxxxx’;
START SLAVE;
SHOW SLAVE STATUS\G

CHANGE MASTER TO MASTER_HOST=’30.31.32.33′,
MASTER_PORT=3306,
MASTER_USER=’thesalveusername’,
MASTER_PASSWORD=’dddddddd’, MASTER_LOG_FILE=’mysql-bin.000001′, MASTER_LOG_POS= 155;
START SLAVE;
SHOW SLAVE STATUS\G

Se lo slave non partisse utilizzare nella shell mysql il comando:

slave reset

Se la macchina dovessere essere un clone ricordarsi di eliminare il file /var/lib/mysql/auto.cnf in modo che i server abbiano UUID differente.

Lascia un commento