mysql cluster 实战初探 周彦伟topic.it168.com/factory/dtcc2013/doc/a14.pdf•mysql client...
TRANSCRIPT
![Page 1: MySQL Cluster 实战初探 周彦伟topic.it168.com/factory/DTCC2013/doc/a14.pdf•MySQL client DTCC2013 MySQL Cluster •Node Group •Partition •Replicas DTCC2013 HA DTCC2013 部署容易?](https://reader034.vdocuments.pub/reader034/viewer/2022042509/5f8de88f958e9e06226bceed/html5/thumbnails/1.jpg)
MySQL Cluster 实战初探
周彦伟
2013.04
DTCC2013
![Page 2: MySQL Cluster 实战初探 周彦伟topic.it168.com/factory/DTCC2013/doc/a14.pdf•MySQL client DTCC2013 MySQL Cluster •Node Group •Partition •Replicas DTCC2013 HA DTCC2013 部署容易?](https://reader034.vdocuments.pub/reader034/viewer/2022042509/5f8de88f958e9e06226bceed/html5/thumbnails/2.jpg)
先说三个闹心事儿
• 计数
• 用户个人信息
• 好友最新动态
DTCC2013
![Page 3: MySQL Cluster 实战初探 周彦伟topic.it168.com/factory/DTCC2013/doc/a14.pdf•MySQL client DTCC2013 MySQL Cluster •Node Group •Partition •Replicas DTCC2013 HA DTCC2013 部署容易?](https://reader034.vdocuments.pub/reader034/viewer/2022042509/5f8de88f958e9e06226bceed/html5/thumbnails/3.jpg)
MySQL的解决思路
• 切分
• 多slave
• 缓存
DTCC2013
![Page 4: MySQL Cluster 实战初探 周彦伟topic.it168.com/factory/DTCC2013/doc/a14.pdf•MySQL client DTCC2013 MySQL Cluster •Node Group •Partition •Replicas DTCC2013 HA DTCC2013 部署容易?](https://reader034.vdocuments.pub/reader034/viewer/2022042509/5f8de88f958e9e06226bceed/html5/thumbnails/4.jpg)
还有没有更合适的方案?
• MySQL Cluster --- 一个美丽的传说
DTCC2013
![Page 5: MySQL Cluster 实战初探 周彦伟topic.it168.com/factory/DTCC2013/doc/a14.pdf•MySQL client DTCC2013 MySQL Cluster •Node Group •Partition •Replicas DTCC2013 HA DTCC2013 部署容易?](https://reader034.vdocuments.pub/reader034/viewer/2022042509/5f8de88f958e9e06226bceed/html5/thumbnails/5.jpg)
MySQL Cluster
• NDB,NDBCLUSTER,Network Database
• “memory database”
• Share-nothing
• High-availability
• High-redundancy
• Distributed
DTCC2013
![Page 6: MySQL Cluster 实战初探 周彦伟topic.it168.com/factory/DTCC2013/doc/a14.pdf•MySQL client DTCC2013 MySQL Cluster •Node Group •Partition •Replicas DTCC2013 HA DTCC2013 部署容易?](https://reader034.vdocuments.pub/reader034/viewer/2022042509/5f8de88f958e9e06226bceed/html5/thumbnails/6.jpg)
认识MySQL ClusterDTCC2013
![Page 7: MySQL Cluster 实战初探 周彦伟topic.it168.com/factory/DTCC2013/doc/a14.pdf•MySQL client DTCC2013 MySQL Cluster •Node Group •Partition •Replicas DTCC2013 HA DTCC2013 部署容易?](https://reader034.vdocuments.pub/reader034/viewer/2022042509/5f8de88f958e9e06226bceed/html5/thumbnails/7.jpg)
MySQL Cluster
• Managerment node
• Data node
• SQL node
• Management client
• NDB client
• MySQL client
DTCC2013
![Page 8: MySQL Cluster 实战初探 周彦伟topic.it168.com/factory/DTCC2013/doc/a14.pdf•MySQL client DTCC2013 MySQL Cluster •Node Group •Partition •Replicas DTCC2013 HA DTCC2013 部署容易?](https://reader034.vdocuments.pub/reader034/viewer/2022042509/5f8de88f958e9e06226bceed/html5/thumbnails/8.jpg)
MySQL Cluster
• Node Group
• Partition
• Replicas
DTCC2013
![Page 9: MySQL Cluster 实战初探 周彦伟topic.it168.com/factory/DTCC2013/doc/a14.pdf•MySQL client DTCC2013 MySQL Cluster •Node Group •Partition •Replicas DTCC2013 HA DTCC2013 部署容易?](https://reader034.vdocuments.pub/reader034/viewer/2022042509/5f8de88f958e9e06226bceed/html5/thumbnails/9.jpg)
HADTCC2013
![Page 10: MySQL Cluster 实战初探 周彦伟topic.it168.com/factory/DTCC2013/doc/a14.pdf•MySQL client DTCC2013 MySQL Cluster •Node Group •Partition •Replicas DTCC2013 HA DTCC2013 部署容易?](https://reader034.vdocuments.pub/reader034/viewer/2022042509/5f8de88f958e9e06226bceed/html5/thumbnails/10.jpg)
部署容易?DTCC2013
![Page 11: MySQL Cluster 实战初探 周彦伟topic.it168.com/factory/DTCC2013/doc/a14.pdf•MySQL client DTCC2013 MySQL Cluster •Node Group •Partition •Replicas DTCC2013 HA DTCC2013 部署容易?](https://reader034.vdocuments.pub/reader034/viewer/2022042509/5f8de88f958e9e06226bceed/html5/thumbnails/11.jpg)
需要做的事
• 准备机器(>3)
• 下载两个安装包(client,server)
• 修改两个配置文件
– my.cnf
– config.ini
DTCC2013
![Page 12: MySQL Cluster 实战初探 周彦伟topic.it168.com/factory/DTCC2013/doc/a14.pdf•MySQL client DTCC2013 MySQL Cluster •Node Group •Partition •Replicas DTCC2013 HA DTCC2013 部署容易?](https://reader034.vdocuments.pub/reader034/viewer/2022042509/5f8de88f958e9e06226bceed/html5/thumbnails/12.jpg)
my.cnfDTCC2013
![Page 13: MySQL Cluster 实战初探 周彦伟topic.it168.com/factory/DTCC2013/doc/a14.pdf•MySQL client DTCC2013 MySQL Cluster •Node Group •Partition •Replicas DTCC2013 HA DTCC2013 部署容易?](https://reader034.vdocuments.pub/reader034/viewer/2022042509/5f8de88f958e9e06226bceed/html5/thumbnails/13.jpg)
Config.iniDTCC2013
![Page 14: MySQL Cluster 实战初探 周彦伟topic.it168.com/factory/DTCC2013/doc/a14.pdf•MySQL client DTCC2013 MySQL Cluster •Node Group •Partition •Replicas DTCC2013 HA DTCC2013 部署容易?](https://reader034.vdocuments.pub/reader034/viewer/2022042509/5f8de88f958e9e06226bceed/html5/thumbnails/14.jpg)
启动
• ndb_mgmd –initial
• ndbd –initial
• mysqld_safe –user=mysql &
DTCC2013
![Page 15: MySQL Cluster 实战初探 周彦伟topic.it168.com/factory/DTCC2013/doc/a14.pdf•MySQL client DTCC2013 MySQL Cluster •Node Group •Partition •Replicas DTCC2013 HA DTCC2013 部署容易?](https://reader034.vdocuments.pub/reader034/viewer/2022042509/5f8de88f958e9e06226bceed/html5/thumbnails/15.jpg)
DTCC2013
![Page 16: MySQL Cluster 实战初探 周彦伟topic.it168.com/factory/DTCC2013/doc/a14.pdf•MySQL client DTCC2013 MySQL Cluster •Node Group •Partition •Replicas DTCC2013 HA DTCC2013 部署容易?](https://reader034.vdocuments.pub/reader034/viewer/2022042509/5f8de88f958e9e06226bceed/html5/thumbnails/16.jpg)
运维-备份DTCC2013
![Page 17: MySQL Cluster 实战初探 周彦伟topic.it168.com/factory/DTCC2013/doc/a14.pdf•MySQL client DTCC2013 MySQL Cluster •Node Group •Partition •Replicas DTCC2013 HA DTCC2013 部署容易?](https://reader034.vdocuments.pub/reader034/viewer/2022042509/5f8de88f958e9e06226bceed/html5/thumbnails/17.jpg)
运维-恢复
• ndb_restore
DTCC2013
![Page 18: MySQL Cluster 实战初探 周彦伟topic.it168.com/factory/DTCC2013/doc/a14.pdf•MySQL client DTCC2013 MySQL Cluster •Node Group •Partition •Replicas DTCC2013 HA DTCC2013 部署容易?](https://reader034.vdocuments.pub/reader034/viewer/2022042509/5f8de88f958e9e06226bceed/html5/thumbnails/18.jpg)
Rolling restart
• 修改配置
• 增加节点
• 维护机器
DTCC2013
![Page 19: MySQL Cluster 实战初探 周彦伟topic.it168.com/factory/DTCC2013/doc/a14.pdf•MySQL client DTCC2013 MySQL Cluster •Node Group •Partition •Replicas DTCC2013 HA DTCC2013 部署容易?](https://reader034.vdocuments.pub/reader034/viewer/2022042509/5f8de88f958e9e06226bceed/html5/thumbnails/19.jpg)
Add Data node online
• 修改config.ini
• Rolling restart
• Start new data nodes
• Create nodegroup
• Alter online table … reorganize partition
• Optimize table …
DTCC2013
![Page 20: MySQL Cluster 实战初探 周彦伟topic.it168.com/factory/DTCC2013/doc/a14.pdf•MySQL client DTCC2013 MySQL Cluster •Node Group •Partition •Replicas DTCC2013 HA DTCC2013 部署容易?](https://reader034.vdocuments.pub/reader034/viewer/2022042509/5f8de88f958e9e06226bceed/html5/thumbnails/20.jpg)
Disk data tables
• Tablespaces
– Data files
• Undo log files
– log file grop
DTCC2013
![Page 21: MySQL Cluster 实战初探 周彦伟topic.it168.com/factory/DTCC2013/doc/a14.pdf•MySQL client DTCC2013 MySQL Cluster •Node Group •Partition •Replicas DTCC2013 HA DTCC2013 部署容易?](https://reader034.vdocuments.pub/reader034/viewer/2022042509/5f8de88f958e9e06226bceed/html5/thumbnails/21.jpg)
Disk data tables
• create logfile group lg ... engine ndbcluster
• create tablespace ts ... engine ndbcluster
• create table t (...) tablespace ts storage disk engine ndbcluster
DTCC2013
![Page 22: MySQL Cluster 实战初探 周彦伟topic.it168.com/factory/DTCC2013/doc/a14.pdf•MySQL client DTCC2013 MySQL Cluster •Node Group •Partition •Replicas DTCC2013 HA DTCC2013 部署容易?](https://reader034.vdocuments.pub/reader034/viewer/2022042509/5f8de88f958e9e06226bceed/html5/thumbnails/22.jpg)
MySQL Cluster replicationDTCC2013
![Page 23: MySQL Cluster 实战初探 周彦伟topic.it168.com/factory/DTCC2013/doc/a14.pdf•MySQL client DTCC2013 MySQL Cluster •Node Group •Partition •Replicas DTCC2013 HA DTCC2013 部署容易?](https://reader034.vdocuments.pub/reader034/viewer/2022042509/5f8de88f958e9e06226bceed/html5/thumbnails/23.jpg)
Injector threadDTCC2013
![Page 24: MySQL Cluster 实战初探 周彦伟topic.it168.com/factory/DTCC2013/doc/a14.pdf•MySQL client DTCC2013 MySQL Cluster •Node Group •Partition •Replicas DTCC2013 HA DTCC2013 部署容易?](https://reader034.vdocuments.pub/reader034/viewer/2022042509/5f8de88f958e9e06226bceed/html5/thumbnails/24.jpg)
MySQL Cluster replicationDTCC2013
![Page 25: MySQL Cluster 实战初探 周彦伟topic.it168.com/factory/DTCC2013/doc/a14.pdf•MySQL client DTCC2013 MySQL Cluster •Node Group •Partition •Replicas DTCC2013 HA DTCC2013 部署容易?](https://reader034.vdocuments.pub/reader034/viewer/2022042509/5f8de88f958e9e06226bceed/html5/thumbnails/25.jpg)
MySQL Cluster replicationDTCC2013
![Page 26: MySQL Cluster 实战初探 周彦伟topic.it168.com/factory/DTCC2013/doc/a14.pdf•MySQL client DTCC2013 MySQL Cluster •Node Group •Partition •Replicas DTCC2013 HA DTCC2013 部署容易?](https://reader034.vdocuments.pub/reader034/viewer/2022042509/5f8de88f958e9e06226bceed/html5/thumbnails/26.jpg)
MySQL Cluster replicationDTCC2013
![Page 27: MySQL Cluster 实战初探 周彦伟topic.it168.com/factory/DTCC2013/doc/a14.pdf•MySQL client DTCC2013 MySQL Cluster •Node Group •Partition •Replicas DTCC2013 HA DTCC2013 部署容易?](https://reader034.vdocuments.pub/reader034/viewer/2022042509/5f8de88f958e9e06226bceed/html5/thumbnails/27.jpg)
讨论
• 适用场景
– 密集写
– 密集读
– 数据量可控
– 替代部分缓存
• 使用成本
– 硬件• 用磁盘换内存
– 运维• 标准化,自动化
DTCC2013