当前位置:网站首页>Pisanix v0.2.0 发布|新增动态读写分离支持
Pisanix v0.2.0 发布|新增动态读写分离支持
2022-08-05 02:04:00 【SphereEx】
Pisanix 于今天发布了 v0.2.0 版本,在此前版本基础上,本次更新新增了动态读写分离支持,下面将进行详细介绍。
1.动态读写分离介绍
1.1 介绍
读写分离是业界使用 MySQL 高可用最常用的方案之一,在实际场景中可以提高查询性能,降低服务器负载。本次版本在 v0.1.0 静态规则基础上增加了动态感知读写分离功能。
在动态感知的读写分离中,需要配置读写分离的规则。Pisa-Proxy 会根据规则进行 SQL 路由。如图1.1 Pisa-Proxy 后端会启动 4个 Monitor 对后端集群状态进行感知。Monitor Reconcile 会对 Monitor 上报的数据进行计算聚合并得出后端集群最终状态,再由 Monitor Reconcile 将状态信息通过 channel 下发给 RulesMatch,RulesMatch 拿到消息后会动态调整后端数据源列表。
这里的概念有:
- 节点: 指后端数据库节点。
- RulesMatch:RulesMatch 引擎通过编写的规则集,与 Pisa-Proxy 接收到的 SQL 查询语句做匹配。
- TargetRole: 指通过规则匹配引擎匹配到的 TargetRole 组,每个 TargetRole 组里可能会有一个或多个节点。
- LoadBalance:负载均衡模块会按照相应的算法从 TargetRole 组里选取一个合适的节点。
- TargetInstance:指由 LoadBalance 模块选出的节点。
- Discovery:发现类型,对应于后端数据源使用的高可用策略,例如: MHA,RDS,MGR等等,本版本中主要支持了 MHA。
- Monitor: 指 Pisa-Proxy 对后端的探测模块,在 MHA 中主要依赖于4种 Monitor:
- Connect Monitor: 探测数据库连通性。
- Ping Monitor: 探测数据库是否健康。
- Replication Lag Monitor: 探测主从复制延迟状态。
- Read Only Monitor: 探测主从数据库角色
1.2 读写分离配置
读写分离配置规则配置方式同静态读写分离保持一致,动态读写分离配置项如下:
参数 | 类型 | 是否依赖 | 默认值 | 含义 |
---|---|---|---|---|
user | string | 是 | None | 探测模块执行检查 SQL 语句用户名 |
password | string | 是 | None | 探测模块执行检查 SQL 语句密码 |
monitor_period | u64 | 是 | 1000 | 探测模块更新感知后端数据源状态周期(毫秒) |
connect_period | u64 | 是 | 1000 | Connect 模块探测周期(毫秒) |
connect_timeout | u64 | 是 | 6000 | Connect 模块探测超时时间(毫秒) |
connect_failure_threshold | u64 | 是 | 1 | Connect 模块探测失败重试次数 |
ping_period | u64 | 是 | 1000 | Ping 模块探测周期(毫秒) |
ping_timeout | u64 | 是 | 6000 | Ping 模块探测超时时间(毫秒) |
ping_failure_threshold | u64 | 是 | 1 | Ping 模块探测失败重试次数 |
replication_lag_period | u64 | 是 | 1000 | Replication Lag 模块探测周期(毫秒) |
replication_lag_timeout | u64 | 是 | 6000 | Replication Lag 模块探测超时时间(毫秒) |
replication_lag_failure_threshold | u64 | 是 | 1 | Replication Lag 探测失败重试次数 |
max_replication_lag | u64 | 是 | 10000 | 用户定义主从最大延迟时间阈值(毫秒) |
read_only_period | u64 | 是 | 1000 | Read Only 探测周期(毫秒) |
read_only_timeout | u64 | 是 | 6000 | Read Only 探测超时时间(毫秒) |
read_only_failure_threshold | u64 | 是 | 3 | Read Only 探测失败重试次数 |
CRD 配置示例:
apiVersion: core.database-mesh.io/v1alpha1
kind: TrafficStrategy
metadata:
name: catalogue
namespace: demotest
spec:
selector:
matchLabels:
source: test
loadBalance:
readWriteSplitting:
dynamic:
defaultTarget: readwrite
discovery:
masterHighAvailability:
connectionProbe:
failureThreshold: 3
periodMilliseconds: 1000
timeoutMilliseconds: 6000
monitorPeriod: 1000
pingProbe:
failureThreshold: 3
periodMilliseconds: 1000
timeoutMilliseconds: 6000
readOnlyProbe:
failureThreshold: 3
periodMilliseconds: 1000
timeoutMilliseconds: 6000
replicationLagProbe:
failureThreshold: 3
maxReplicationLag: 3
periodMilliseconds: 1000
timeoutMilliseconds: 6000
user: monitor
password: monitor
rules:
- algorithmName: roundrobin
name: write-rule
regex:
- ^insert
target: readwrite
type: regex
- algorithmName: roundrobin
name: read-rule
regex:
- ^select
target: read
type: regex
2. Pisanix v0.2.0 版本说明
新特性
- Pisa-Controller
- 在 TrafficStrategy CRD ReadWriteSplitting 字段中,增加了对动态读写分离的支持 #208
- Pisa-Proxy
- 支持动态感知读写分离 #204
- 增加了
daemon
sidecar
子命令 #190
增强
- 重构了 Pisa-Proxy 配置文件 #182
- 完善 SHOW SQL 语句解析 #183
- 增加 Pisa-Controller 代码覆盖率检查 #192
- 增加对后端数据源连接失败重连 #215
改进
- Pisa-Controller
- 修复 webhook tls #221
- Pisa-Proxy
- 修复 MySQL8 认证切换请求失败问题 #170
- MySQL 协议 EOF 包处理异常 #166
- 修复了 Charset 字符集 #154
- 修复注入环境变量 #223
其他
- Docs
- Charts
- 更新至 v0.2.0
3. 社区
本次版本发布共包含62个 PR,感谢各位贡献者:
- mlycore
- xuanyuan300
- wbtlb
- windghoul
- lltgo
- tuichenchuxin
- dongzl
[下载链接]
(https://github.com/database-mesh/pisanix/releases/tag/v0.2.0)
邮件列表 | https://groups.google.com/g/database-mesh |
---|---|
英文社区双周会(2022年2月16日起),周三 9:00 AM PST | https://meet.google.com/yhv-zrby-pyt |
中文社区双周会(2022年4月27日起),周三 9:00 PM GMT+8 | https://meeting.tencent.com/dm/6UXDMNsHBVQO |
微信加群小助手 | pisanix |
邮件列表 | https://groups.google.com/g/database-mesh |
Slack | https://join.slack.com/t/databasemesh/shared_invite/zt-19rhvnxkz-USjZamghd_Q0q~8bAJXA |
会议记录 | https://bit.ly/39Fqt3x |
边栏推荐
- Live playback including PPT download | Build Online Deep Learning based on Flink & DeepRec
- 英特尔 XDC 2022 精彩回顾:共建开放生态,释放“基建”潜能
- Log an error encountered when compiling google gn "I could not find a ".gn" file ..."
- 意识形态的机制
- source program in assembly language
- 【七夕如何根据情侣倾听的音乐进行薅羊毛】背景音乐是否会影响情侣对酒的选择
- Transfer Learning - Distant Domain Transfer Learning
- sql语句多字段多个值如何进行排序
- SuperMap支持的国产环境汇总
- iNFTnews | 对体育行业和球迷来说,NFT可以带来什么?
猜你喜欢
Are testing jobs so hard to find?I am 32 this year and I have been unemployed for 2 months. What should an older test engineer do next to support his family?
【七夕如何根据情侣倾听的音乐进行薅羊毛】背景音乐是否会影响情侣对酒的选择
Utilities How do programmers without objects spend the Chinese Valentine's Day
Transfer Learning - Distant Domain Transfer Learning
How to simply implement the quantization and compression of the model based on the OpenVINO POT tool
Leetcode刷题——22. 括号生成
sql语句多字段多个值如何进行排序
为什么他们选择和AI恋爱?
基于OpenVINO工具套件简单实现YOLOv7预训练模型的部署
随机推荐
IJCAI2022 | DictBert:采用对比学习的字典描述知识增强的预训练语言模型
领域驱动设计——MDD
亚马逊云科技 + 英特尔 + 中科创达为行业客户构建 AIoT 平台
1349. Maximum number of students taking the exam Status Compression
习题:选择结构(一)
【MySQL系列】- LIKE查询 以%开头一定会让索引失效吗
力扣-二叉树的前序遍历、中序遍历、后序遍历
“嘀哩哩,等灯等灯”,工厂安全生产的提示音
KingbaseES V8 GIS数据迁移方案(2. Kingbase GIS能力介绍)
Dotnet 6 Why does the network request not follow the change of the system network proxy and dynamically switch the proxy?
.Net C# 控制台 使用 Win32 API 创建一个窗口
树形查找(二叉查找树)
【genius_platform软件平台开发】第七十六讲:vs预处理器定义的牛逼写法!!!!(其他组牛逼conding人员告知这么配置来取消宏定义)
Methods commonly used interface automation test framework postman tests
进程在用户态和内核态的区别[独家解析]
如何创建rpm包
iNFTnews | 对体育行业和球迷来说,NFT可以带来什么?
原生js实现多选框全部选中和取消效果
在这个超连接的世界里,你的数据安全吗
AI+小核酸药物|Eleven完成2200万美元种子轮融资