Master Server
The following steps are required to configure a DATA server as master.
The first step is to create an appropriate configuration module. This is done with the following command:
cat <<EOFF > /etc/my.cnf.d/jtel-master.cnf # Custom MySQL settings for a specific SQL master server # # WARNING: This file is specific to the master server [mysqld] # # Replication Options # # Specific options for MASTER role # server_id = 1 binlog_format = ROW expire_logs_days = 3 max_binlog_size = 100M log_bin = binlog relay_log = mysqld-relay-bin relay_log_index = mysqld-relay-bin.index relay_log_info_file = relay-log.info EOFF
The value server_id appears both in the configuration modules for master servers and in the configuration modules for slave servers. It is important to ensure that this value is unique. No DATA servers in a group may have the same server_id
.
Next, a user is created with which the slave servers can connect to the master server - replace <password> with the corresponding password:
CAUTION PASSWORD
mysql -u root -p<password> -v -e"CREATE USER 'repl'@'%' IDENTIFIED WITH mysql_native_password BY '<password>'" mysql -u root -p<password> -v -e"GRANT REPLICATION SLAVE ON *.* TO 'repl'@'%'" mysql -u root -p<password> -v -e"FLUSH PRIVILEGES"
Afterwards the MySQL server must be restarted so that all settings are applied:
systemctl restart mysqld
Slave Server
The following steps are required to configure a DATA server as a slave. This is an unencrypted replication setup.
The first step is to create an appropriate configuration file. This is done with the following command:
cat <<EOFF > /etc/my.cnf.d/jtel-slave.cnf # Custom MySQL settings for a specific SQL slave server # # WARNING: This file is specific to the slave server [mysqld] # Specific options for SLAVE role # server_id = 101 log_slave_updates relay_log = mysqld-relay-bin relay_log_index = mysqld-relay-bin.index relay_log_info_file = relay-log.info skip-log-bin EOFF
The value server_id
appears both in the configuration modules for master servers and in the configuration modules for slave servers. It is important to ensure that this value is unique. No DATA servers in a group may have the same server_id
.
Afterwards the MySQL server must be restarted so that all settings are applied:
systemctl restart mysqld