前往小程序,Get更优阅读体验!
立即前往
首页
学习
活动
专区
工具
TVP
发布
社区首页 >专栏 >MySQL Router 安装与配置

MySQL Router 安装与配置

作者头像
netkiller old
发布2018-03-05 16:04:00
3.3K0
发布2018-03-05 16:04:00
举报
文章被收录于专栏:Netkiller

1.9. MySQL Router

1.9.1. 安装 MySQL Router

代码语言:javascript
复制
# yum install mysql-router -y

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

代码语言:javascript
复制
[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

默认配置

代码语言:javascript
复制
# 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接管

代码语言:javascript
复制
[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. 负载均衡配置

主要用于输在均衡

代码语言:javascript
复制
[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 手札》

本文参与 腾讯云自媒体同步曝光计划,分享自微信公众号。
原始发表:2016-03-14,如有侵权请联系 cloudcommunity@tencent.com 删除

本文分享自 Netkiller 微信公众号,前往查看

如有侵权,请联系 cloudcommunity@tencent.com 删除。

本文参与 腾讯云自媒体同步曝光计划  ,欢迎热爱写作的你一起参与!

评论
登录后参与评论
0 条评论
热度
最新
推荐阅读
目录
  • 1.9. MySQL Router
    • 1.9.1. 安装 MySQL Router
      • 1.9.2. 配置 MySQL Router
        • 1.9.2.1. 主备配置
        • 1.9.2.2. 负载均衡配置
      • 1.9.3. MySQL Router , Haproxy,LVS 的选择
      相关产品与服务
      云数据库 SQL Server
      腾讯云数据库 SQL Server (TencentDB for SQL Server)是业界最常用的商用数据库之一,对基于 Windows 架构的应用程序具有完美的支持。TencentDB for SQL Server 拥有微软正版授权,可持续为用户提供最新的功能,避免未授权使用软件的风险。具有即开即用、稳定可靠、安全运行、弹性扩缩等特点。
      领券
      问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档