首页 > 数据库 >通过MySQL router连接MySQL8.0.23 Group Replication使用方式

通过MySQL router连接MySQL8.0.23 Group Replication使用方式

时间:2023-10-24 14:48:49浏览次数:44  
标签:8.0 p0 Group 23 Replication mysql 3306 db01

服务器信息:
应用服务器:部署Myrouter,版本mysql-router-8.0.23-linux-glibc2.17-x86_64-minimal
10.172.144.88
10.172.144.89

数据库服务器:部署MGR,版本mysql-8.0.23-linux-glibc2.17-x86_64-minimal
10.172.144.65
10.172.144.66
10.172.144.67


1、MySQL8.0.23 Group Replication集群配置情况:
[mysql@p0-db01 ~]$ mysqlsh root@p0-db01:3306
MySQL Shell 8.0.23

Copyright (c) 2016, 2021, Oracle and/or its affiliates.
Oracle is a registered trademark of Oracle Corporation and/or its affiliates.
Other names may be trademarks of their respective owners.

Type '\help' or '\?' for help; '\quit' to exit.
Creating a session to 'root@p0-db01:3306'
Fetching schema names for autocompletion... Press ^C to stop.
Your MySQL connection id is 22518087
Server version: 8.0.23 MySQL Community Server - GPL
No default schema selected; type \use <schema> to set one.
MySQL p0-db01:3306 ssl JS > var cluster=dba.getCluster()
MySQL p0-db01:3306 ssl JS > cluster.status()
{
"clusterName": "MySQLCluster",
"defaultReplicaSet": {
"name": "default",
"primary": "p0-db01:3306",
"ssl": "REQUIRED",
"status": "OK",
"statusText": "Cluster is ONLINE and can tolerate up to ONE failure.",
"topology": {
"p0-db01:3306": {
"address": "p0-db01:3306",
"mode": "R/W",
"readReplicas": {},
"replicationLag": null,
"role": "HA",
"status": "ONLINE",
"version": "8.0.23"
},
"p0-db02:3306": {
"address": "p0-db02:3306",
"mode": "R/O",
"readReplicas": {},
"replicationLag": null,
"role": "HA",
"status": "ONLINE",
"version": "8.0.23"
},
"p0-db03:3306": {
"address": "p0-db03:3306",
"mode": "R/O",
"readReplicas": {},
"replicationLag": null,
"role": "HA",
"status": "ONLINE",
"version": "8.0.23"
}
},
"topologyMode": "Single-Primary"
},
"groupInformationSourceMember": "p0-db01:3306"
}
MySQL p0-db01:3306 ssl JS >


2、应用使用MySQL8.0.23 MGR集群的方式,分为读写业务、只读业务
#读写业务应用,采用6446端口
[sysadm@p0-app01 ~]$ mysql -uadmin -p'123456' -h 10.172.144.88 -P 6446 -e "select @@hostname"
mysql: [Warning] Using a password on the command line interface can be insecure.
+---------------------+
| @@hostname |
+---------------------+
| p0-db01 |
+---------------------+
群集的状态如下
mysql> SELECT * FROM performance_schema.replication_group_members;
+---------------------------+--------------------------------------+---------------------+-------------+--------------+-------------+----------------+
| CHANNEL_NAME | MEMBER_ID | MEMBER_HOST | MEMBER_PORT | MEMBER_STATE | MEMBER_ROLE | MEMBER_VERSION |
+---------------------------+--------------------------------------+---------------------+-------------+--------------+-------------+----------------+
| group_replication_applier | e09a9596-01bd-11ed-b9f6-005056a4f70c | p0-db01 | 3306 | ONLINE | PRIMARY | 8.0.23 |
| group_replication_applier | e1a5a444-01bd-11ed-9100-005056a47247 | p0-db02 | 3306 | ONLINE | SECONDARY | 8.0.23 |
| group_replication_applier | e23aaccc-01bd-11ed-86e5-005056a4f766 | p0-db03 | 3306 | ONLINE | SECONDARY | 8.0.23 |
+---------------------------+--------------------------------------+---------------------+-------------+--------------+-------------+----------------+
3 rows in set (0.00 sec)


#只读业务应用,采用6447端口
[sysadm@p0-app01 ~]$ mysql -uadmin -p'123456' -h 10.172.144.88 -P 6447 -e "select @@hostname"
mysql: [Warning] Using a password on the command line interface can be insecure.
+---------------------+
| @@hostname |
+---------------------+
| p0-db02 |
+---------------------+
[sysadm@p0-app01 ~]$ mysql -uadmin -p'123456' -h 10.172.144.88 -P 6447 -e "select @@hostname"
mysql: [Warning] Using a password on the command line interface can be insecure.
+---------------------+
| @@hostname |
+---------------------+
| p0-db03 |
+---------------------+
[sysadm@p0-app01 ~]$ mysql -uadmin -p'123456' -h 10.172.144.88 -P 6447 -e "select @@hostname"
mysql: [Warning] Using a password on the command line interface can be insecure.
+---------------------+
| @@hostname |
+---------------------+
| p0-db02 |
+---------------------+
[sysadm@p0-app01 ~]$
多次查询结果显示,不同的连接连接到不通的主库数据库
















标签:8.0,p0,Group,23,Replication,mysql,3306,db01
From: https://www.cnblogs.com/helontian/p/17784745.html

相关文章

  • 10.23每日总结
    今天完成了软件设计的作业,涉及到了多种模式,其中进行了单例模式的编程。然后做了软考的部分选择题。并且完成了三人组队的对erp的设计,我负责的工作是框架图和数据库设计,以下是数据库的设计:1.人力资源管理系统人事管理子系统Employee表EmployeeID(整数,主键)FirstName(文本......
  • 2023 年华中科技大学程序设计竞赛新生赛
    2023年华中科技大学程序设计竞赛新生赛P9774[HUSTFC2023]新取模运算-洛谷|计算机科学教育新生态(luogu.com.cn)\(n!\%p\),易知\(1\simn\%p\)为\(1,2,3\dotsp-1,0,1,2\dots\),所以我们可以预处理出\(1\simp-1\)的阶乘,那么答案就是\((p-1)!^{\frac{n}{p}}\t......
  • 名人名言_20230901-
    日常学习名人名言,激励自己......
  • 「Revit2023最新版下载」Autodesk Revit 2023汉化版附安装教程
    Revit是Autodesk公司著名的3D建模软件,是建筑行业BIM系统中应用最广泛的软件之一。其核心功能是三维建筑模型的参数化设计、渲染效果图、计算、土建建模、机电建模,用于帮助工程师在施工前的精确仿真阶段。软件地址:看置顶贴AutodeskRevit2023的软件特点过滤器中的OR条件。创建一个......
  • LeetCode Day13 239&347
    //利用双端队列手动实现单调队列/***用一个单调队列来存储对应的下标,每当窗口滑动的时候,直接取队列的头部指针对应的值放入结果集即可*单调队列类似(tail-->)3-->2-->1-->0(-->head)(右边为头结点,元素存的是下标)*/239. 滑动窗口最大值classSolution{......
  • Cinema 4D 2023图文安装教程及下载
    Cinema4D(简称C4D)是一款专业的3D建模、动画和渲染软件,由德国公司Maxon开发。它广泛应用于影视、游戏、广告等行业,具有操作简单、功能强大、渲染速度快等优点。Cinema4D2023版本提供了最主要的功能-全面的对称性建模、本地资产管理和原生OCIO支持。更新引入了用于创建火焰、烟雾和......
  • CSP20230917-3 梯度求解 题解
    〇、题目太长了懒得写。简单来说就是求对于一个后缀表达式,每个询问给出一个下标和一些值,求以该下标变量为自变量其它变量为常数时的偏导数。一、思路考虑直接对于表达式建出表达式树。建树的过程比较直接:每次栈里面放节点编号,遇到符号就取出当前栈顶两个节点作为子节点。每......
  • 云原生周刊: 使用 Kubectl 执行 100 个 Kubernetes 诊断命令 | 2023.10.23
    开源项目推荐SternStern是一个针对Kubernetes的多pod和容器日志跟踪工具。可以跟踪Kubernetes上的多个pod和pod中的多个容器。每个结果都用颜色编码,以便快速调试。LProbe在容器映像(ECS、Docker、Kubernetes)内执行本地健康检查探测的命令行工具。当你的容器被攻破时......
  • 【2023-10-06】连岳摘抄
    23:59 春生、夏长、秋收、冬藏,天之正也,不可干而逆之。                                                 ——鬼谷子在中国迅速城市化这三十来年,以北京、上海、广州......
  • 【2023-10-09】连岳摘抄
    23:59 我们需要彼此。越早了解此事,对我们来说越好。                                                 ——埃里克·埃里克森你可以抽空到大城市待几天,体验一下。白......