Loading docs/linux/mysql-replication.md +71 −19 Original line number Diff line number Diff line Loading @@ -14,12 +14,22 @@ MariaDB: ```shell [mysqld] # server identification server-id = 1 # network bind-address = 0.0.0.0 # gtid configuration gtid_strict_mode = 1 # binary logging log-bin = /var/log/mysql/mysql-bin.log binlog-format = ROW binlog-do-db = databeast bind-address = 0.0.0.0 gtid_strict_mode = 1 # replication configuration log_slave_updates = 1 ``` Loading @@ -27,13 +37,24 @@ MySQL: ```shell [mysqld] # server identification server-id = 1 # network bind-address = 0.0.0.0 # gtid configuration gtid_mode = ON enforce_gtid_consistency = ON # binary logging log_bin = /var/lib/mysql/mysql-bin.log binlog_format = ROW binlog-expire-logs-seconds = 172800 max_binlog_size = 100M gtid_mode = ON enforce_gtid_consistency = ON binlog-expire-logs-seconds = 172800 # replication configuration log_slave_updates = 1 ``` Loading @@ -58,13 +79,13 @@ FLUSH PRIVILEGES; MariaDB: ```shell mariadb-dump -u root -psupersecuresource --single-transaction --gtid --master-data=1 --databases databeast > /tmp/databeast.sql mariadb-dump -u root -psupersecuresource --single-transaction --gtid --databases databeast > /tmp/databeast.sql ``` MySQL: ```shell mysqldump -u root -psupersecuresource --single-transaction --set-gtid-purged=ON --source-data=1 --databases databeast > /tmp/databeast.sql mysqldump -u root -psupersecuresource --single-transaction --set-gtid-purged=ON --source-data=2 --databases databeast > /tmp/databeast.sql ``` ## Configure replicate Loading @@ -79,33 +100,64 @@ MariaDB: ```shell [mysqld] # server identification server-id = 2 read-only = 1 relay-log = /var/log/mysql/mysql-relay-bin log-bin = /var/log/mysql/mysql-bin.log binlog-format = ROW # network bind-address = 0.0.0.0 # gtid configuration gtid_strict_mode = 1 # binary logging log-bin = /var/log/mysql/mysql-bin.log binlog-format = ROW # replication configuration log_slave_updates = 1 relay-log = /var/log/mysql/mysql-relay-bin # parallel replication slave_parallel_mode = optimistic slave_parallel_threads = 2 # read-only replica read-only = 1 ``` MySQL: ```shell [mysqld] # server identification server-id = 2 relay_log = /var/lib/mysql/mysql-relay-bin read_only = 1 replicate-do-db = databeast # network bind-address = 0.0.0.0 # gtid configuration gtid_mode = ON enforce_gtid_consistency = ON # binary logging log_bin = /var/lib/mysql/mysql-bin.log binlog_format = ROW binlog-expire-logs-seconds = 172800 max_binlog_size = 100M gtid_mode = ON enforce_gtid_consistency = ON binlog-expire-logs-seconds = 172800 # replication configuration log_slave_updates = 1 slave_parallel_type = 'LOGICAL_CLOCK' relay_log = /var/lib/mysql/mysql-relay-bin replicate-do-db = databeast # parallel replication slave_parallel_type = LOGICAL_CLOCK slave_parallel_workers = 2 # read-only replica read_only = 1 ``` Restart mariadb: `systemctl restart mariadb` Loading Loading @@ -187,7 +239,7 @@ mysql -u root -p ``` ```shell SHOW REPLICA STATUS\G SHOW SLAVE STATUS\G *************************** 1. row *************************** Slave_IO_State: Waiting for master to send event Master_Host: source.example.com Loading Loading
docs/linux/mysql-replication.md +71 −19 Original line number Diff line number Diff line Loading @@ -14,12 +14,22 @@ MariaDB: ```shell [mysqld] # server identification server-id = 1 # network bind-address = 0.0.0.0 # gtid configuration gtid_strict_mode = 1 # binary logging log-bin = /var/log/mysql/mysql-bin.log binlog-format = ROW binlog-do-db = databeast bind-address = 0.0.0.0 gtid_strict_mode = 1 # replication configuration log_slave_updates = 1 ``` Loading @@ -27,13 +37,24 @@ MySQL: ```shell [mysqld] # server identification server-id = 1 # network bind-address = 0.0.0.0 # gtid configuration gtid_mode = ON enforce_gtid_consistency = ON # binary logging log_bin = /var/lib/mysql/mysql-bin.log binlog_format = ROW binlog-expire-logs-seconds = 172800 max_binlog_size = 100M gtid_mode = ON enforce_gtid_consistency = ON binlog-expire-logs-seconds = 172800 # replication configuration log_slave_updates = 1 ``` Loading @@ -58,13 +79,13 @@ FLUSH PRIVILEGES; MariaDB: ```shell mariadb-dump -u root -psupersecuresource --single-transaction --gtid --master-data=1 --databases databeast > /tmp/databeast.sql mariadb-dump -u root -psupersecuresource --single-transaction --gtid --databases databeast > /tmp/databeast.sql ``` MySQL: ```shell mysqldump -u root -psupersecuresource --single-transaction --set-gtid-purged=ON --source-data=1 --databases databeast > /tmp/databeast.sql mysqldump -u root -psupersecuresource --single-transaction --set-gtid-purged=ON --source-data=2 --databases databeast > /tmp/databeast.sql ``` ## Configure replicate Loading @@ -79,33 +100,64 @@ MariaDB: ```shell [mysqld] # server identification server-id = 2 read-only = 1 relay-log = /var/log/mysql/mysql-relay-bin log-bin = /var/log/mysql/mysql-bin.log binlog-format = ROW # network bind-address = 0.0.0.0 # gtid configuration gtid_strict_mode = 1 # binary logging log-bin = /var/log/mysql/mysql-bin.log binlog-format = ROW # replication configuration log_slave_updates = 1 relay-log = /var/log/mysql/mysql-relay-bin # parallel replication slave_parallel_mode = optimistic slave_parallel_threads = 2 # read-only replica read-only = 1 ``` MySQL: ```shell [mysqld] # server identification server-id = 2 relay_log = /var/lib/mysql/mysql-relay-bin read_only = 1 replicate-do-db = databeast # network bind-address = 0.0.0.0 # gtid configuration gtid_mode = ON enforce_gtid_consistency = ON # binary logging log_bin = /var/lib/mysql/mysql-bin.log binlog_format = ROW binlog-expire-logs-seconds = 172800 max_binlog_size = 100M gtid_mode = ON enforce_gtid_consistency = ON binlog-expire-logs-seconds = 172800 # replication configuration log_slave_updates = 1 slave_parallel_type = 'LOGICAL_CLOCK' relay_log = /var/lib/mysql/mysql-relay-bin replicate-do-db = databeast # parallel replication slave_parallel_type = LOGICAL_CLOCK slave_parallel_workers = 2 # read-only replica read_only = 1 ``` Restart mariadb: `systemctl restart mariadb` Loading Loading @@ -187,7 +239,7 @@ mysql -u root -p ``` ```shell SHOW REPLICA STATUS\G SHOW SLAVE STATUS\G *************************** 1. row *************************** Slave_IO_State: Waiting for master to send event Master_Host: source.example.com Loading