Theory:
The traditional method is based on replicating events from the source's binary log, and requires the log files and positions in them to be synchronized between source and replica.
1. General information
Master Node
IP: 192.168.56.59
Hostname: edb-saigon.taolaoxibup.com
OS: Red Hat Enterprise Linux release 9.4 (Plow)
MySQL version: Ver 8.0.37-commercial for Linux on x86_64 (MySQL Enterprise Server - Commercial)
IP: 192.168.56.59
Hostname: edb-saigon.taolaoxibup.com
OS: Red Hat Enterprise Linux release 9.4 (Plow)
MySQL version: Ver 8.0.37-commercial for Linux on x86_64 (MySQL Enterprise Server - Commercial)
Slave Node
IP: 192.168.56.29
Hostname: edb-hanoi.taolaoxibup.com
OS: Red Hat Enterprise Linux release 9.4 (Plow)
MySQL version: Ver 8.0.37-commercial for Linux on x86_64 (MySQL Enterprise Server - Commercial)
2. Preparation on Master/Slave Node
- Turn off Firewall
- Disable SELinux
- Configuring /etc/hosts
- 192.168.56.59 edb-saigon.taolaoxibup.com edb-saigon
- 192.168.56.29 edb-hanoi.taolaoxibup.com edb-hanoi
Master Node
[root@mysql-saigon ~]# vi /etc/my.cnf
server-id=1
bind-address=192.168.56.59
log-bin=saigon-bin
[root@mysql-saigon ~]# vi /etc/my.cnf
server-id=1
bind-address=192.168.56.59
log-bin=saigon-bin
[root@mysql-saigon ~]# systemctl restart mysqld.service
Slave Node
[root@mysql-hanoi ~]# vi /etc/my.cnf
server-id=2
bind-address=192.168.56.29
log-bin=hanoi-bin
read_only=1 (this variable prevents normal user to execute DDL, DML on Slave server)
bind-address=192.168.56.29
log-bin=hanoi-bin
read_only=1 (this variable prevents normal user to execute DDL, DML on Slave server)
[root@mysql-hanoi ~]# systemctl restart mysqld.service