tiup安装部署tidb集群几个注意事项

我在单台服务器中使用tiup安装部署tidb v6.5版本的集群,遇到几个问题,在此记录。

0、离线安装准备

(1) 下载server和toolkit离线安装包

(2) 解压缩两个安装包

(3) 执行server目录下的 local_install.sh 之后就会把 tiup 安装到当前用户的home目录下,会创建一个隐含目录 .tiup ,而且会将当前server目录设置为本地镜像库,即自动执行了 tiup mirror set <server安装包解压目录>。

(4) 执行命令 tiup mirror merge <toolkit安装包解压后的目录>

1、用户

无需手工创建tidb用户,tiup会自动创建。

可以使用非root用户进行安装部署,但是要有sudo权限。

2、权限

安装部署用户的ssh可以不是免密登录。

使用tiup做安装的用户必须配置为免密sudo,否则tiup命令会报错,例如:

dbuser@tidb:~$ tiup cluster deploy test 6.5.2 ./topo.yaml -u dbuser -i /home/dbuser/.ssh/id_rsa
tiup is checking updates for component cluster ...
Starting component `cluster`: /home/dbuser/.tiup/components/cluster/v1.12.1/tiup-cluster deploy test 6.5.2 ./topo.yaml -u dbuser -i /home/dbuser/.ssh/id_rsa

+ Detect CPU Arch Name
  - Detecting node 192.168.136.136 Arch info ... Error

Error: failed to fetch cpu-arch or kernel-name: executor.ssh.execute_failed: Failed to execute command over SSH for 'dbuser@192.168.136.136:22' {ssh_stderr: sudo: a terminal is required to read the password; either use the -S option to read from standard input or configure an askpass helper
sudo: a password is required
, ssh_stdout: , ssh_command: export LANG=C; PATH=$PATH:/bin:/sbin:/usr/bin:/usr/sbin /usr/bin/sudo -H bash -c "uname -m"}, cause: Process exited with status 1

Verbose debug logs has been written to /home/dbuser/.tiup/logs/tiup-cluster-debug-2023-05-06-10-18-47.log.

3、拓扑配置文件

安装部署命令示例:

tiup cluster deploy testcluster 6.5.2 ./topo.yaml -u dbuser -i /home/dbuser/.ssh/id_rsa

topo.yaml文件内容示例:

global:
  user: "tidb"
  ssh_port: 22
  deploy_dir: "/tidb-deploy"
  data_dir: "/tidb-data"
  arch: "amd64"

monitored:
  node_exporter_port: 9100
  blackbox_exporter_port: 9115

server_configs:
  pd:
    replication.location-labels: ["host"]

pd_servers:
  - host: 192.168.136.136


tidb_servers:
  - host: 192.168.136.136
    port: 4000
    status_port: 10080
    deploy_dir: "/tidb-deploy/tidb-4000"
    log_dir: "/tidb-deploy/tidb-4000/log"
  - host: 192.168.136.136
    port: 4001
    status_port: 10081
    deploy_dir: "/tidb-deploy/tidb-4001"
    log_dir: "/tidb-deploy/tidb-4001/log"

tikv_servers:
  - host: 192.168.136.136
    port: 20160
    status_port: 20180
    deploy_dir: "/tidb-deploy/tikv-20160"
    data_dir: "/tidb-data/tikv-20160"
    log_dir: "/tidb-deploy/tikv-20160/log"
    config:
      server.labels:
        host: single_server


  - host: 192.168.136.136
    port: 20161
    status_port: 20181
    deploy_dir: "/tidb-deploy/tikv-20161"
    data_dir: "/tidb-data/tikv-20161"
    log_dir: "/tidb-deploy/tikv-20161/log"
    config:
      server.labels:
        host: single_server
  - host: 192.168.136.136
    port: 20162
    status_port: 20182
    deploy_dir: "/tidb-deploy/tikv-20162"
    data_dir: "/tidb-data/tikv-20162"
    log_dir: "/tidb-deploy/tikv-20162/log"
    config:
      server.labels:
        host: single_server

tiflash_servers:
  - host: 192.168.136.136
    tcp_port: 9000
    flash_service_port: 3930
    flash_proxy_port: 20170
    flash_proxy_status_port: 20292
    http_port: 8123
    metrics_port: 8234
    deploy_dir: /tidb-deploy/tiflash-9000
    data_dir: /tidb-data/tiflash-9000
    log_dir: /tidb-deploy/tiflash-9000/log
    config:
      server.labels:
        host: single_server
  - host: 192.168.136.136
    tcp_port: 9001
    flash_service_port: 3931
    flash_proxy_port: 20171
    http_port: 8124
    flash_proxy_status_port: 20293
    metrics_port: 8235
    deploy_dir: /tidb-deploy/tiflash-9001
    data_dir: /tidb-data/tiflash-9001
    log_dir: /tidb-deploy/tiflash-9001/log
    config:
      server.labels:
        host: single_server

kvcdc_servers:
  - host: 192.168.136.136
    port: 8600
    log_dir: "/tidb-deploy/tikv-cdc-8600/log"
    data_dir: "/tidb-data/tikv-cdc-8600"
  - host: 192.168.136.136
    port: 8601
    log_dir: "/tidb-deploy/tikv-cdc-8601/log"
    data_dir: "/tidb-data/tikv-cdc-8601"
  - host: 192.168.136.136
    port: 8602
    log_dir: "/tidb-deploy/tikv-cdc-8602/log"
    data_dir: "/tidb-data/tikv-cdc-8602"

monitoring_servers:
  - host: 192.168.136.136

grafana_servers:
  - host: 192.168.136.136

alertmanager_servers:
  - host: 192.168.136.136

如果没有把toolkit安装包合并到安装镜像(tiup mirror merge <toolkit安装包解压后的目录>),则会在部署ticdc节点时报错“ unkown component ”,例如:

dbuser@tidb:~$ tiup cluster deploy test 6.5.2 ./topo.yaml -u dbuser -i /home/dbuser/.ssh/id_rsa
tiup is checking updates for component cluster ...
Starting component `cluster`: /home/dbuser/.tiup/components/cluster/v1.12.1/tiup-cluster deploy test 6.5.2 ./topo.yaml -u dbuser -i /home/dbuser/.ssh/id_rsa

+ Detect CPU Arch Name
  - Detecting node 192.168.136.136 Arch info ... Done

+ Detect CPU OS Name
  - Detecting node 192.168.136.136 OS info ... Done
Please confirm your topology:
Cluster type:    tidb
Cluster name:    test
Cluster version: v6.5.2
Role          Host             Ports                            OS/Arch       Directories
----          ----             -----                            -------       -----------
pd            192.168.136.136  2379/2380                        linux/x86_64  /tidb-deploy/pd-2379,/tidb-data/pd-2379
tikv          192.168.136.136  20160/20180                      linux/x86_64  /tidb-deploy/tikv-20160,/tidb-data/tikv-20160
tikv          192.168.136.136  20161/20181                      linux/x86_64  /tidb-deploy/tikv-20161,/tidb-data/tikv-20161
tikv          192.168.136.136  20162/20182                      linux/x86_64  /tidb-deploy/tikv-20162,/tidb-data/tikv-20162
tidb          192.168.136.136  4000/10080                       linux/x86_64  /tidb-deploy/tidb-4000
tidb          192.168.136.136  4001/10081                       linux/x86_64  /tidb-deploy/tidb-4001
tiflash       192.168.136.136  9000/8123/3930/20170/20292/8234  linux/x86_64  /tidb-deploy/tiflash-9000,/tidb-data/tiflash-9000
tiflash       192.168.136.136  9001/8124/3931/20171/20293/8235  linux/x86_64  /tidb-deploy/tiflash-9001,/tidb-data/tiflash-9001
cdc           192.168.136.136  8600                             linux/x86_64  /tidb-deploy/cdc-8600,/tidb-data/tikv-cdc-8600
cdc           192.168.136.136  8601                             linux/x86_64  /tidb-deploy/cdc-8601,/tidb-data/tikv-cdc-8601
cdc           192.168.136.136  8602                             linux/x86_64  /tidb-deploy/cdc-8602,/tidb-data/tikv-cdc-8602
prometheus    192.168.136.136  9090/12020                       linux/x86_64  /tidb-deploy/prometheus-9090,/tidb-data/prometheus-9090
grafana       192.168.136.136  3000                             linux/x86_64  /tidb-deploy/grafana-3000
alertmanager  192.168.136.136  9093/9094                        linux/x86_64  /tidb-deploy/alertmanager-9093,/tidb-data/alertmanager-9093
Attention:
    1. If the topology is not what you expected, check your yaml file.
    2. Please confirm there is no port/directory conflicts in same host.
Do you want to continue? [y/N]: (default=N) y
+ Generate SSH keys ... Done
+ Download TiDB components
  - Download pd:v6.5.2 (linux/amd64) ... Done
  - Download tikv:v6.5.2 (linux/amd64) ... Done
  - Download tidb:v6.5.2 (linux/amd64) ... Done
  - Download tiflash:v6.5.2 (linux/amd64) ... Done
  - Download cdc:v6.5.2 (linux/amd64) ... Error
  - Download prometheus:v6.5.2 (linux/amd64) ... Done
  - Download grafana:v6.5.2 (linux/amd64) ... Done
  - Download alertmanager: (linux/amd64) ... Done
  - Download node_exporter: (linux/amd64) ... Done
  - Download blackbox_exporter: (linux/amd64) ... Done

Error: unknown component

Verbose debug logs has been written to /home/dbuser/.tiup/logs/tiup-cluster-debug-2023-05-06-10-48-41.log.

4、启动集群

第一次启动集群:

tiup cluster start testcluster --init

  • 1
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值