zoukankan      html  css  js  c++  java
  • my01_Mysql router 安装


    Mysql router 主要用途是读写分离,主主故障自动切换,负载均衡,连接池等。安装如下

    下载地址:https://dev.mysql.com/downloads/router/

    tar -zxvf mysql-router-2.1.4-el7-x86-64bit.tar.gz
    mv mysql-router-2.1.4-el7-x86-64bit /usr/local/mysql-router

    配置文件
    mkdir /etc/mysql-route/
    mkdir -p /data0/log/mysqlrouter
    mkdir -p /usr/local/mysql-router/data/keyring-data
    chown mysql:mysql /usr/local/mysql-router
    chown mysql:mysql /data0/log/mysqlrouter

    cp /usr/local/mysql-router/share/doc/mysqlrouter/sample_mysqlrouter.conf /etc/mysql-route/mysqlrouter.conf

    vim /etc/mysql-route/mysqlrouter.conf
    [DEFAULT]
    logging_folder = /data0/log/mysqlrouter
    plugin_folder = /usr/local/mysql-router/lib/mysqlrouter
    config_folder = /etc/mysql-route/
    runtime_folder = /usr/local/mysql-router/run
    data_folder = /usr/local/mysql-router/data
    keyring_path = /usr/local/mysql-router/data/keyring-data
    master_key_path = /usr/local/mysql-router/data/keyring-key

    [logger]
    level = INFO

    [routing:basic_failover]
    bind_address=192.168.56.118
    bind_port = 7001
    mode = read-write
    max_connections =256
    max_connect_errors =1000
    client_connect_timeout =20
    destinations = myma1:3306,myma2:3306

    [routing:balancing]
    bind_address=192.168.56.118
    bind_port = 7002
    connect_timeout = 20
    max_connections = 1024
    destinations = myma1:3306,myma2:3306
    mode = read-only

    # If no plugin is configured which starts a service, keepalive
    # will make sure MySQL Router will not immediately exit. It is
    # safe to remove once Router is configured.
    [keepalive]
    interval = 60

    启动配置方式
    mysqlrouter --config /etc/mysql-route/mysqlrouter.conf &

    vim /etc/profile
    PATH=/usr/local/mysql-router/bin:$PATH
    mkdir /usr/local/mysql-router/scripts/

    vim /usr/local/mysql-router/scripts/start_mysqlrouter.sh
    #!/bin/bash
    /usr/local/mysql-router/bin/mysqlrouter --config /etc/mysql-route/mysqlrouter.conf &
    chmod +x start_mysqlrouter.sh

    netstat -tunlp

    写节点
    mysql -h192.168.56.118 -uroot -P7001 -p
    读节点
    mysql -h192.168.56.118 -uroot -P7002 -p

  • 相关阅读:
    Javascript校验密码复杂度的正则表达式
    Git合并指定文件到另一个分支
    WebForm SignalR 实时消息推送
    基于SignalR的消息推送与二维码描登录实现
    yarn 错误There appears to be trouble with your network connection. Retrying...
    使用SqlConnectionStringBuilder构造数据库连接字符串
    邮箱核心业务领域建模
    C# NuGet常用命令
    阿里P7架构师是如何解决跨域问题的!你有遇到吗?
    WinForm 之 自定义标题栏的窗体移动
  • 原文地址:https://www.cnblogs.com/perfei/p/7793734.html
Copyright © 2011-2022 走看看