02 Jul 2020
Note: This requires two servers with a running MariaDB installation.
MariaDB Config
(on both servers)
- Add MariaDB config in the
[mysqld]section:log-bin server_id=1 log-basename=<$REPLICATION_NAME> replicate-do-db=<$REPLICATION_DATABASE> bind-address=0.0.0.0 - Restart MariaDB service.
- Open a
mysqlshell. - Create user for replication:
CREATE USER '<$REPLICATION_USER>'@'%' IDENTIFIED BY '<$REPLICATION_PASSWORD>'; - Grant permission to replication user:
GRANT REPLICATION REPLICA ON *.* TO '<$REPLICATION_USER>'@'%'; FLUSH PRIVILEGES;
Replication Setup
- (server1) Query Master status and note
FileandPositionfor the next step:SHOW MASTER STATUS; - (server2) Configure replication:
STOP REPLICA; CHANGE MASTER TO MASTER_HOST='<$SERVER1_IP>', MASTER_USER='<$REPLICATION_USER>', MASTER_PASSWORD='<$REPLICATION PASSWORD>', MASTER_LOG_FILE='<$FILE>', MASTER_LOG_POS=<$POSITION>; START REPLICA; - (server2) Query Master status and note
FileandPositionfor the next step:SHOW MASTER STATUS; - (server1) Configure replication:
STOP REPLICA; CHANGE MASTER TO MASTER_HOST='<$SERVER2_IP>', MASTER_USER='<$REPLICATION_USER>', MASTER_PASSWORD='<$REPLICATION PASSWORD>', MASTER_LOG_FILE='<$FILE>', MASTER_LOG_POS=<$POSITION>; START REPLICA;

Comments
Nothing yet. Say the first thing.
Sign in to join the conversation.