使用 TiUP cluster 在单机上模拟生产环境部署步骤

该文描述了如何配置和部署TiDB集群,包括通过curl下载安装脚本,设置root用户的sshd_config以增加MaxSessions,然后使用tiup工具进行集群配置,如tidb、tikv和pd服务器的详细配置,并提供了具体的IP和端口设置。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

curl --proto '=https' --tlsv1.2 -sSf https://tiup-mirrors.pingcap.com/install.sh | sh

source /root/.bash_profile

tiup cluster

vim /etc/ssh/sshd_config

由于模拟多机部署,需要通过 root 用户调大 sshd 服务的连接数限制:

修改 /etc/ssh/sshd_config 将 MaxSessions 调至 20。

重启 sshd 服务:

service sshd restart

cd /opt && mkdir tidb-cluster && cd tidb-cluster

vim topo.yaml

# # bal variables are applied to all deployments and used as the default value of
# # the deployments if a specific deployment value is missing.
global:
 user: "tidb"
 ssh_port: 22
 deploy_dir: "/tidb-deploy"
 data_dir: "/tidb-data"

# # Monitored variables are applied to all the machines.
monitored:
 node_exporter_port: 9100
 blackbox_exporter_port: 9115

server_configs:
 tidb:
   log.slow-threshold: 300
 tikv:
   readpool.storage.use-unified-pool: false
   readpool.coprocessor.use-unified-pool: true
 pd:
   replication.enable-placement-rules: true
   replication.location-labels: ["host"]
 tiflash:
   logger.level: "info"

pd_servers:
 - host: 192.168.199.11

tidb_servers:
 - host: 192.168.199.11

tikv_servers:
 - host: 192.168.199.11
   port: 20160
   status_port: 20180
   config:
     server.labels: { host: "logic-host-1" }

 - host: 192.168.199.11
   port: 20161
   status_port: 20181
   config:
     server.labels: { host: "logic-host-2" }

 - host: 192.168.199.11
   port: 20162
   status_port: 20182
   config:
     server.labels: { host: "logic-host-3" }

tiflash_servers:
 - host: 192.168.199.11

monitoring_servers:
 - host: 192.168.199.11

grafana_servers:
 - host: 192.168.199.11

如果vim粘贴时格式有问题就 :set paste 再粘贴

tiup cluster deploy ./topo.yaml --user root -p

tiup cluster deploy tidb-cluster v5.0.1 ./topo.yaml --user root -p

tiup cluster start tidb-cluster

 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值