mysql 代理 双主_mysql双主双从

内容纲要

配置 除了server-id不一样外,2实例其他配置均一样

[client]

socket = /tmp/mysql57.sock

[mysqld]

user = mysql

port = 3307

socket = /tmp/mysql57.sock

basedir = /usr/local/mysql

datadir = /data/mysql/data

#open-files-limit = 8192

log-error = /data/mysql/log/mysql_3307_error.log

pid-file = /data/mysql/mysql_3307.pid

######server####################

server-id = 1

##不给从机同步的库(多个写多行)

binlog-ignore-db=mysql

binlog-ignore-db=information_schema

binlog-ignore-db=performance_schema

binlog-ignore-db=sys

##开启二进制日志

log-bin=/data/mysql/binary/57

log_slave_updates=1

relay-log=relay-log-bin

slave-skip-errors=all

##自动清理 7 天前的log文件,可根据需要修改

expire_logs_days=7

15,16主机均执行命令:

mysql> reset master;

Query OK, 0 rows affected

mysql> show master status;

+-----------+----------+--------------+-------------------------------------------------+-------------------+

| File | Position | Binlog_Do_DB | Binlog_Ignore_DB | Executed_Gtid_Set |

+-----------+----------+--------------+-------------------------------------------------+-------------------+

| 57.000001 | 154 | | mysql,information_schema,performance_schema,sys | |

+-----------+----------+--------------+-------------------------------------------------+-------------------+

1 row in set

15主机执行命令:

mysql> change master to master_host='192.168.10.16', master_port=3307, master_user='root', master_password='xxx', master_log_file='57.000001',master_log_pos=154;

mysql> start slave;

Query OK, 0 rows affected

16主机执行命令:

mysql> change master to master_host='192.168.10.15', master_port=3307, master_user='root', master_password='xxx', master_log_file='57.000001',master_log_pos=154;

mysql> start slave;

Query OK, 0 rows affected

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值