多活高可用服务 MAS-Mysql配置示例
时间:2025-01-26 10:40:06
Mysql配置示例
结合配置项说明,在配置文件或配置信息添加故障注入相关配置。
- 配置文件示例config_mysql_chaos.yaml
props: version: v1 appId: xxx monitorId: xxxx databaseName: xxxxetcd: address: xxx.xxx.xxx.xxx:xxxx apiVersion: v3 username: xxxx password: xxxx httpsEnable: false# requiredatasource: ds0: url: tcp(xxx.xxx.xxx.xxx:xxxx)/ds0 username: xxxx password: xxxx ds0-slave0: url: tcp(xxx.xxx.xxx.xxx:xxxx)/ds0-slave0 username: xxxx password: xxxx ds0-slave1: url: tcp(xxx.xxx.xxx.xxx:xxxx)/ds0-slave1 username: xxxx password: xxxx ds1: url: tcp(xxx.xxx.xxx.xxx:xxxx)/ds1 username: xxxx password: xxxx ds1-slave0: url: tcp(xxx.xxx.xxx.xxx:xxxx)/ds1-slave0 username: xxxx password: xxxx ds1-slave1: url: tcp(xxx.xxx.xxx.xxx:xxxx)/ds1-slave1 username: xxxx password: xxxx# requirerouter: active: c0 routeAlgorithm: single-read-write retry: times: 10 delay: 50# ms nodes: c0: master: ds0 loadBalance: RANDOM slaves: - ds0-slave0 - ds0-slave1 c1: master: ds1 loadBalance: ROUND_ROBIN slaves: - ds1-slave0 - ds1-slave1chaos: active: true# 全局开关 默认false duration: 20 interval: 100 percentage: 100 delayInjection: active: true percentage: 75 timeMs: 1000 jitterMs: 500 errorInjection: active: true percentage: 20
- 配置信息
func mysqlConfiguration() *config.ClusterConfiguration { return &config.ClusterConfiguration{ Props: &mas.PropertiesConfiguration{ Version: "v1", AppID: "xxx", MonitorID: "xxxx", DatabaseName: "xxx", }, EtcdConfig: &etcd.EtcdConfiguration{ Address: "xxx.xxx.xxx.xxx:xxxx", APIVersion: "v3", Username: "xxxx", Password: "xxxx", HTTPSEnable: false, }, RouterConfig: &config.RouterConfiguration{ Nodes: map[string]*config.NodeConfiguration{ "dc0": { Master: "ds0", LoadBalance: "RANDOM", Slaves: []string{"ds0-slave0","ds0-slave1"}, }, "dc1": { Master: "ds1", LoadBalance: "ROUND_ROBIN", Slaves: []string{"ds1-slave0","ds1-slave1"}, }, }, Active: "dc0", Retry: &config.RetryConfiguration{ Times: "10", Delay: "50", }, RouteAlgorithm: "single-read-write", }, DataSource: map[string]*config.DataSourceConfiguration{ "ds0": { URL: "tcp(xxx.xxx.xxx.xxx:xxxx)/ds0", Username: "xxxx", Password: "xxxx", }, "ds0-slave0": { URL: "tcp(xxx.xxx.xxx.xxx:xxxx)/ds0-slave0", Username: "xxxx", Password: "xxxx", }, "ds0-slave1": { URL: "tcp(xxx.xxx.xxx.xxx:xxxx)/ds0-slave1", Username: "xxxx", Password: "xxxx", }, "ds1": { URL: "tcp(xxx.xxx.xxx.xxx:xxxx)/ds1", Username: "xxxx", Password: "xxxx", }, "ds1-slave0": { URL: "tcp(xxx.xxx.xxx.xxx:xxxx)/ds1-slave0", Username: "xxxx", Password: "xxxx", }, "ds1-slave1": { URL: "tcp(xxx.xxx.xxx.xxx:xxxx)/ds1-slave1", Username: "xxxx", Password: "xxxx", }, }, Chaos: &mas.InjectionProperties{ Active: true, Duration: 20, Interval: 100, Percentage: 100, DelayInjection: &mas.DelayInjection{ Active: true, Percentage: 75, TimeMs: 1000, JitterMs: 500, }, ErrorInjection: &mas.ErrorInjection{ Active: true, Percentage: 20, }, }, }}
父主题: 使用指南
support.huaweicloud.com/devg-mas/mas-devg-0069.html
看了此文的人还看了
CDN加速
GaussDB
文字转换成语音
免费的服务器
如何创建网站
域名网站购买
私有云桌面
云主机哪个好
域名怎么备案
手机云电脑
SSL证书申请
云点播服务器
免费OCR是什么
电脑云桌面
域名备案怎么弄
语音转文字
文字图片识别
云桌面是什么
网址安全检测
网站建设搭建
国外CDN加速
SSL免费证书申请
短信批量发送
图片OCR识别
云数据库MySQL
个人域名购买
录音转文字
扫描图片识别文字
OCR图片识别
行驶证识别
虚拟电话号码
电话呼叫中心软件
怎么制作一个网站
Email注册网站
华为VNC
图像文字识别
企业网站制作
个人网站搭建
华为云计算
免费租用云托管
云桌面云服务器
ocr文字识别免费版
HTTPS证书申请
图片文字识别转换
国外域名注册商
使用免费虚拟主机
云电脑主机多少钱
鲲鹏云手机
短信验证码平台
OCR图片文字识别
SSL证书是什么
申请企业邮箱步骤
免费的企业用邮箱
云免流搭建教程
域名价格
推荐文章