新建用户
1 | useradd tidb |
在中控机上部署 TiUP 组件
在中控机上部署 TiUP 组件有两种方式:在线部署和离线部署。
在线部署
以普通用户身份登录中控机。以 tidb
用户为例,后续安装 TiUP 及集群管理操作均通过该用户完成:
-
执行如下命令安装 TiUP 工具:
1
curl --proto '=https' --tlsv1.2 -sSf https://tiup-mirrors.pingcap.com/install.sh | sh
-
按如下步骤设置 TiUP 环境变量:
-
重新声明全局环境变量:
1
source .bash_profile
-
确认 TiUP 工具是否安装:
1
which tiup
-
-
安装 TiUP cluster 组件:
1
tiup cluster
-
如果已经安装,则更新 TiUP cluster 组件至最新版本:
1
tiup update --self && tiup update cluster
预期输出
“Update successfully!”
字样。 -
验证当前 TiUP cluster 版本信息。执行如下命令查看 TiUP cluster 组件版本:
1
tiup --binary cluster
优化系统配置
vim /etc/sysctl.conf
1 | net.ipv4.tcp_tw_recycle = 0 |
/etc/security/limits.conf
1 | * soft nofile 1048576 |
1 | ansible tidb101 -m shell -a " yum -y install numactl.x86_64 " |
执行部署命令
-
检查集群存在的潜在风险:
1
tiup cluster check ./blockin-topology-101.yaml --user root [-p] [-i /home/root/.ssh/gcp_rsa]
-
自动修复集群存在的潜在风险:
1
tiup cluster check ./blockin-topology-101.yaml --apply --user root [-p] [-i /home/root/.ssh/gcp_rsa]
-
部署 TiDB 集群:
1
tiup cluster deploy tidb-prod-101 v6.5.5 ./blockin-topology-101.yaml --user root [-p] [-i /home/root/.ssh/gcp_rsa]
tiup cluster list
tiup cluster display tidb-prod-101
tiup cluster scale-in