碼迷,mamicode.com
首頁 > 數據庫 > 詳細

linux上mysql MM(雙主)架構及keepalived搭建

時間:2019-07-11 17:35:31      閱讀:31      評論:0      收藏:0      [點我收藏+]

標簽:star   file   incr   auto   配置   stat   date   nlog   搭建极速时时彩走势图   


master1 10.1.1.14 VIP 10.1.1.16
极速时时彩走势图master2 10.1.1.15 VIP 10.1.1.16

一.mysql MM配置
1.修改master1的my.cnf
# vi /etc/my.cnf
[mysqld]
basedir = /usr/local/mysql/
datadir=/usr/local/mysql/data
log-error=/usr/local/mysql/mysqld.log
port = 3306
socket=/usr/local/mysql/mysql.sock
pid-file=/usr/local/mysql/mysql.pid

极速时时彩走势图expire-logs-days=10

#binlog-do-db=db1
#binlog-ignore-db=db2

server-id = 1
log-bin = binlog
relay_log = relay-bin
log_slave_updates =1
auto_increment_increment=2
auto_increment_offset=1

2.修改master2的my.cnf
# vim /etc/my.cnf
[mysqld]
basedir = /usr/local/mysql/
datadir=/usr/local/mysql/data
log-error=/usr/local/mysql/mysqld.log
port = 3306
socket=/usr/local/mysql/mysql.sock
pid-file=/usr/local/mysql/mysql.pid

expire-logs-days=10

#binlog-do-db=db1
极速时时彩走势图#binlog-ignore-db=db2

server-id=2
relay_log=relay-bin
log_bin =binlog
log_slave_updates =1
auto_increment_increment=2
极速时时彩走势图auto_increment_offset=2


3.創建master1復制賬號
grant replication slave,replication client on *.* to ‘repl‘@‘10.1.1.15‘ identified by ‘repl‘;

4.創建master2復制賬號
grant replication slave,replication client on *.* to ‘repl‘@‘10.1.1.14‘ identified by ‘repl‘;

5.為master1配置master
show master status;
change master to master_host=‘10.1.1.15‘,master_user=‘repl‘,master_password=‘repl‘,master_log_file=‘binlog.000005‘,master_log_pos=154;


6.為master2配置master
show master status;
change master to master_host=‘10.1.1.14‘,master_user=‘repl‘,master_password=‘repl‘,master_log_file=‘binlog.000001‘,master_log_pos=154;

7.啟動slave
master1:
start slave;
master2:
start slave;

linux上mysql MM(雙主)架構及keepalived搭建

標簽:star   file   incr   auto   配置   stat   date   nlog   搭建   

原文地址:https://www.cnblogs.com/lhdz_bj/p/11170906.html

(0)
(0)
   
舉報
評論 一句話評論(0
0條  
登錄后才能評論!
           
? 2014 mamicode.com 版權所有 京ICP備13008772號-2
迷上了代碼!