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 条评论
登录 后参与评论

相关文章

来自专栏杂烩

mycat安装使用 原

    github地址:https://github.com/MyCATApache/Mycat-Server/wiki

702
来自专栏云霄雨霁

数据库事务总结

1496
来自专栏乐沙弥的世界

ASM 磁盘、目录的管理

ASM磁盘是ASM体系结构的重要组成部分,ASM磁盘由ASM实例来定位、管理,本文主要讲述ASM磁盘组、故障组等等。

954
来自专栏芋道源码1024

分布式消息队列 RocketMQ源码解析:事务消息

本文主要基于 RocketMQ 4.0.x 正式版 1. 概述 2. 事务消息发送 2.1 Producer 发送事务消息 2.2 Broker 处理结束事务请...

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

海量数据迁移之分区并行切分(r2笔记60天)

在海量的数据迁移中,如果某个表特别大,可以考虑对表中的分区进行切分,比如某个表有100g,还有100个分区,那么可以考虑针对这100个分区,那么可以考虑把这10...

2624
来自专栏别先生

一脸懵逼学习Hive(数据仓库基础构架)

Hive是什么?其体系结构简介* Hive的安装与管理* HiveQL数据类型,表以及表的操作* HiveQL查询数据*** Hive的Java客户端** ...

27510
来自专栏Java帮帮-微信公众号-技术文章全总结

Hibernate_day04总结

更多资源分享就在【Java帮帮】微信公众号与QQ空间 Hibernate_day04总结 今日内容 l Hibernate的二级缓存 1.1 上次课内容回顾: ...

2818
来自专栏Java技术栈

MySQL 调优/优化的 101 个建议!

原文:http://www.monitis.com/blog/101-tips-to-mysql-tuning-and-optimization/ MySQL是...

3886
来自专栏MYSQL轻松学

MYSQL架构调整的常用方式

一、不同级别挂载为同一级别 低级从库往上级挂载比较简单,只要上一级停止复制线程,确保没有数据写入,记录此时被挂载的主库位点,按此位点change即可。 如下:...

3387
来自专栏吴生的专栏

Mysql数据库主从心得整理

管理mysql主从有2年多了,管理过200多组mysql主从,几乎涉及到各个版本的主从,本博文属于总结性的,有一部分是摘自网络,大部分是根据自己管理的心得和经验...

3386

扫码关注云+社区