Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Content imported from a Scroll Translations translation file.
echo "FLUSH LOGS;" > /home/jtel/purge.sql echo "PURGE BINARY LOGS BEFORE NOW() - INTERVAL 4 HOUR;" >> /home/jtel/purge.sql echo '#!/bin/bash' > /home/jtel/purge.sh echo "mysql -uroot -p<password> < /home/jtel/purge.sql" >> /home/jtel/purge.sh chmod 700 /home/jtel/purge.sh mv /home/jtel/purge.sh /etc/cron.hourly/
Sv translation
languageen

Table of Contents
maxLevel3
printablefalse

Master Server

(Primary)

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:

Translations Ignore


Code Block
languagebash
titleConfigure MySQL Master
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



Note
titleACHTUNG

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:

MySQL 8.x

Status
colourRed
titleCaution Password

Translations Ignore


Create replication user
Code Block
title
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"

MySQL 5.6

Translations Ignore
Create replication user
Code Block
title
mysql -u root -p<password> -v -e"CREATE USER 'repl'@'%' IDENTIFIED 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:

Translations Ignore


Code Block
languagebash
titleRestart the MySQL server
service mysqld restart

Keep only bin logs for 4 hours

This is NOT RECOMMENDED.

This step is necessary, on master servers with a high load and low disk capacity - replace <password> with the DB password:

Translations Ignore
Code Block
languagebash
titleValues to the system environment
systemctl restart mysqld



Slave Server

The following steps are required to configure a DATA server as a slave. This is an unencrypted replication . Encrypted replication can be performed according to https://www.thomas-krenn.com/de/wiki/MySQL_Verbindungen_mit_SSL_verschl%C3%BCsselnsetup.

The first step is to create an appropriate configuration modulefile. This is done with the following command:

Translations Ignore


Code Block
languagebashtitleConfigure MySQL slave
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



Note
titleACHTUNG

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:

Translations Ignore


Code Block
languagebash
titleRestart the MySQL server
servicesystemctl restart mysqld restart




Sv translation
languagede

Status
colourRed
titleThis page is only available in English

Sv translation
languagefr

Serveur maître

Les étapes suivantes sont nécessaires pour configurer un serveur DATA en tant que maître.

La première étape consiste à créer un module de configuration approprié. Cela se fait avec la commande suivante

Table of Contents
maxLevel3
printablefalse

Master Server (Primary)

Folgende Schritte sind erforderlich, um einen DATA Server als Master zu konfigurieren.

Als erstes muss ein entsprechendes Konfigurationsmodul erstellt werden. Dies erfolgt mit folgendem Befehl :

Translations Ignore


Code Block
title
languagebashConfigure MySQL Master
cat <<EOFF > /etc/mymon.cnf.d/jtel-master.cnf
 # CustomParamètres MySQL settingspersonnalisés forpour aun specificserveur SQL maître masterspécifique server
#
 # WARNINGATTENTION : ThisCe filefichier isest specificspécifique toau theserveur mastermaître server

[mysqld]
 #
 # Replication Options
#

# Specificde optionsréplication for MASTER# role
#
server_id Options spécifiques au rôle de MASTER                 # 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



Note
titleACHTUNG

Der Wert server_id taucht sowohl in den Konfigurationsmodulen für Master-Server als auch in den Konfigurationsmodulen für Slave-Server auf. Hierbei ist strikt darauf zu achten, dass dieser Wert eindeutig ist. In einem Verbund dürfen keine DATA-Server die gleiche server_id haben.

Als nächstes wird ein Benutzer angelegt, mit dem sich die Slave-Server mit dem Master-Server verbinden können - <password> mit den entsprechenden Passwort ersetzen:

MySQL 8.x

La valeur server_id apparaît à la fois dans les modules de configuration pour les serveurs maîtres et dans les modules de configuration pour les serveurs esclaves. Il est important de s'assurer que cette valeur est unique. Aucun serveur de données dans un groupe ne peut avoir le même server_id.

Ensuite, un utilisateur est créé avec lequel les serveurs esclaves peuvent se connecter au serveur maître - remplacer <mot de passe> par le mot de passe correspondant :

Status
colourRouge
titleMot de passe de précaution

Translations Ignore


title
Code Block
Create replication user
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"

MySQL 5.6

Translations Ignore
Code Block
titleCreate replication user
mysql -u root -p<password> -v -e"CREATE USER 'repl'@'%' IDENTIFIED BY '<password>'"
mysql -u root -p<password> -v -e"GRANT REPLICATION SLAVE ON *.* TO 'repl'@'%'"
mysql -u root -p<password> -v -e"FLUSH PRIVILEGES"


Im Anschluss muss der MySQL-Server neu gestartet werden, damit alle Einstellungen übernommen werdenEnsuite, le serveur MySQL doit être redémarré afin que tous les paramètres soient appliqués :

Translations Ignore


Code Block
languagebash
titleRestart the MySQL server
servicesystemctl restart mysqld restart

Keep only bin logs for 4 hours

This is NOT RECOMMENDED.

This step is necessary, on master servers with a high load and low disk capacity - replace <password> with the DB password:

Translations Ignore
Code Block
languagebash
titleValues to the system environment
echo "FLUSH LOGS;" > /home/jtel/purge.sql
echo "PURGE BINARY LOGS BEFORE NOW() - INTERVAL 4 HOUR;" >> /home/jtel/purge.sql

echo '#!/bin/bash' > /home/jtel/purge.sh
echo "mysql -uroot -p<password> < /home/jtel/purge.sql" >> /home/jtel/purge.sh
chmod 700 /home/jtel/purge.sh
mv /home/jtel/purge.sh /etc/cron.hourly/



Serveur esclave

Les étapes suivantes sont nécessaires pour configurer un serveur DONNÉES en tant qu'esclave. Il s'agit d'un dispositif de réplication non crypté.

La première étape consiste à créer un fichier de configuration approprié. Cela se fait avec la commande suivante

Slave Server

Folgende Schritte sind erforderlich, um einen DATA-Server als Slave zu konfigurieren. Es handelt sich hierbei um eine unverschlüsselte Replikation. Eine verschlüsselte Replikation kann gemäß https://www.thomas-krenn.com/de/wiki/MySQL_Verbindungen_mit_SSL_verschl%C3%BCsseln umgesetzt werden.

Als erstes muss ein entsprechendes Konfigurationsmodul erstellt werden. Dies erfolgt mit folgendem Befehl

:

Translations Ignore


Code Block
languagebash
titleConfigure MySQL slave
cat <<EOFF > /etc/
my
mon.cnf.d/jtel-slave.cnf
 # 
Custom
Paramètres MySQL 
settings
personnalisés 
for
pour 
a
un 
specific
serveur SQL 
slave
esclave spécifique 
server
#
 # ATTENTION 
WARNING
: 
This
Ce 
file
fichier 
is
est 
specific
spécifique 
to
au 
the
serveur 
slave
esclave 
server
[mysqld]
 # Options spécifiques 
Specific
pour 
options
le 
for
rôle 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



Note
titleACHTUNG

Der Wert server_id taucht sowohl in den Konfigurationsmodulen für Master-Server als auch in den Konfigurationsmodulen für Slave-Server auf. Hierbei ist strikt darauf zu achten, dass dieser Wert eindeutig ist. In einem Verbund dürfen keine DATA-Server die gleiche server_id haben.

La valeur server_id apparaît à la fois dans les modules de configuration pour les serveurs maîtres et dans les modules de configuration pour les serveurs esclaves. Il est important de s'assurer que cette valeur est unique. Aucun serveur de DONNÉES de données dans un groupe ne peut avoir le même server_id.

Ensuite, le serveur MySQL doit être redémarré afin que tous les paramètres soient appliqués

Im Anschluss muss der MySQL-Server neu gestartet werden, damit alle Einstellungen übernommen werden

:

Translations Ignore


Code Block
languagebash
titleRestart the MySQL serverservice
systemctl restart mysqld
restart