Home > Database > Mysql Tutorial > MySQL 5.5 主从双向同步

MySQL 5.5 主从双向同步

WBOY
Release: 2016-06-07 17:23:57
Original
810 people have browsed it

MySQL的5.5版本已经不支持在my.cnf中配置同步的主机信息了,即master-host等字段,否则MySQL会启不动,这点要注意下,网上也有很

在Red Hat Enterprise Linux平台,利用MySQL主从同步原理,实现MySQL双向同步
MySQL版本:5.5.28
操作系统:RHEL 5.8 32bit

Server1:192.168.1.1
配置:my.cnf

同步testdb数据库,这里不对mysql数据库进行同步
新增同步用户:

  • grant replication slave on *.* to slaveuser@192.168.1.2 identified by '123456';
  • 启动Sever1;

  • service mysql start
  • 查看MySQL同步binlog文件名以及pos值:

  • show master status;
  • Server2:192.168.1.2
    配置:my.cnf

    与Sever1配置基本相同,,只是server-id不同,而且不能相同,另外记得在[mysqld]配置区域里配置开启二进制日志记录:log-bin = mysql-bin
    新增同步用户:

  • grant replication slave on *.* to slaveuser@192.168.1.1 identified by '123456';
  • 启动Server2:

  • service mysql start
  • 配置同步:

    linux

    source:php.cn
    Statement of this Website
    The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
    Popular Tutorials
    More>
    Latest Downloads
    More>
    Web Effects
    Website Source Code
    Website Materials
    Front End Template