在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中成功配置主从复制。
辰迅云「云服务器」,即开即用、新一代英特尔至强铂金CPU、三副本存储NVMe SSD云盘,价格低至29元/月。点击查看>>
推荐阅读: MariaDB中如何使用存储过程和函数