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

数据库服务分布架构(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软件层序

 

http://www.sczhlp.com/news/150218/

相关文章:

  • 题解:P14038 [PAIO 2025] Adventure Plan
  • 20231414_王仕琪_密码技术密码杂凑算法学习笔记
  • 威海电子商务网站建设wordpress 手机发文
  • 做ppt哪个网站的图片好网站制作培训中心
  • 做神马网站优化排有网打不开网页咋回事
  • 汽车网站建设流程电商设计美工
  • 网站正能量就是一打开全是的58同城找工作 招聘
  • 深入解析:11.路由器的接口及其相关知识(2025年9月25日)
  • 明天放假了
  • CDR必备魔镜VIP插件包支持CorelDRAW 2024版本
  • kuboard部署启用3个etcd(k8s单个master)
  • 山东济南网站推广WordPress底部添加音乐
  • 淘宝客怎么做推广网站ps软件下载免费版
  • 如何通过网站获取qq佛山新网站建设怎么样
  • 免费自己做网站吗做网站还能挣钱吗
  • 邯郸哪个公司做网站好网络外贸运营怎么做
  • 外贸网站制作教程交易网站seo怎么做
  • 老榕树建站软件宜城做网站
  • 学校网站制作平台html5做的篮球网站
  • 企通互联的网站建设失败动易网站栏目
  • 网站备案帐号是什么意思珲春市建设局网站
  • 做柜子网站帮朋友做网站
  • 请人做游戏的网站海口网站网站建设
  • 新乡新手学做网站wordpress po修改
  • seo网站设计哪里好智慧团建官方网站电脑版
  • 宿州网站制作关于网站可信备案
  • 上海网站建设推荐建搜索引擎网站
  • 调度算法易错概念总结
  • 堆设置了8G,java进程却占用了12G内存
  • Huxe 推出主动式 AI 音频服务,无感内容消费;OpenAI 推出 ChatGPT Pulse:主动提供个性化信息丨日报