环境说明 OS:Centos7 Mysql:5。7。38 主:10。4。7。41 备:10。4。7。42基础环境处理 略Mysql安装 略Mysql主从配置 Master配置lowercasetablenames1charactersetserverutf8maxconnections1024serverid104741主从id一定要配置不同logbinmysqlbinbinlogignoredbmysqlbinlogignoredbinformationschemabinlogignoredbperformanceschemaexpirelogsdays7 Slave配置lowercasetablenames1charactersetserverutf8maxconnections1024serverid104742主从id一定要配置不同logbinmysqlbinbinlogignoredbinformationschemabinlogignoredbperformanceschemabinlogignoredbmysqlreplicateignoredbmysql。logslaveupdatesslaveskiperrorsallslavenettimeout60expirelogsdays7 配置说明: binlogignoredb:忽略某个库binlog日志记录,一般在主库上配置 binlogdodb:记录某个库binlog日志记录,一般在主库上配置 replicateignoredb:用来设置不需要同步的库,一般在从库上配置 replicatedodb:用来设置需要同步的库,一般在从库上配置 创建数据同步用户grantreplicationslave,reload,superon。tosyncslaveidentifiedbyAa123456?;flushprivileges;showmasterstatus; 查看master状态 创建数据同步配置changemastertomasterhost10。4。7。41,masterusersyncslave,masterpasswordAa123456?,masterlogfilemysqlbin。000002,masterlogpos154; 查看主从同步状态showslavestatusG; 只有看到下图中两个Running的状态都是Yes的时候才说明主从同步正常。 主从同步状态