MariaDB Replikation (Ubuntu): Unterschied zwischen den Versionen
Zur Navigation springen
Zur Suche springen
Zeile 137: | Zeile 137: | ||
<pre> | <pre> | ||
SHOW SLAVE STATUS\G | SHOW SLAVE STATUS\G | ||
</pre> | |||
== Log-Files == | |||
<pre> | |||
MariaDB [(none)]> SHOW VARIABLES LIKE '%data%'; | |||
+---------------------------------------------+------------------------+ | |||
| Variable_name | Value | | |||
+---------------------------------------------+------------------------+ | |||
| character_set_database | utf8mb4 | | |||
| collation_database | utf8mb4_general_ci | | |||
| datadir | /var/lib/mysql/ | | |||
| innodb_background_scrub_data_check_interval | 3600 | | |||
| innodb_background_scrub_data_compressed | OFF | | |||
| innodb_background_scrub_data_interval | 604800 | | |||
| innodb_background_scrub_data_uncompressed | OFF | | |||
| innodb_data_file_path | ibdata1:12M:autoextend | | |||
| innodb_data_home_dir | | | |||
| innodb_immediate_scrub_data_uncompressed | OFF | | |||
| innodb_stats_on_metadata | OFF | | |||
| innodb_temp_data_file_path | ibtmp1:12M:autoextend | | |||
| max_length_for_sort_data | 1024 | | |||
| max_long_data_size | 16777216 | | |||
| metadata_locks_cache_size | 1024 | | |||
| metadata_locks_hash_instances | 8 | | |||
| myisam_data_pointer_size | 6 | | |||
| skip_show_database | OFF | | |||
| updatable_views_with_limit | YES | | |||
| wsrep_data_home_dir | /var/lib/mysql/ | | |||
| wsrep_load_data_splitting | ON | | |||
+---------------------------------------------+------------------------+ | |||
</pre> | </pre> | ||
Version vom 8. Februar 2020, 14:09 Uhr
Noch in Bearbeitung
Server A (10.0.0.157) - Teil 1
Die Datei /etc/mysql/mariadb.conf.d/50-server.cnf editieren
sudo vi /etc/mysql/mariadb.conf.d/50-server.cnf
und folgende Zeilen hinzufügen/anpassen:
bind-address=10.0.0.157 server-id = 1 log_bin = /var/log/mysql/mysql-bin.log expire_logs_days = 10 binlog_do_db = powerdns binlog_do_db = ddns replicate-do-db = powerdns replicate-do-db = ddns log-basename = master1
Danach den Server neu starten:
sudo systemctl restart mariadb
CREATE USER 'master'@'%' IDENTIFIED BY '<password>'; GRANT REPLICATION SLAVE ON *.* TO 'master'@'%'; FLUSH PRIVILEGES;
SHOW MASTER STATUS;
+------------------+----------+--------------+------------------+ | File | Position | Binlog_Do_DB | Binlog_Ignore_DB | +------------------+----------+--------------+------------------+ | mysql-bin.000001 | 774 | | | +------------------+----------+--------------+------------------+ 1 row in set (0.000 sec)
Server B (10.0.0.167)
Die Datei /etc/mysql/mariadb.conf.d/50-server.cnf editieren
sudo vi /etc/mysql/mariadb.conf.d/50-server.cnf
und folgende Zeilen hinzufügen/anpassen:
bind-address=10.0.0.167 server-id = 2 log_bin = /var/log/mysql/mysql-bin.log expire_logs_days = 10 binlog_do_db = powerdns binlog_do_db = ddns replicate-do-db = powerdns replicate-do-db = ddns log-basename = master2
Danach den Server neu starten:
sudo systemctl restart mariadb
CREATE USER 'master'@'%' IDENTIFIED BY '<password>'; GRANT REPLICATION SLAVE ON *.* TO 'master'@'%'; FLUSH PRIVILEGES;
STOP SLAVE;
CHANGE MASTER TO MASTER_HOST = '10.0.0.157', MASTER_USER = 'master', MASTER_PASSWORD = '<password>', MASTER_LOG_FILE = 'mysql-bin.000001', MASTER_LOG_POS = 774;
START SLAVE;
SHOW MASTER STATUS;
+------------------+----------+--------------+------------------+ | File | Position | Binlog_Do_DB | Binlog_Ignore_DB | +------------------+----------+--------------+------------------+ | mysql-bin.000001 | 774 | | | +------------------+----------+--------------+------------------+ 1 row in set (0.000 sec)
Server A (10.0.0.157) - Teil 2
mysql -u root -p
STOP SLAVE;
CHANGE MASTER TO MASTER_HOST = '10.0.0.167', MASTER_USER = 'master', MASTER_PASSWORD = '<password>', MASTER_LOG_FILE = 'mysql-bin.000001', MASTER_LOG_POS = 774;
START SLAVE;
Client Status
SHOW SLAVE STATUS\G
Log-Files
MariaDB [(none)]> SHOW VARIABLES LIKE '%data%'; +---------------------------------------------+------------------------+ | Variable_name | Value | +---------------------------------------------+------------------------+ | character_set_database | utf8mb4 | | collation_database | utf8mb4_general_ci | | datadir | /var/lib/mysql/ | | innodb_background_scrub_data_check_interval | 3600 | | innodb_background_scrub_data_compressed | OFF | | innodb_background_scrub_data_interval | 604800 | | innodb_background_scrub_data_uncompressed | OFF | | innodb_data_file_path | ibdata1:12M:autoextend | | innodb_data_home_dir | | | innodb_immediate_scrub_data_uncompressed | OFF | | innodb_stats_on_metadata | OFF | | innodb_temp_data_file_path | ibtmp1:12M:autoextend | | max_length_for_sort_data | 1024 | | max_long_data_size | 16777216 | | metadata_locks_cache_size | 1024 | | metadata_locks_hash_instances | 8 | | myisam_data_pointer_size | 6 | | skip_show_database | OFF | | updatable_views_with_limit | YES | | wsrep_data_home_dir | /var/lib/mysql/ | | wsrep_load_data_splitting | ON | +---------------------------------------------+------------------------+
Probleme
Could not initialize master info structure for ; more error messages can be found in the MariaDB error log
RESET SLAVE;
Links
https://mariadb.com/kb/en/setting-up-replication/
https://forums.mysql.com/read.php?26,171776,205870
https://mariadb.com/kb/en/standard-replication/
Zurück zu MariaDB