mysql-MHA预发布环境架构分享(三)之AB复制

【主:10.142.132.52 mysql配置文件】

[mysqld]

datadir=/app/mysql/data

socket =/app/mysql/data/mysql.sock

lower_case_table_names=1

character-set-server=utf8

collation-server=utf8_general_ci

server_id =1

wait_timeout=360000

log-bin=binlog

log-bin-index=binlog.index

log_slave_updates=1

sync-binlog = 1

auto_increment_offset = 2

auto_increment_increment = 2


[client]

#default-character-set=utf8


[mysql.server]

user=mysql

basedir=/app/mysql

default-character-set=utf8


[mysqld_safe]

err-log=/app/mysql/errlog/mysqld.log




 

【从1:10.142.132.51 mysql配置文件】 

[mysqld]

datadir=/app/mysql/data

socket =/app/mysql/data/mysql.sock

lower_case_table_names=1

character-set-server=utf8

collation-server=utf8_general_ci

relay_log_purge=0

server_id =2

wait_timeout=360000

log-bin=binlog

log-bin-index=binlog.index

log_slave_updates=1

sync-binlog = 1

auto_increment_offset = 1

auto_increment_increment = 2


[client]

#default-character-set=utf8


[mysql.server]

user=mysql

basedir=/app/mysql

default-character-set=utf8


[mysqld_safe]

err-log=/app/mysql/errlog/mysqld.log





【从2:10.142.132.48 mysql配置文件】 

[mysqld]

datadir=/app/mysql/data

socket =/app/mysql/data/mysql.sock

lower_case_table_names=1

character-set-server=utf8

collation-server=utf8_general_ci

read_only=1

relay_log_purge=0

server_id = 3

relay_log = /app/mysql/mysql-relay-bin

relay_log_index=/app/mysql/mysql-relay-bin.index

wait_timeout=360000


[client]

#default-character-set=utf8

socket =/app/mysql/data/mysql.sock


[mysql.server]

user=mysql

basedir=/app/mysql

default-character-set=utf8


[mysqld_safe]

err-log=/app/mysql/errlog/mysqld.log





【从3:10.142.132.47 mysql配置文件】 

[mysqld]

datadir=/app/mysql/data

socket =/app/mysql/data/mysql.sock

lower_case_table_names=1

character-set-server=utf8

collation-server=utf8_general_ci

read_only=1

relay_log_purge=0

server_id = 4

relay_log = /app/mysql/mysql-relay-bin

relay_log_index=/app/mysql/mysql-relay-bin.index

wait_timeout=360000



[client]

#default-character-set=utf8


[mysql.server]

user=mysql

basedir=/app/mysql

default-character-set=utf8


[mysqld_safe]

err-log=/app/mysql/errlog/mysqld.log              




AB复制


【主库】   


mysql> GRANT replication slave ON *.* TO ‘lipengfei‘@‘%‘ identified by ‘lipengfei‘;

         

mysql> show master status\G;

*************************** 1. row ***************************

             File: binlog.000001

         Position: 120

     Binlog_Do_DB: 

 Binlog_Ignore_DB: 

Executed_Gtid_Set: 

1 row in set (0.00 sec)


【所有从库】   


mysql> change master to master_host=‘10.142.132.52‘, master_port=3306, master_user=‘lipengfei‘, master_password=‘lipengfei‘, master_log_file=‘binlog.000001‘,master_log_pos=120;


mysql> start slave;





本文出自 “李鹏飞oracle” 博客,请务必保留此出处http://lipengfei666666.blog.51cto.com/6384154/1613945

郑重声明:本站内容如果来自互联网及其他传播媒体,其版权均属原媒体及文章作者所有。转载目的在于传递更多信息及用于网络分享,并不代表本站赞同其观点和对其真实性负责,也不构成任何其他建议。