码迷,mamicode.com
首页 > 数据库 > 详细

mysql主主配置

时间:2019-04-23 17:49:01      阅读:134      评论:0      收藏:0      [点我收藏+]

标签:ges   查看   config   max   二进制日志   完成后   clu   启动   serve   

数据安装完成后

配置信息  开启二进制文件复制

[client]
port=3306
[mysqld]
basedir=/usr/local/mysql
datadir=/usr/local/mysql/data
#socket=/usr/local/mysql/mysql.sock
socket=/tmp/mysql.sock
user=mysql
#skip-grant-tables
# Disabling symbolic-links is recommended to prevent assorted security risks
symbolic-links=0

 

#主从复制配置
server-id=1 #设置server-id
log_bin=mysql-bin #开启二进制日志
expire_logs_days=10
max_binlog_size=100M
binlog-do_db=test_master_slave
binlog_ignore_db=mysql

[mysqld_safe]
log-error=/var/log/mariadb/mariadb.log
pid-file=/var/run/mariadb/mariadb.pid

#
# include all files from the config directory
#
!includedir /etc/my.cnf.d

复制用户授权

GRANT REPLICATION SLAVE ON *.* TO ‘root‘@‘%‘;


查看二进制是否开启

show variables like ‘%log_bin%‘;

查看二进制文件名/id
SHOW MASTER STATUS;

根据二进制文件 配置复制脚本

CHANGE MASTER TO MASTER_HOST=‘192.168.0.114‘,MASTER_USER=‘root‘,MASTER_PASSWORD=‘root‘,MASTER_LOG_FILE=‘mysql-bin.000003‘,MASTER_LOG_POS=154;
CHANGE MASTER TO MASTER_HOST=‘192.168.0.113‘,MASTER_USER=‘root‘,MASTER_PASSWORD=‘root‘,MASTER_LOG_FILE=‘mysql-bin.000002‘,MASTER_LOG_POS=848;

启动复制(更新脚本时需要停止 stop slave)

start slave;

查看配置是否成功
show slave status\G;

刷新
flush privileges;

mysql主主配置

标签:ges   查看   config   max   二进制日志   完成后   clu   启动   serve   

原文地址:https://www.cnblogs.com/yxnyd/p/10757372.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!