当前位置: 首页 > news >正文

MySQL ROUTER安装部署

MySQL ROUTER安装部署

在前一篇文章,测试安装了MySQL MGR集群,在磁盘文章中通过测试MySQL router实现VIP的功能和读写分离。

总体设计架构如下图
在这里插入图片描述

[root@mgrouter bin]# adduser mgrrouter
[root@mgrouter bin]# ./mysqlrouter --bootstrap root@192.168.56.104:3309 --directory /opt/mysql_router/mgrrouter/data  --name='gsprouter' --user=mgrrouter --force-password-validation
Please enter MySQL password for root: 
Error: Unable to connect to the metadata server: Error connecting to MySQL server at 192.168.56.104:3309: Access denied for user 'root'@'192.168.56.107' (using password: YES) (1045)
[root@mgrouter bin]# ./mysqlrouter --bootstrap mgrouter@192.168.56.104:3309 --directory /opt/mysql_router/mgrrouter/data  --name='gsprouter' --user=mgrrouter --force-password-validation
Please enter MySQL password for mgrouter: 
Error: Expected MySQL Server '192.168.56.104:3309' to contain the metadata of MySQL InnoDB Cluster, but the schema does not exist.
Checking version of the metadata schema failed with: Error executing MySQL query "SELECT * FROM mysql_innodb_cluster_metadata.schema_version": Unknown database 'mysql_innodb_cluster_metadata' (1049)See https://dev.mysql.com/doc/mysql-shell/en/deploying-production-innodb-cluster.html for instructions on setting up a MySQL Server to act as an InnoDB Cluster Metadata server[root@mgrouter bin]# 

#########################
mysql router安装配置##下载安装##解压
mv mysql-router-8.0.27-linux-glibc2.12-x86_64 /usr/local/
ln -s mysql-router-8.0.27-linux-glibc2.12-x86_64/ mysql-router##安装目录:
mkdir -p /opt/mysqlrouter/data
mkdir -p /opt/mysqlrouter/log
mkdir -p /opt/mysqlrouter/run
mkdir -p /opt/mysqlrouter/configcp /usr/local/mysql-router/share/doc/mysqlrouter/sample_mysqlrouter.conf /opt/mysqlrouter/config/mysqlrouter.conf##添加环境变量
vi /etc/profile export PATH=/usr/local/mysql-router/bin:$PATHsource /etc/profile ##读写分离配置vi /opt/mysqlrouter/config/mysqlrouter.confchown mysql.mysql /opt/mysqlrouter/config/mysqlrouter.conf[DEFAULT]
logging_folder         = /opt/mysql_router/mgrrouter/log
plugin_folder          = /opt/mysql_router/mgrrouter/lib/mysqlrouter
config_folder          = /opt/mysql_router/mgrrouter/config
runtime_folder         = /opt/mysql_router/mgrrouter/run
data_folder            = /opt/mysql_router/mgrrouter/dataclient_connect_timeout = 2
connect_timeout        = 2
read_timeout           = 30
max_connections        = 512[logger]
level = INFO
timestamp_precision = second[routing:primary]
bind_address = 192.168.56.107
bind_port = 7001
destinations = 192.168.56.104:3309,192.168.56.105:3309,192.168.56.106:3309
routing_strategy = first-available
mode = read-write[routing:secondary]
bind_address = 192.168.56.107
bind_port = 7002
destinations = 192.168.56.105:3309,192.168.56.106:3309
routing_strategy = round-robin
mode = read-only##启动 router 
/opt/mysql_router/mgrrouter/bin/mysqlrouter -c /opt/mysql_router/mgrrouter/config/mysqlrouter.conf &##创建远程测试访问用户
CREATE USER root@'%' IDENTIFIED WITH sha256_password BY 'root';
GRANT REPLICATION SLAVE ON *.* TO root@'%';
GRANT all ON *.* TO root@'%';FLUSH PRIVILEGES;###登录测试验证
mysql -h 192.168.56.70 -uroot -proot -P 7002 -e "select @@hostname, @@read_only, @@super_read_only"
http://www.lryc.cn/news/601446.html

相关文章:

  • Java面试实战:安全框架与大数据技术深度解析
  • 深度解析 inaSpeechSegmenter:高效音频语音分割与检测开源工具
  • 基于 LSTM 与 SVM 融合的时间序列预测模型:理论框架与协同机制—实践算法(1)
  • maven命令详解
  • Redis C++客户端——命令使用
  • 《不只是接口:GraphQL与RESTful的本质差异》
  • Libevent(4)之使用教程(3)配置
  • PHP框架之Laravel框架教程:3. 数据库操作(简要)
  • net8.0一键创建支持(RabbitMQ)
  • 积分兑换小程序Java
  • Torchv Unstrustured 文档解析库
  • Matplotlib(二)- Matplotlib简单绘图
  • 在docker中安装frp实现内网穿透
  • 【数据结构与算法】数据结构初阶:详解排序(二)——交换排序中的快速排序
  • 【51单片机和数码管仿真显示问题共阴共阳代码】2022-9-24
  • 算法竞赛阶段二-数据结构(36)数据结构双向链表模拟实现
  • hackthebox-Pwn-Restaurant(ret2libc)
  • MySQL 8.4 Windows 版安装记录与步骤参考
  • STM32-USART串口实现接收数据三种方法(1.根据\r\n标志符、2.空闲帧中断、3.根据定时器辅助接收)
  • 数据结构第1问:什么是数据结构?
  • 三、构建一个Agent
  • 栈----5.柱状图中最大的矩形
  • RabbitMq 常用命令和REST API
  • 基于分组规则的Excel数据分组优化系统设计与实现
  • 阿里 Qwen3 四模型齐发,字节 Coze 全面开源,GPT-5 8 月初发布!| AI Weekly 7.21-7.27
  • GPT 生成一个打字练习页面
  • maven optional 功能详解
  • 盛最多水的容器-leetcode
  • 时间长了忘记jupyter的环境是哪个了
  • k8s的csi对接GPFS