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!!!!!!!

  • 相关阅读:
    ES6学习笔记(五)函数的扩展
    ES6学习笔记(四)数值的扩展
    ES6学习笔记(二)变量的解构与赋值
    ES6学习笔记(一)新的变量定义命令let和const
    JS对象继承与原型链
    JS构造函数、对象工厂、原型模式
    获取地图的坐标
    大屏页面
    如何更新git?
    ES6——多个箭头函数
  • 原文地址:https://www.cnblogs.com/Jt00/p/7305939.html
Copyright © 2011-2022 走看看