1. 首页 > 国产数据库教程 > TiDB教程 > 正文

tidb-098-TiDB分库分表与分布式架构

3.1.2 配置文件示例

# topology.yaml

global:
  user: "tidb"
  ssh_port: 22
  deploy_dir: "/tidb/app/tidb-deploy"
  data_dir: "/tidb/app/tidb-data"

pd_servers:
  - host: 192.168.1.10

  - host: 192.168.1.11

  - host: 192.168.1.12风哥提示:

tidb_servers:
  - host: 192.168.1.20

  - host: 192.168.1.21

  - host: 192.168.1.22

tikv_servers:
  - host: 192.168.1.30

  - host: 192.168.1.31

  - host: 192.168.1.32

  - host: 192.168.1.33

  - host: 192.168.1.34

  - host: 192.168.1.35

tiflash_servers:
  - host: 192.168.1.40

  - host: 192.168.1.41

3.2 数据分片管理

3.2.1 查看Region分布

# 查看集群Region分布
tiup ctl pd -u http://192.168.1.10:2379 region

# 查看特定表的Region分布
tiup ctl pd -u http://192.168.1.10:2379 region –table test.table

3.2.2 手动分裂Region

# 手动分裂Region
tiup ctl pd -u http://192.168.1.10:2379 operator add split-region {region_id} –policy=approximate

3.3 负载均衡

3.3.1 查看调度状态

# 查看调度状态
tiup ctl pd -u http://192.168.1.10:2379 scheduler show

# 查看集群负载
tiup cluster display fgedudb

3.3.2 调整调度策略

# 调整Region调度策略
# 开启均衡调度
tiup ctl pd -u http://192.168.1.10:2379 scheduler add balance-region

# 开启热点调度
tiup ctl pd -u http://192.168.1.10:2379 scheduler add balance-hot-region

# 调整调度参数
tiup ctl pd -u http://192.168.1.10:2379 config set schedule.max-merge-region-size 20

3.4 监控与维护

3.4.1 查看集群状态

# 查看集群状态
tiup cluster display fgedudb

# 查看节点状态
tiup cluster status fgedudb

3.4.2 扩容集群

# 编辑拓扑文件,添加新节点
# 执行扩容
tiup cluster scale-out fgedudb scale-out.yaml

# 查看扩容结果
tiup cluster display fgedudb

更多视频教程www.fgedu.net.cn

本文由风哥教程整理发布,仅用于学习测试使用,转载注明出处:http://www.fgedu.net.cn/10327.html

联系我们

在线咨询:点击这里给我发消息

微信号:itpux-com

工作日:9:30-18:30,节假日休息