MySQL Router 安装与配置

1.9. MySQL Router

1.9.1. 安装 MySQL Router

# yum install mysql-router -y

MySQL Router 软件包中所含的文件。

[root@netkiller ~]# rpm -ql mysql-router-2.0.3-1.el7
/etc/mysqlrouter
/etc/mysqlrouter/mysqlrouter.ini
/usr/lib/systemd/system/mysqlrouter.service
/usr/lib/tmpfiles.d/mysqlrouter.conf
/usr/lib64/libmysqlharness.so
/usr/lib64/libmysqlharness.so.0
/usr/lib64/libmysqlrouter.so
/usr/lib64/libmysqlrouter.so.1
/usr/lib64/mysqlrouter
/usr/lib64/mysqlrouter/fabric_cache.so
/usr/lib64/mysqlrouter/keepalive.so
/usr/lib64/mysqlrouter/logger.so
/usr/lib64/mysqlrouter/mysql_protocol.so
/usr/lib64/mysqlrouter/routing.so
/usr/sbin/mysqlrouter
/usr/share/doc/mysql-router-2.0.3
/usr/share/doc/mysql-router-2.0.3/License.txt
/usr/share/doc/mysql-router-2.0.3/README.txt
/var/log/mysqlrouter
/var/run/mysqlrouter

1.9.2. 配置 MySQL Router

默认配置

# cat /etc/mysqlrouter/mysqlrouter.ini
# Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; version 2 of the License.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301 USA

#
# MySQL Router configuration file
#
# Documentation is available at
#    http://dev.mysql.com/doc/mysql-router/en/

[DEFAULT]
logging_folder = /var/log/mysqlrouter/
plugin_folder = /usr/lib64/mysqlrouter
runtime_folder = /var/run/mysqlrouter
config_folder = /etc/mysqlrouter

[logger]
level = info

# 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

1.9.2.1. 主备配置

适用于 MySQL Master-Master / Master-Slave 方案,当一台Master出现故障后另一台Master或者Slave接管

[routing:failover]
bind_address = 192.168.0.5
bind_port = 3306
max_connections = 1024
mode = read-write
destinations = 192.168.0.10:3306,192.168.0.11:3306

1.9.2.2. 负载均衡配置

主要用于输在均衡

[routing:balancing]
bind_address = 192.168.0.5
bind_port = 3307
connect_timeout = 3
max_connections = 1024
mode = read-only
destinations = 192.168.0.20:3306,192.168.0.21:3310

1.9.3. MySQL Router , Haproxy,LVS 的选择

MySQL Router目前仍在成长中,如果你只需要负载均衡与主备,那么LVS性能更高,Haproxy也更成熟。

节选择《Netkiller MySQL 手札》

原文发布于微信公众号 - Netkiller(netkiller-ebook)

原文发表时间:2016-03-14

本文参与腾讯云自媒体分享计划,欢迎正在阅读的你也加入,一起分享。

发表于

我来说两句

0 条评论
登录 后参与评论

相关文章

来自专栏后台及大数据开发

CentOS下redis集群安装

环境: 一台CentOS虚拟机上部署六个节点,创建3个master,3个slave节点

572
来自专栏owent

[WP Code Highlight.js] Project

https://github.com/owt5008137/WP-Code-Highlight.js

862
来自专栏xingoo, 一个梦想做发明家的程序员

IP多播

                      1   多播地址                     IP多播地址采用D类IP地址确定多播的组,地址范围是224...

1775
来自专栏c#开发者

Developing a Transactional Biztalk adapter

Contents Developing a Transactional BizTalk Adapter Using the Microsoft Base Ada...

27513
来自专栏Netkiller

Glusterfs 文件系统

Glusterfs 我的系列文档 Netkiller Architect 手札 Netkiller Developer 手札 Netkiller PHP...

33310
来自专栏Golang语言社区

原子读写性能简单测试

代码如下: package main import ( "fmt" "sync/atomic" "time" ) func benc...

3956
来自专栏转载gongluck的CSDN博客

第21章 多播

1·多播(组播)地址:224.0.0.0~139.255.255.255 2·发送多播数据报无需任何特殊处理,发送应用程序不必为此加入多播组 3·多播相对于广播...

33610
来自专栏aCloudDeveloper

A Day in the Life of a Web Page Request

Author: bakari   Date: 2012.5.23 老师上课的时候给了一张图,个人感觉非常经典,几乎将请求一个网页所要进行的流程都弄得非常详细,对...

1825
来自专栏杨建荣的学习笔记

使用sed做特殊的行列转换(r2笔记40天)

行列转换在数据库,开发语言中都是一个津津乐道的话题,今天来简单演示一个使用sed所作的特殊行列转换。 日志的内容如下: append data from MIG...

2737
来自专栏移动开发的那些事儿

DHCP租约到期自动续租问题导致TCP连接异常

以上是发起请求后有正常收到Ack的情况,但是接下来设备发起了请求并没有收到Ack,所以导致设备一直不断的去发起DHCP请求,而且此时设备并没有网络切换广播,并且...

884

扫描关注云+社区