mysql router安装教程_mysql-router的安装与使用

mysql-router是mysql官方的轻量级的中间件主要有如下工能:功能 & 特性:1、流量分发(只向一个实例导入流量、如果当前的实例宕机了、就会向集群的下一个实例导入流量)2、一定的高可用能力3、比之前的官方中间件mysql-proxy性能上有好一点4、可以与mysql-fabric整合1、下载https://dev.mysql.com/get/Downloads/MySQL-Rou...
摘要由CSDN通过智能技术生成

mysql-router是mysql官方的轻量级的中间件主要有如下工能:

功能 & 特性:

1、流量分发(只向一个实例导入流量、如果当前的实例宕机了、就会向集群的下一个实例导入流量)

2、一定的高可用能力

3、比之前的官方中间件mysql-proxy性能上有好一点

4、可以与mysql-fabric整合

1、下载

https://dev.mysql.com/get/Downloads/MySQL-Router/mysql-router-2.0.4-linux-glibc2.12-x86-64bit.tar.gz

2、安装

tar -xzvf mysql-router-2.0.4-linux-glibc2.12-x86-64bit.tar.gz -C /usr/local/

ln -s /usr/local/mysql-router-2.0.4-linux-glibc2.12-x86-64bit /usr/local/mysqlrouter

export/usr/local/mysqlrouter/bin/:$PATH

3、测试安装是否成功

mysqlrouter --help

MySQL Router v2.0.4 on Linux (64-bit) (GPL community edition)

Copyright (c)2015, 2016, Oracle and/or its affiliates. All rights reserved.

Oracle is a registered trademark of Oracle Corporation and/or its

affiliates. Other names may be trademarks of their respective

owners.

Start MySQL Router.

Configuration read from the following filesinthe given order (enclosedin parentheses means not available forreading):

(./mysqlrouter.ini)

(/root/.mysqlrouter.ini)

Usage: mysqlrouter [-v|--version] [-h|--help]

[-c|--config=]

[-a|--extra-config=]

Options:-v, --version

Display version information and exit.-h, --help

Display this help and exit.-c , --config Only read configuration from givenfile.-a , --extra-config Read thisfileafter configuration files are read from either

default locations or from files specified by the--config

option.

4、配置mysql-router

/usr/local/mysqlrouter/etc/mysqlrouter.cnf

[DEFAULT]

logging_folder=/usr/local/mysqlrouter/run/plugin_folder=/usr/local/mysqlrouter/lib/mysqlrouter/runtime_folder=/usr/local/mysqlrouter/run/config_folder=/usr/local/mysqlrouter/etc/[logger]

level=debug

[routing:7001]

bind_address=0.0.0.0:7001connect_timeout=2mode=read-write#[read-write | read-only]

max_connections =256max_connect_errors=1000client_connect_timeout=2destinations=127.0.0.1:3307,127.0.0.1:3308,127.0.0.1:3309

5、为了测试mysql-router的功能(读写分离+高可用)、于是初始化三个实例(3307,3308,3309)各个实例的配置文件如下

3307

8f900a89c6347c561fdf2122f13be562.png

961ddebeb323a10fe0623af514929fc1.png

[mysql]

auto-rehash

[mysqld]####: for global

user =mysql #mysql

basedir =/usr/local/mysql #/usr/local/mysql/

datadir =/usr/local/datas/3307 #/usr/local/mysql/data

server_id =1 #0

port =3307 #3306

character_set_server =utf8 #latin1

log_timestamps =system #utc

socket =mysql.sock #/tmp/mysql.sock

read_only =0 #off

skip-slave-start =1 #

auto_increment_increment =1 #1

auto_increment_offset =1 #1

lower_case_table_names =1 #0

secure_file_priv = #null

####: for binlog

binlog_format =row #row

log_bin =mysql-bin #off

binlog_rows_query_log_events =on #off

log_slave_updates =on #off

expire_logs_days =4 #0

binlog_cache_size =32768 #32768(32k)

binlog_checksum =none #CRC32

sync_binlog =1 #1

####: for error-log

log_error =error.log #/usr/local/mysql/data/localhost.localdomain.err

####: for slow query log

####: for gtid

gtid_executed_compression_period =1000 #1000

gtid_mode =on #off

enforce_gtid_consistency =on #off

####: for replication

master_info_repository =table #file

relay_log_info_repository =table #file

####: for group replication

transaction_write_set_extraction =XXHASH64 #off

loose-group_replication_group_name ="aaaaaaaa-aaaa-aaaa-aaaa-aaaaaaaaaaaa" #

loose-group_replication_start_on_boot =off #off

loose-group_replication_local

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值