You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 2 Next »

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.

ACHTUNG:

  • die server_id sind pro Master Server unterschiedlich 
  • Der Parameter auto_increment_offset ist pro Master Server unterschiedlich


MySQL Master 1 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
auto_increment_increment        = 2
auto_increment_offset           = 1
log_slave_updates
EOFF
MySQL Master 2 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                       = 2
binlog_format                   = ROW
expire_logs_days                = 3
max_binlog_size                 = 100M
log_bin                         = binlog
auto_increment_increment        = 2
auto_increment_offset           = 2
log_slave_updates
EOFF

Als nächstes wird ein Benutzer angelegt, mit dem sich die Slave-Server mit dem Master-Server verbinden können:

Replikationsuser anlegen
mysql -u root -pfireball -v -e"CREATE USER 'repl'@'%' IDENTIFIED BY 'fireball'"
mysql -u root -pfireball -v -e"GRANT REPLICATION SLAVE ON *.* TO 'repl'@'%'"
mysql -u root -pfireball -v -e"FLUSH PRIVILEGES"

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

Neustart des MySQL Servers
service mysqld restart


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.

ACHTUNG:

  • die server_id sind pro Slave Server unterschiedlich, und sind bewusst abseits von 100 gehalten, damit die nicht mit Master-IDs kollidieren.
MySQL Slave 1 konfigurieren
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
EOFF
MySQL Slave 2 konfigurieren
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                       = 102
EOFF

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

Neustart des MySQL Servers
service mysqld restart
  • No labels