一、下载 v7.5.0
tidb-community-server-v7.5.0-linux-amd64.tar.gz
tidb-community-toolkit-v7.5.0-linux-amd64.tar.gz
二、解压
三、cd 到步骤二解压的路径
四、安装tiup组件:在步骤二的路径下执行命令:sh local_install.sh
五、定义全局变量:直接copy全局变量
六、安装tiup的cluster组件,执行如上命令,若机器已经安装 TiUP cluster,需要更新软件版本:
- tiup update --self
- tiup update cluster
- 修改配置,由于模拟多机部署,需要通过 root 用户调大 sshd 服务的连接数限制:
-
vi /etc/ssh/sshd_config ---------将MaxSessions调至 20,(i修改,esc退出,:q不保存退出)
如图:
service sshd restart ----------重启 sshd 服务 -
创建配置文件,添加到安装文件夹的目录,按下面的配置模板,编辑配置文件,命名为 topo.yaml,格式如下:
# # Global 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: 40000 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: 172.1.10.251 tidb_servers: - host: 172.1.10.251 tikv_servers: - host: 172.1.10.251 port: 20160 status_port: 20180 config: server.labels: { host: "logic-host-1" } - host: 172.1.10.251 port: 20161 status_port: 20181 config: server.labels: { host: "logic-host-2" } - host: 172.1.10.251 port: 20162 status_port: 20182 config: server.labels: { host: "logic-host-3" } tiflash_servers: - host: 172.1.10.251 tcp_port: 9001 monitoring_servers: - host: 172.1.10.251 grafana_servers: - host: 172.1.10.251
-
安装集群:tiup cluster deploy <cluster-name> <version> ./topo.yaml --user root -p,实例:tiup cluster deploy tidbtest 7.5.0 ./topo.yaml --user root -p
-
开启集群,并初始化,注意要记住密码
-
登录tidb:
如上图报错,执行如下命令解决,参考:命令行非明文密码连接 TiDB-PingCAP | 平凯星辰
-
修改root密码
-
navicat连接