网站维护的具体问题,建设网站的网站叫什么男,成都网页设计,滑县网站建设哪家专业参考博文#xff1a;MySQL-(Master-Slave)配置 本人按照博友北在北方的配置已成功 我使用的是 mysql5.6.27版本。配置中 又进一步对mysql5.6的日志进行了了解 #xff1a;mysql日志详细解析1.安装注意#xff1a;只能安装在64位的Linux操作系统上#xff0c;CentOS官方建…参考博文MySQL-(Master-Slave)配置 本人按照博友北在北方的配置已成功 我使用的是 mysql5.6.27版本。配置中 又进一步对mysql5.6的日志进行了了解 mysql日志详细解析1.安装注意只能安装在64位的Linux操作系统上CentOS官方建议rpm安装方式目前最新的版本为Atlas-2.2.1.el5.x86_64.rpm CentOS 5.* 版本Atlas-2.2.1.el6.x86_64.rpm CentOS 6.* 版本安装命令[rootjhq0229 src]# rpm -i Atlas-2.2.1.el6.x86_64.rpm安装位置/usr/local/mysql-proxy配置文件/usr/local/mysql-proxy/conf/test.cnf2、编写简单Atlas的启动脚本[rootjhq0229 ~]# vim /etc/init.d/atlas#!/bin/sh##atlas: Atlas Daemon## chkconfig:- 90 25# description: Atlas Daemon## Source function library.start(){echo-n $Starting atlas:/usr/local/mysql-proxy/bin/mysql-proxyd test startecho}stop(){echo-n $Shutting down atlas:/usr/local/mysql-proxy/bin/mysql-proxyd test stopecho}ATLAS/usr/local/mysql-proxy/bin/mysql-proxyd[-f $ATLAS ] || exit 1# See how we were called.case $1 instart)start;;stop)stop;;restart)stopsleep 1start;;*)echo $Usage: $0 {start|stop|restart}exit1esacexit0授权并加入开机启动[rootjhq0229~]# chmod x /etc/init.d/atlas[rootjhq0229~]# chkconfig atlas on启动atlas服务[rootjhq0229~]# service atlas start3、注意事项3.1 主master上的 mysql 重新启动主master上的 mysql 每重新启动一次 配置在master 上的 “在master上查看 binary log文件名和 position”就会发生改变如下mysqlshow master status;-------------------------------------------------------------------------------| File | Position | Binlog_Do_DB | Binlog_Ignore_DB | Executed_Gtid_Set |-------------------------------------------------------------------------------| mysql-bin.000005 | 276 | | | |-------------------------------------------------------------------------------1 row in set (0.00sec)重新启动mysql服务后mysqlshow master status;ERROR2006(HY000): MySQL server has gone awayNo connection. Trying to reconnect...Connection id:3Current database: mysql-------------------------------------------------------------------------------| File | Position | Binlog_Do_DB | Binlog_Ignore_DB | Executed_Gtid_Set |-------------------------------------------------------------------------------| mysql-bin.000006 | 120 | | | |-------------------------------------------------------------------------------1 row in set (0.08 sec)这就会导致 从slave上的配置失效从而导致主-从无法同步所以每次重新启动 主(master)上的mysql服务都需要修改 从(slave)上的配置。目前只能这么做具体需要怎么改 再研究。mysql change master to master_host192.168.29.128,master_userrepl,master_password123456,master_port3306,master_log_filemysql-bin.000006,master_log_pos120,master_connect_retry10;Query OK,0 rows affected, 2 warnings (0.30 sec)3.2 从slave上的 mysql 重新启动从slave上的 mysql 重新启动 会导致 主从配置失效无法完成写同步功能所以需要重启 mysql服务后 重新启动 slave