尧图网站建设 尧图网络
  • 首页
  • 关于我们
  • 服务项目
  • 案例展示
  • 建站流程
  • 资讯中心
  • 联系我们
首页/资讯中心/详情

数据库服务分布架构(MyCAT)

数据库服务分布架构(MyCAT)
📅 发布时间:2026/6/20 6:15:29
数据库服务分布架构(MyCAT)

1.18.1数据库服务分布架构概述介绍
分布式架构理念:(基于业务逻辑分布式/基于程序逻辑分布式)
●架构演变过程早期,为了满足主要业务功能需求,可以将所有程序部署在一个服务器节点上;
·架构演变过程发展,为了满足主要业务压力增长,可以将所有程序拆分部署在不同服务器上;
●架构演变过程发展,为了满足主要业务安全稳定,可以将数据库设计成主从架构或读写分离;
●架构演变过程发展,为了满足多个业务数量增加,可以将架构环境根据业务的情况独立拆分;
●架构演变过程发展,为了满足单独业务数量激增I可以将多个数据表进行拆分到多个节点上;(垂直拆分-MyCAT进行数据表信息整合)
●架构演变过程发展,为了满足单独业务数量激增,可以将单个数据表进行拆分到多个节点上;(水平拆分-MyCAT进行数据表信息整合)
●架构演变过程发展,为了满足业务的数据搜索业务需求、缓存业务需求、大数据业务分析需求,还要引入NOSQL或NewSQL数据库;

 

传统网站架构的发展变化历程

1674788427009

数据库存储架构发展变化历程

1674788468176

1674788511223

1674788559115

 

架构规划

需要连个虚拟主机,每个虚拟主机中需要有4个实例

1674789847654

1674800966208

基础环境操作命令

# 删除历史数据库环境
pkill mysqld
rm -rf /data/330*
mv /etc/my.cnf /etc/my.cnf.bak# 创建相关目录初始化数据
mkdir /data/33{07..10}/data -p && chown -R mysql.mysql /data/*
初始化命令。。。

 

image

 systemctl文件

image

MyCAT分布式存储主从环境架构(进行多实例主从与双主架构)

实现双主关系建立

# 实现双主关系建立(10.0.0.51:3307 <--> 10.0.0.52:3307)
mysql -S /data/3307/mysql.sock -e "create user repl@'10.0.0.%'" identified with 
\mysql_native_password by '123';grant replication slave on *.* to repl@10.0.0.%;" db02上进行 mysql -S /data/3307/mysql.sock -e "create user root@'10.0.0.%'" identified with
\mysql_native_password by 'root';grant all on *.* to repl@10.0.0.%;" db02上进行

在db01数据库上进行操作
mysql -S /data/3307/mysql.sock -e "change master to master_host='10.0.0.52',master_port=3307\
,master_auto_position=1,master_user='repl',master_password='123';"
mysql -S /data/3307/mysql.sock -e "start slave;"
mysql -S /data/3307/mysql.sock -e "show slave status\G;" |grep Running;

在db02数据库上进行操作
mysql -S /data/3307/mysql.sock -e "change master to master_host='10.0.0.51',master_port=3307\
,master_auto_position=1,master_user='repl',master_password='123';"
mysql -S /data/3307/mysql.sock -e "start slave;"
mysql -S /data/3307/mysql.sock -e "show slave status\G;" |grep Running;
# 实现主从建立(10.0.0.51:3307 --> 10.0.0.51:3309)
mysql -S /data/3309/mysql.sock -e "change master to master_host='10.0.0.51',master_port=3307\
,master_auto_position=1,master_user='repl',master_password='123';"
mysql -S /data/3309/mysql.sock -e "start slave;"
mysql -S /data/3309/mysql.sock -e "show slave status\G;" |grep Running;
# 实现主从建立(10.0.0.52:3307 --> 10.0.0.52:3309)
mysql -S /data/3309/mysql.sock -e "change master to master_host='10.0.0.51',master_port=3307\
,master_auto_position=1,master_user='repl',master_password='123';"
mysql -S /data/3309/mysql.sock -e "start slave;"
mysql -S /data/3309/mysql.sock -e "show slave status\G;" |grep Running;

 

 

# 实现双主关系建立(10.0.0.51:3308 <--> 10.0.0.52:3308)
mysql -S /data/3308/mysql.sock -e "create user repl@'10.0.0.%'" identified with 
\mysql_native_password by '123';grant replication slave on *.* to repl@10.0.0.%;"  db01上进行
mysql -S /data/3308/mysql.sock -e "create user root@'10.0.0.%'" identified with 
\mysql_native_password by 'root';grant all on *.* to repl@10.0.0.%;"  db01上进行

在db02数据库上进行操作
mysql -S /data/3308/mysql.sock -e "change master to master_host='10.0.0.52',master_port=3307\
,master_auto_position=1,master_user='repl',master_password='123';"
mysql -S /data/3308/mysql.sock -e "start slave;"
mysql -S /data/3308 /mysql.sock -e "show slave status\G;" |grep Running;在db02数据库上进行操作
mysql -S /data/3307/mysql.sock -e "change master to master_host='10.0.0.51',master_port=3307\
,master_auto_position=1,master_user='repl',master_password='123';"
mysql -S /data/3307/mysql.sock -e "start slave;"
mysql -S /data/3307/mysql.sock -e "show slave status\G;" |grep Running;
# 实现主从建立(10.0.0.51:3307 --> 10.0.0.51:3309)
mysql -S /data/3309/mysql.sock -e "change master to master_host='10.0.0.51',master_port=3307\
,master_auto_position=1,master_user='repl',master_password='123';"
mysql -S /data/3309/mysql.sock -e "start slave;"
mysql -S /data/3309/mysql.sock -e "show slave status\G;" |grep Running;
# 实现主从建立(10.0.0.52:3307 --> 10.0.0.52:3309)
mysql -S /data/3309/mysql.sock -e "change master to master_host='10.0.0.51',master_port=3307\
,master_auto_position=1,master_user='repl',master_password='123';"
mysql -S /data/3309/mysql.sock -e "start slave;"
mysql -S /data/3309/mysql.sock -e "show slave status\G;" |grep Running;

 

异常同步错误充值方法

mysql -S /data/3307/mysql.sock -e "stop;reset slave all;"

mysql -S /data/3308/mysql.sock -e "stop;reset slave all;"

mysql -S /data/3309/mysql.sock -e "stop;reset slave all;"

mysql -S /data/3310/mysql.sock -e "stop;reset slave all;"

安装MYCAT软件层序

 

相关新闻

  • 题解:P14038 [PAIO 2025] Adventure Plan
  • 20231414_王仕琪_密码技术密码杂凑算法学习笔记
  • 堆设置了8G,java进程却占用了12G内存

最新新闻

  • 嵌入式GUI驱动开发实战:emWin显示与触摸驱动API深度解析
  • 基于OPPRF的模糊集合求交技术:原理、实现与隐私计算应用
  • CentOS 8 快速部署 Apache:dnf 模块流与 SELinux 实战指南
  • 大模型评估新范式:百选项压力测试的设计原理与工程实践
  • 2026年新消息:有实力的传菜电梯优质厂家选择与推荐指南 - 品牌鉴赏官2026
  • DNSControl + Debian 10:用Go实现声明式DNS管理

日新闻

  • Visual C++运行库修复终极指南:5分钟快速解决Windows软件启动错误
  • 手把手教你构建统计局地区经济数据爬虫:从环境搭建到数据持久化全指南
  • 2026多Agent深度解析:用AI团队替代单一模型,四种架构实战落地

周新闻

  • Visual C++运行库修复终极指南:5分钟快速解决Windows软件启动错误
  • 手把手教你构建统计局地区经济数据爬虫:从环境搭建到数据持久化全指南
  • 2026多Agent深度解析:用AI团队替代单一模型,四种架构实战落地

月新闻

  • 【总结】入门篇:50句话让你记住架构核心概念
  • WeChatMsg技术方案解析:实现Mac微信数据自主管理的完整解决方案
  • WeChatMsg:革新性微信数据备份方案,打造你的专属数字记忆库

关于尧图

  • 公司简介
  • 团队介绍
  • 企业文化
  • 荣誉资质

服务项目

  • 定制开发
  • 电商建站
  • UI 设计
  • 运维服务

快速链接

  • 案例展示
  • 建站流程
  • 常见问题
  • 资讯中心

联系方式

  • 📍北京市朝阳区互联网产业园 A 座 10 层
  • 📞400-888-8888
  • ✉️contact@rkmt.cn
  • 🕐周一至周日 9:00-21:00

© 2024 北京尧图网络科技有限公司 版权所有 | 京 ICP 备 XXXXXXXX 号