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:"
     
  • 相关阅读:
    js canvas游戏初级demo-上下左右移动
    js java 给定一个目标值,在一棵树中找是否有两个节点的值之和等于目标值
    mysql ON DUPLICATE KEY UPDATE 与 REPLACE INTO 的区别
    js canvas获取图片base64 dataUrl
    一次安卓单机游戏修改经历...
    nodejs 使用superagent+cheerio+eventproxy爬取豆瓣帖子
    express 随笔
    阿里云入坑指南&&nodejs 安装配置
    js 利用jquery.gridly.js实现拖拽并且排序
    js 日期格式化
  • 原文地址:https://www.cnblogs.com/wx1899325/p/12970308.html
Copyright © 2011-2022 走看看