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

    1.在MySQL主从的基础上修改:

    #master1上

    [mysqld]

    server-id=101

    log-bin = mysql-bin

    auto-increment-increment = 2

    auto-increment-offset = 1000

    #master2上

    [mysqld]

    server-id=103

    log-bin = mysql-bin

    auto-increment-increment = 2

    auto-increment-offset = 1001

    2、分别为俩台master创建各种的用户供对方使用

    #master1的机器上
    mysql> CREATE USER 'master1'@'%' IDENTIFIED BY '123456';
    
    #master2的机器上
    mysql> CREATE USER 'master2'@'%' IDENTIFIED BY '123456'; 

    3、分别给用户授予复制权限

    #master1的机器上
    mysql> GRANT REPLICATION SLAVE  ON *.* TO 'master1'@'%' IDENTIFIED BY '123456';
    
    #master2的机器上
    mysql> GRANT REPLICATION SLAVE  ON *.* TO 'master2'@'%' IDENTIFIED BY '123456';

    4、分别重启服务,通过show master status 查看二进制文件名称还有pos位置,为slave配置复制位置

    5.分别切换master,注意master_log_file还有master_log_pos

    #master1的机器上

    mysql> change master to master_host='192.168.137.103',master_user='master2',master_password='123456',master_log_file='mysql-bin.000003',master_log_pos=951;

    #master2的机器上

    mysql> change master to master_host='192.168.137.101',master_user='master1',master_password='123456',master_log_file='mysql-bin.000004',master_log_pos=698;

    6.然后启动验证:

    start slave

    ok!!!!!!!

  • 相关阅读:
    解析链接部分
    按指定格式输出日期时间
    Comet:基于 HTTP 长连接的“服务器推”技术
    dialog组件
    中文字符截断的问题
    css垂直水平居中方案
    类的创建
    修改placeholder属性
    json化表单数据
    瀑布流布局
  • 原文地址:https://www.cnblogs.com/Jt00/p/7305939.html
Copyright © 2011-2022 走看看