溫馨提示×

您好,登錄后才能下訂單哦!

密碼登錄×
登錄注冊(cè)×
其他方式登錄
點(diǎn)擊 登錄注冊(cè) 即表示同意《億速云用戶服務(wù)條款》

centos7上mariadb主主復(fù)制

發(fā)布時(shí)間:2020-06-24 03:34:04 來(lái)源:網(wǎng)絡(luò) 閱讀:129 作者:劉小潭 欄目:系統(tǒng)運(yùn)維

mariadb1: 192.168.11.247

mariadb2: 192.168.11.246

1 mariadb1配置
vi /etc/my.cnf.d/server.cnf

[mysqld]

server-id = 1

log-bin = master-log

relay-log = slave-log

auto_increment_offset = 1

auto_increment_increment = 2

2 mariadb2配置
vi /etc/my.cnf.d/server.cnf

[mysqld]

server-id = 2

log-bin = master-log

relay-log = slave-log

auto_increment_offset = 2

auto_increment_increment = 2

3 重啟mariadb服務(wù)

systemctl restart mariadb

4 mariadb1主, mariadb2從配置

mariadb1在sql里面執(zhí)行:
MariaDB [(none)]> create user 'lan'@'192.168.11.%' identified by '666666';
MariaDB [(none)]> grant replication slave on . to 'lan'@'192.168.11.%';
show master status;

mariadb2在sql里面執(zhí)行:
#log_file和log_pos的數(shù)據(jù)是mariad1上show master status得到的數(shù)據(jù)
change master to master_host='192.168.11.247', master_user='lan', master_password='666666', master_log_file='master-log.000001', master_log_pos=498;
start slave;
show slave status\G;

5 mariadb2為主, mariadb1從配置

mariadb2在sql里面執(zhí)行:
MariaDB [(none)]> create user 'lan'@'192.168.11.%' identified by '666666';
MariaDB [(none)]> grant replication slave on . to 'lan'@'192.168.11.%';
show master status;

mariadb1在sql里面執(zhí)行:
#log_file和log_pos的數(shù)據(jù)是mariad2上show master status得到的數(shù)據(jù)
change master to master_host='192.168.11.246', master_user='lan', master_password='666666', master_log_file='master-log.000001', master_log_pos=498;
start slave;
show slave status\G;

至此, 主主同步復(fù)制配置完成,撒花
[詳情請(qǐng)點(diǎn)擊]](https://www.aigony.com/pages/viewpage.action?pageId=1376296)

向AI問(wèn)一下細(xì)節(jié)

免責(zé)聲明:本站發(fā)布的內(nèi)容(圖片、視頻和文字)以原創(chuàng)、轉(zhuǎn)載和分享為主,文章觀點(diǎn)不代表本網(wǎng)站立場(chǎng),如果涉及侵權(quán)請(qǐng)聯(lián)系站長(zhǎng)郵箱:is@yisu.com進(jìn)行舉報(bào),并提供相關(guān)證據(jù),一經(jīng)查實(shí),將立刻刪除涉嫌侵權(quán)內(nèi)容。

AI