在MariaDB中配置主從復制,需要完成以下步驟:
server-id = 1
log_bin = /var/log/mysql/mysql-bin.log
binlog_do_db = YOUR_DATABASE_NAME
CREATE USER 'repl'@'slave_ip' IDENTIFIED BY 'password';
GRANT REPLICATION SLAVE ON *.* TO 'repl'@'slave_ip';
SHOW MASTER STATUS;
server-id = 2
CHANGE MASTER TO MASTER_HOST='master_ip', MASTER_USER='repl', MASTER_PASSWORD='password', MASTER_LOG_FILE='mysql-bin.000001', MASTER_LOG_POS=107;
START SLAVE;
SHOW SLAVE STATUS\G;
通過以上配置和步驟,就可以在MariaDB中成功配置主從復制。