zoukankan      html  css  js  c++  java
  • Mycat-主从结构的准备

    1.6 节点主从规划
    箭头指向谁是主库
        10.0.0.51:3307    <----->  10.0.0.52:3307
        10.0.0.51:3309    ------>  10.0.0.51:3307
        10.0.0.52:3309    ------>  10.0.0.52:3307
        10.0.0.52:3308  <----->    10.0.0.51:3308
        10.0.0.52:3310  ----->     10.0.0.52:3308
        10.0.0.51:3310  ----->     10.0.0.51:3308
    1.7 开始配置
    ##shard1
    ## 10.0.0.51:3307 <-----> 10.0.0.52:3307
    # db02
    mysql  -S /data/3307/mysql.sock -e "grant replication slave on *.* to repl@'10.0.0.%' identified by '123';"
    mysql  -S /data/3307/mysql.sock -e "grant all  on *.* to root@'10.0.0.%' identified by '123'  with grant option;"
    # db01
    mysql  -S /data/3307/mysql.sock -e "CHANGE MASTER TO MASTER_HOST='10.0.0.52', MASTER_PORT=3307, MASTER_AUTO_POSITION=1, MASTER_USER='repl', MASTER_PASSWORD='123';"
    mysql  -S /data/3307/mysql.sock -e "start slave;"
    mysql  -S /data/3307/mysql.sock -e "show slave statusG"
    # db02
    mysql  -S /data/3307/mysql.sock -e "CHANGE MASTER TO MASTER_HOST='10.0.0.51', MASTER_PORT=3307, MASTER_AUTO_POSITION=1, MASTER_USER='repl', MASTER_PASSWORD='123';"
    mysql  -S /data/3307/mysql.sock -e "start slave;"
    mysql  -S /data/3307/mysql.sock -e "show slave statusG"
    ## 10.0.0.51:3309 ------> 10.0.0.51:3307
    # db01
    mysql  -S /data/3309/mysql.sock  -e "CHANGE MASTER TO MASTER_HOST='10.0.0.51', MASTER_PORT=3307, MASTER_AUTO_POSITION=1, MASTER_USER='repl', MASTER_PASSWORD='123';"
    mysql  -S /data/3309/mysql.sock  -e "start slave;"
    mysql  -S /data/3309/mysql.sock  -e "show slave statusG"
    ## 10.0.0.52:3309 ------> 10.0.0.52:3307
    # db02
    mysql  -S /data/3309/mysql.sock -e "CHANGE MASTER TO MASTER_HOST='10.0.0.52', MASTER_PORT=3307, MASTER_AUTO_POSITION=1, MASTER_USER='repl', MASTER_PASSWORD='123';"
    mysql  -S /data/3309/mysql.sock -e "start slave;"
    mysql  -S /data/3309/mysql.sock -e "show slave statusG"

    ## shard2
    ## 10.0.0.52:3308 <-----> 10.0.0.51:3308
    # db01
    mysql  -S /data/3308/mysql.sock -e "grant replication slave on *.* to repl@'10.0.0.%' identified by '123';"
    mysql  -S /data/3308/mysql.sock -e "grant all  on *.* to root@'10.0.0.%' identified by '123'  with grant option;"
    # db02
    mysql  -S /data/3308/mysql.sock -e "CHANGE MASTER TO MASTER_HOST='10.0.0.51', MASTER_PORT=3308, MASTER_AUTO_POSITION=1, MASTER_USER='repl', MASTER_PASSWORD='123';"
    mysql  -S /data/3308/mysql.sock -e "start slave;"
    mysql  -S /data/3308/mysql.sock -e "show slave statusG"
    # db01
    mysql  -S /data/3308/mysql.sock -e "CHANGE MASTER TO MASTER_HOST='10.0.0.52', MASTER_PORT=3308, MASTER_AUTO_POSITION=1, MASTER_USER='repl', MASTER_PASSWORD='123';"
    mysql  -S /data/3308/mysql.sock -e "start slave;"
    mysql  -S /data/3308/mysql.sock -e "show slave statusG"
    ## 10.0.0.52:3310 -----> 10.0.0.52:3308
    # db02
    mysql  -S /data/3310/mysql.sock -e "CHANGE MASTER TO MASTER_HOST='10.0.0.52', MASTER_PORT=3308, MASTER_AUTO_POSITION=1, MASTER_USER='repl', MASTER_PASSWORD='123';"
    mysql  -S /data/3310/mysql.sock -e "start slave;"
    mysql  -S /data/3310/mysql.sock -e "show slave statusG"

    ## 10.0.0.51:3310 -----> 10.0.0.51:3308
    # db01
    mysql  -S /data/3310/mysql.sock -e "CHANGE MASTER TO MASTER_HOST='10.0.0.51', MASTER_PORT=3308, MASTER_AUTO_POSITION=1, MASTER_USER='repl', MASTER_PASSWORD='123';"
    mysql  -S /data/3310/mysql.sock -e "start slave;"
    mysql  -S /data/3310/mysql.sock -e "show slave statusG"

    1.8 检测主从状态
    mysql -S /data/3307/mysql.sock -e "show slave statusG"|grep "Running:"
    mysql -S /data/3308/mysql.sock -e "show slave statusG"|grep "Running:"
    mysql -S /data/3309/mysql.sock -e "show slave statusG"|grep "Running:"
    mysql -S /data/3310/mysql.sock -e "show slave statusG"|grep "Running:"
     
  • 相关阅读:
    java 读取配置文件
    oracle sql 截取表中某一字段的部分作为该字段查询结果
    大数据课堂
    网站保存
    Tensorflow+Keras 深度学习人工智能实践应用 Chapter Two 深度学习原理
    Tensorflow+Keras 深度学习人工智能实践应用 Chapter One人工智能 机器学习与深度学习简介
    Python 机器学习及实践 Coding 无监督学习经典模型 数据聚类 and 特征降维
    博客地址的保存
    备注
    个人笔记-
  • 原文地址:https://www.cnblogs.com/wx1899325/p/12970308.html
Copyright © 2011-2022 走看看