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

Centos8安装MySQL Router

作者头像
jwj
发布2022-05-18 12:02:05
4120
发布2022-05-18 12:02:05
举报

最近良心云10周年庆典放出了满1000-1000的优惠券,然后花8毛钱买了台3年的1H1G服务器。这配置,装个数据库够呛,于是花36元又买了个1年的1H1G数据库。但数据库没有提供外网,所以只能这8毛的服务器做中转,也足够了。

下载 MySQL Router软件包

代码语言:javascript
复制
wget https://dev.mysql.com/get/Downloads/MySQL-Router/mysql-router-community-8.0.21-1.el8.x86_64.rpm

安装 MySQL Router软件包

代码语言:javascript
复制
rpm -ivh mysql-router-community-8.0.21-1.el8.x86_64.rpm

返回提示

代码语言:javascript
复制
warning: mysql-router-community-8.0.21-1.el8.x86_64.rpm: Header V3 DSA/SHA1 Signature, key ID 5072e1f5: NOKEY
[/usr/lib/tmpfiles.d/mysqlrouter.conf:23] Line references path below legacy directory /var/run/, updating /var/run/mysqlrouter → /run/mysqlrouter; please update the tmpfiles.d/ drop-in file accordingly.

编辑配置文件,加上要代理的内网数据库

代码语言:javascript
复制
vim /etc/mysqlrouter/mysqlrouter.conf
代码语言:javascript
复制
# Copyright (c) 2015, 2019, 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, version 2.0,
# as published by the Free Software Foundation.
#
# This program is also distributed with certain software (including
# but not limited to OpenSSL) that is licensed under separate terms,
# as designated in a particular file or component or in included license
# documentation.  The authors of MySQL hereby grant you an additional
# permission to link the program and your derivative works with the
# separately licensed software that they have included with MySQL.
#
# 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, version 2.0, 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
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

[routing:read_write]
bind_address = 0.0.0.0
bind_port = 3306
destinations = 172.27.16.12:3306
mode = read-write

启动 MySQL Router,并设置开机自启

代码语言:javascript
复制
systemctl start mysqlrouter.service
systemctl enable mysqlrouter.service

如果开机自启不了,可能是权限问题,可以更改下用户和用户组

代码语言:javascript
复制
chown mysqlrouter:mysqlrouter /usr/lib64/mysqlrouter
本文参与 腾讯云自媒体分享计划,分享自作者个人站点/博客。
原始发表:2020-09-07,如有侵权请联系 cloudcommunity@tencent.com 删除

本文分享自 作者个人站点/博客 前往查看

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

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

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