当前位置:网站首页>TiDB跨数据中心部署拓扑
TiDB跨数据中心部署拓扑
2022-07-02 11:56:00 【添香小铺】
本文以典型的两地三中心为例,介绍跨数据中心部署的拓扑以及关键参数。本文示例所涉及的城市是上海(即 sha
)和北京(即 bja
和 bjb
)。
拓扑信息
实例 | 个数 | 物理机配置 | BJ IP | SH IP | 配置 |
---|---|---|---|---|---|
TiDB | 5 | 16 VCore 32GB * 1 | 10.0.1.1 10.0.1.2 10.0.1.3 10.0.1.4 | 10.0.1.5 | 默认端口 全局目录配置 |
PD | 5 | 4 VCore 8GB * 1 | 10.0.1.6 10.0.1.7 10.0.1.8 10.0.1.9 | 10.0.1.10 | 默认端口 全局目录配置 |
TiKV | 5 | 16 VCore 32GB 2TB (nvme ssd) * 1 | 10.0.1.11 10.0.1.12 10.0.1.13 10.0.1.14 | 10.0.1.15 | 默认端口 全局目录配置 |
Monitoring & Grafana | 1 | 4 VCore 8GB * 1 500GB (ssd) | 10.0.1.16 | 默认端口 全局目录配置 |
拓扑模版
以上 TiDB 集群拓扑文件中,详细的配置项说明见通过 TiUP 部署 TiDB 集群的拓扑文件配置。
关键参数配置
本节介绍跨数据中心部署 TiDB 集群的关键参数配置。
TiKV 参数
设置 gRPC 的压缩格式,默认为
none
。为提高跨机房部署场景的目标节点间 gRPC 包的传输速度,建议设置为 gzip 格式。server.grpc-compression-type: gzip
label 配置
由于采用跨机房部署 TiKV,为了避免物理机宕机导致 Raft Group 默认的 5 副本中丢失 3 副本,使集群不可用的问题,可以通过 label 来实现 PD 智能调度,保证同中心、同机柜、同机器 TiKV 实例不会出现 Raft Group 有 3 副本的情况。
TiKV 配置
相同物理机配置相同的 host 级别 label 信息:
config: server.labels: zone: bj dc: bja rack: rack1 host: host2
防止异地 TiKV 节点发起不必要的 Raft 选举,需要将异地 TiKV 节点发起选举时经过最少的 tick 个数和最多经过的 tick 个数都调大,这两个参数默认设置均为
0
。raftstore.raft-min-election-timeout-ticks: 1000 raftstore.raft-max-election-timeout-ticks: 1020
PD 参数
PD 元数据信息记录 TiKV 集群的拓扑信息,根据四个维度调度 Raft Group 副本。
replication.location-labels: ["zone","dc","rack","host"]
调整 Raft Group 的副本数据量为 5 ,保证集群的高可用性。
replication.max-replicas: 5
拒绝异地机房 TiKV 的 Raft 副本选举为 Leader。
label-property: reject-leader: - key: "dc" value: "sha"
注意
TiDB 5.2 及以上版本默认不支持
label-property
配置。若要设置副本策略,请使用 Placement Rules。
有关 Label 的使用和 Raft Group 副本数量,详见通过拓扑 label 进行副本调度。
注意
- 无需手动创建配置文件中的
tidb
用户,TiUP cluster 组件会在目标主机上自动创建该用户。可以自定义用户,也可以和中控机的用户保持一致。 - 如果部署目录配置为相对路径,会部署在用户家目录下。
边栏推荐
- C code audit practice + pre knowledge
- Base64 编码原来还可以这么理解
- Bit by bit of OpenCV calling USB camera
- CTO如何帮助业务?
- Yolov6 training: various problems encountered in training your dataset
- fatal: unsafe repository is owned by someone else 的解决方法
- Introduction to mathjax (web display of mathematical formulas, vector)
- 1. Editing weapon VIM
- Some Chinese character codes in the user privacy agreement are not standardized, which leads to the display of garbled codes on the web page. It needs to be found and handled uniformly
- JMeter script parameterization
猜你喜欢
geoserver离线地图服务搭建和图层发布
.NET Core 日志系统
C语言习题---(数组)
Add vector formula in rich text editor (MathType for TinyMCE, visual addition)
LeetCode - 搜索二维矩阵
kityformula-editor 配置字号和间距
LeetCode 209. Minimum length subarray
How does CTO help the business?
实用调试技巧
Simple verification code generator for 51 single chip microcomputer experiment
随机推荐
forEach的错误用法,你都学废了吗
tmall.product.schema.get( 产品信息获取schema获取 ),淘宝店铺上传商品API接口,淘宝商品发布接口,淘宝商品上传API接口,店铺上传接口,oAuth2.0接口
info [email protected]: The platform “win32“ is incompatible with this module.
STM32 standard firmware library function name (I)
MFC timer usage
btrace-(字节码)动态跟踪工具
fatal: unsafe repository is owned by someone else 的解决方法
Tmall product details interface (APP, H5 end)
【C语言】详解指针的初阶和进阶以及注意点(1)
Arithmetic operations and related exercises in C language
taobao. logistics. dummy. Send (no logistics delivery processing) interface, Taobao store delivery API interface, Taobao order delivery interface, Taobao R2 interface, Taobao oau2.0 interface
C thread transfer parameters
Jenkins Pipeline 应用与实践
Factal: Unsafe repository is owned by someone else Solution
用户隐私协议有些汉字编码不规范导致网页显示乱码,需要统一找出来处理一下
关于网页中的文本选择以及统计选中文本长度
PTA题库 ===>复数四则运算,一帮一,考试座位号(7-73)
Points clés de l'examen de principe de compilation pour l'année scolaire 2021 - 2022 [Université chinoise d'outre - mer]
MFC A对话框调用B对话框函数并传参
2. Const pointer