zoukankan      html  css  js  c++  java
  • MySQL主主

    master1:
    1)设置slave数据库的my.cnf配置文件
    [root@node1 ~]# vim /etc/my.cnf
    server-id=1
    log-bin=mysql-bin
    2)配置数据库
    mysql> grant replication slave,replication client,select on *.* to slave@'192.168.1.%' identified by 'Slave@123';
    mysql> flush privileges;
    mysql> show master status;
    +------------------+----------+--------------+------------------+-------------------+
    | File             | Position | Binlog_Do_DB | Binlog_Ignore_DB | Executed_Gtid_Set |
    +------------------+----------+--------------+------------------+-------------------+
    | mysql-bin.000003 |      154 |              | mysql            |                   |
    +------------------+----------+--------------+------------------+-------------------+
    3)指定master2
    mysql> stop slave;
    mysql> charge master to master_host="192.168.1.200",master_user="slave",master_password="123456",master_log_file="mysql-bin.000004",master_log_pos=160;
    mysql> start slave;
    mysql> show slave statusG;
    master2:
    1)设置slave数据库的my.cnf配置文件

    [root@node1 ~]# vim /etc/my.cnf
    server-id=2
    log-bin=mysql-bin

     2)配置数据库

    
    mysql> grant replication slave,replication client,select on *.* to slave@'192.168.1.%' identified by 'Slave@123';
    mysql> flush privileges;
    mysql> show master status;
    +------------------+----------+--------------+------------------+-------------------+
    | File             | Position | Binlog_Do_DB | Binlog_Ignore_DB | Executed_Gtid_Set |
    +------------------+----------+--------------+------------------+-------------------+
    | mysql-bin.000004 |      160 |              | mysql            |                   |
    +------------------+----------+--------------+------------------+-------------------+

    3)指定master1

    mysql> stop slave;
    mysql> charge master to master_host="192.168.1.200",master_user="slave",master_password="123456",master_log_file="mysql-bin.000003",master_log_pos=154;
    mysql> start slave;
    mysql> show slave statusG;
  • 相关阅读:
    基于PowerShell的Lync Server管理 使用C#
    现在不使用ZeroClipboard我们也能实现复制功能(转)
    手机购物车添加动画
    jq获取元素到底部的距离
    LocalStorage 本地存储
    replace()替换文字扑获组做法
    js原生removeclass方法
    现代浏览器原生js获取id号方法
    手机版浏览器禁止滚动条与释放实例
    wamp设置实现本机IP或者局域网访问 (转)
  • 原文地址:https://www.cnblogs.com/fengyuanfei/p/14498156.html
Copyright © 2011-2022 走看看