Sv translation |
---|
|
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 |
---|
language | bash |
---|
title | Configure 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 |
---|
| 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 Translations Ignore |
---|
Code Block |
---|
title | 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 |
---|
title | Create 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" |
|
Afterwards the MySQL server must be restarted so that all settings are applied: Translations Ignore |
---|
Code Block |
---|
language | bash |
---|
title | Restart the MySQL server |
---|
| service mysqld restart |
|
Keep only bin logs for 4 hoursThis 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 |
---|
language | bash |
---|
title | Values 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/ |
|
Slave ServerThe 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%BCsseln. The first step is to create an appropriate configuration module. This is done with the following command: Translations Ignore |
---|
Code Block |
---|
language | bash |
---|
title | Configure 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 |
---|
| 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 |
---|
language | bash |
---|
title | Restart the MySQL server |
---|
| service mysqld restart |
|
|
Sv translation |
---|
|
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 |
---|
language | bash |
---|
title | Configure MySQL Master |
---|
|
|
| konfigurieren | 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 |
---|
| 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 | Replikationsuser anlegen | 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 |
---|
title | Create replication user |
---|
| mysql -u root - |
| pfireballp<password> -v -e"CREATE USER 'repl'@'%' IDENTIFIED BY ' |
| fireball<password>'"
mysql -u root - |
| pfireballp<password> -v -e"GRANT REPLICATION SLAVE ON *.* TO 'repl'@'%'"
mysql -u root - |
| pfireballp<password> -v -e"FLUSH PRIVILEGES" |
|
Im Anschluss muss der MySQL-Server neu gestartet werden, damit alle Einstellungen übernommen werden: | Neustart des | Servers
Keep only bin logs for 4 hoursThis 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 |
---|
language | bash |
---|
title | Values 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/ |
|
Slave ServerFolgende 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 |
---|
language | bash |
---|
title | Configure MySQL |
---|
|
|
|
...
| 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 |
---|
| 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. |
Im Anschluss muss der MySQL-Server neu gestartet werden, damit alle Einstellungen übernommen werden: |
...
...
Ersteinrichtung der Systemdaten
Die folgenden Operationen erfolgen nicht mehr im Kontext des Benutzers root
sondern müssen im Kontext des Benutzers jtel
ausgeführt werden. Dafür kann man sich entweder in einer separaten SSH Sitzung als Benutzer jtel
anmelden oder, wenn man bereits als Benutzer root
angemeldet ist, in den Kontext des Benutzers jtel
wechseln. Dies erfolgt durch folgenden Befehl:
Code Block |
---|
language | bash |
---|
title | Benutzerkontext wechseln |
---|
|
su jtel
cd |
Nach Eingabe dieser Befehle erkennt man den Benutzerwechsel am Systemprompt, welches nun [jtel@acd-db1 ~]$
lautet (Das Systemprompt setzt sich zusammen ausbenutzername@hostname aktuelles Verzeichnis
).
Die Ersteinrichtung der Systemdaten kann prinzipiell von jeder Linux-Maschine aus gemacht werden, da jede Maschine Zugriff auf die Datenbank-Skripte hat und über einen MySQL-Client verfügt. Aus Performance-Gründen ist es aber ratsam, diese Operation auf dem primären DATA-Server auszuführen, da so die Netzwerkbelastung am geringsten ist und die Ersteinrichtung schnell von Statten geht.
Note |
---|
|
Wenn diese Operation von einer anderen Maschine ausgeführt werden sollte, dann ist unbedingt darauf zu achten, daß als Zielserver der primäre DATA-Server angegeben wird. Im Nachfolgenden Beispiel wird davon ausgegangen, dass die Operation auf dem primären DATA-Server ausgeführt wird, der Zielserver ist also localhost . |
Sv translation |
---|
|
Serveur maître (primaire)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 : |
...
...
cd ~/shared/JTELCarrierPortal/DB/mySQL/init
mysql -h localhost -u root -pfireball -vvv -f -n -q -e"source Init.sql"
cd ~/shared/JTELCarrierPortal/DB/mySQL
./update_all.sh root:fireball@localhost
cd ~/shared/JTEL/DB
./update_all.sh root:fireball@localhost
Im Falle dass für den Kunden noch spezifische Anpassungen oder Erweiterungen programmiert wurden die auch spezifische Anpassungen der Datenbank enthalten, muss zusätzlich das kundenspezifische Datenbank-Skript ausgeführt werden. Dies erfolgt exemplarisch durch einen Befehl der folgendermaßen aufgebaut ist:
Code Block |
---|
language | bash |
---|
title | Kundenspezifisches Datenbank-Skript |
---|
|
cd ~/shared/acme/DB
./update_all.sh root:fireball@localhost |
All diese Skripte geben Feedback über ihren Fortschritt und Erfolg. Sollte es bei der Ausführung eines dieser Skripte eine Fehlermeldung geben, so ist sorgfältig zu prüfen, ob die Übergebenen Parameter korrekt sind (z.B. Datenbankpasswort, Hostname). Eine erfolgreiche Ausführung sieht folgendermaßen aus:
Code Block |
---|
title | Beispiel einer Ausführung |
---|
|
[jtel@acd-db1 ~]$ cd ~/shared/JTELCarrierPortal/DB/mySQL
[jtel@acd-db1 mySQL]$ ./update_all.sh root:fireball@localhost
Updating Database.....................
CONGRATULATIONS: no errors during update.
[jtel@acd-db1 mySQL]$ cd ~/shared/JTEL/DB
[jtel@acd-db1 DB]$ ./update_all.sh root:fireball@localhost
Updating database..........
CONGRATULATIONS: no errors during update.
[jtel@acd-db1 DB]$ cd ~/shared/acme/DB
[jtel@acd-db1 DB]$ ./update_all.sh root:fireball@localhost
Updating database...
CONGRATULATIONS: no errors during update.
[jtel@acd-db1 DB]$ |
Nach der Erstinitialisierung müssen noch einige Werte an die Systemumgebung angepasst werden. Um dies zu vereinfachen, wird eine spezielle Datenbankprozedur aufgerufen, die nahezu alle benötigten Anpassungen für ein Standard-System vornimmt. Diese Prozedur muss folgende Parameter übergeben bekommen:
| Parameter | Bedeutung | Wert in diesem Beispiel |
---|
1 | _softwareHome | UNC des Verzeichnisses in dem das jtel-System alle Daten unterbringt. Dort befinden sich z.B. die Verzeichnisse Data , LogFiles und LogFilesCall . | '//acd-lb/shared/' |
2 | _dataHome | UNC des Verzeichnisses in dem das jtel-System alle Programmdateien vorfindet. Dort befinden sich z.B. die Verzeichnisse JTELCarrierPortal und JTEL . | '//acd-lb/shared/' |
3 | _webServerList | Komma-Separierte Liste aller WEB-Application-Server. | 'acd-jb1,acd-jb2' |
4 | _telServerList | Komma-Separierte Liste aller TEL-Server die Call-Flow-Applikationen ausführen. | 'acd-tel1' |
5 | _daemonServer | TEL-Server auf dem die Verwaltungsapplikationen ausgeführt werden. | 'acd-tel1' |
6 | _loadBalancer | Name des Servers auf dem die Rolle LB ausgeführt wird. | 'acd-lb' |
7 | _https | TRUE , falls der Load Balancer die Dienste über HTTPS zur Verfügung stellt, FALSE falls nicht. | FALSE |
Note |
---|
|
Bei den UNC bzw. Pfadangaben gelten folgende Regeln: - Das Trennzeichen ist ein / (slash) und kein \ (backslash)
- Die Pfade müssen mit / enden
|
Der Aufruf erfolgt mittels folgendem Befehl:
| cat <<EOFF > /etc/mon.cnf.d/jtel-master.cnf # Paramètres MySQL personnalisés pour un serveur SQL maître spécifique # # ATTENTION : Ce fichier est spécifique au serveur maître [mysqld] # # Options de réplication # # 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 |
---|
| 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 veiller à ce que cette valeur soit unique. Aucun serveur de données d'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 : MySQL 8.x Translations Ignore |
---|
Code Block |
---|
title | Créer un utilisateur de réplication |
---|
| 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 |
---|
title | Créer un utilisateur de réplication |
---|
|
|
|
...
...
Damit ist die Einrichtung der Rolle DATA abgeschlossen.
Weiterführende Links
Keep only bin logs for 4 hours
This step is necessary, on servers with a high load and low disk capacity:
...
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" |
|
Ensuite, le serveur MySQL doit être redémarré afin que tous les paramètres soient appliqués : Translations Ignore |
---|
Code Block |
---|
language | bash |
---|
title | Redémarrer le serveur MySQL |
---|
| service mysqld restart |
|
Ne conservez que les logs bin pendant 4 heuresCeci n'est PAS RECOMMANDÉ. Cette étape est nécessaire, sur les serveurs maîtres ayant une charge élevée et une faible capacité de disque - remplacer <password> par le mot de passe de la DB : |
| Werte an die SystemumgebungValeurs pour l'environnement du système |
| 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 |
|
pfireballp<password> < /home/jtel/purge.sql" >> /home/jtel/purge.sh |
|
chmod 700 /home/jtel/purge.sh |
|
mv /home/jtel/purge.sh /etc/cron.hourly/ |
|
Serveur esclaveLes étapes suivantes sont nécessaires pour configurer un serveur DONNÉES en tant qu'esclave. Il s'agit d'une réplique non cryptée. La réplication chiffrée peut être effectuée selon https://www.thomas-krenn.com/de/wiki/MySQL_Verbindungen_mit_SSL_verschl%C3%BCsseln. La première étape consiste à créer un module de configuration approprié. Cela se fait avec la commande suivante : Translations Ignore |
---|
Code Block |
---|
language | bash |
---|
title | Configurer MySQL Esclave |
---|
| cat <<EOFF > /etc/mon.cnf.d/ |
|
|
jtel-slave.cnf # Paramètres MySQL personnalisés pour un serveur SQL esclave spécifique # # ATTENTION : Ce fichier est spécifique au serveur esclave [mysqld] # Options spécifiques pour le rôle SLAVE # 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 |
---|
| 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 vérifier que cette valeur soit unique. Aucun serveur de données d'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 : Translations Ignore |
---|
Code Block |
---|
language | bash |
---|
title | Redémarrer le serveur MySQL |
---|
| service mysqld restart |
|
|
...