作者:陈麒
原文来源: https://tidb.net/blog/0cacc3df
TiDB 集群部署
在单机上模拟部署生产环境集群
- 适用场景:希望用单台 Linux 服务器,体验 TiDB 最小的完整拓扑的集群,并模拟生产环境下的部署步骤。
1. 准备环境
准备一台部署主机,确保其软件满足需求:
- Linux 类机器:这里采用的是华为
Kylin V10 SP1
操作系统,HUAWEI,Kunpeng 920
CPU(4Cores)
<!---->
- Linux 操作系统开放外网访问,用于下载 TiDB 及相关软件安装包
1.1 最小规模的 TiDB 集群拓扑规划
| 实例 | 个数 | IP | 配置 | | ------- | -- | ----------------------------------------- | ------------------------------------------------------------ | | PD | 1 | 192.168.0.131 | 默认端口 | | TiKV | 3 | 192.168.0.131 192.168.0.131 192.168.0.131 | 避免端口和目录冲突 | | TiDB | 1 | 192.168.0.131 | 默认端口 | | TiFlash | 1 | 192.168.0.131 | 默认端口 (这里不配置 TiFlash实例) | | Monitor | 1 | 192.168.0.131 | Grafana:3003 (默认3000)、 Prometheus:9099(默认9090),默认端口Ambari已占用 |
-
拓扑文件配置模板:(
topo.yaml
)global: user: "tidb" ssh_port: 22 ssh_type: builtin deploy_dir: "/data/tidb/tidb-deploy" data_dir: "/data/tidb/tidb-data" os: linux # # Monitored variables are applied to all the machines. monitored: node_exporter_port: 9100 blackbox_exporter_port: 9115 deploy_dir: /data/tidb/tidb-deploy/monitor-9100 data_dir: /data/tidb/tidb-data/monitor-9100 log_dir: /data/tidb/tidb-deploy/monitor-9100/log server_configs: tidb: log.slow-threshold: 3000 tikv: readpool.storage.use-unified-pool: false readpool.coprocessor.use-unified-pool: true pd: replication.enable-placement-rules: true replication.location-labels: ["host"] pd_servers: - host: 192.168.0.131 ssh_port: 22 name: pd-192.168.0.131-2379 client_port: 2379 peer_port: 2380 deploy_dir: /data/tidb/tidb-deploy/pd-2379 data_dir: /data/tidb/tidb-data/pd-2379 log_dir: /data/tidb/tidb-deploy/pd-2379/log arch: arm64 os: linux tidb_servers: - host: 192.168.0.131 ssh_port: 22 port: 4000 status_port: 10080 deploy_dir: /data/tidb/tidb-deploy/tidb-4000 log_dir: /data/tidb/tidb-deploy/tidb-4000/log arch: arm64 os: linux tikv_servers: - host: 192.168.0.131 ssh_port: 22 port: 20160 status_port: 20180 d