tiup cluster 单机部署,中控机与部署机器为同一台,部署失败,(task.env_init.failed)

为提高效率,请提供以下信息,问题描述清晰能够更快得到解决:

以下为报错信息:

【 TiDB 使用环境】 Ubuntu20.04

【概述】单机模拟生产环境

【背景】用户tidb有sudo权限,ssh可以免密登录,.ssh权限为744,.ssh里面的文件都有读写权限

所使用的命令为:

tiup cluster deploy ti-cluster v4.0.14 ~/topo.yaml --user tidb -p

topo.yaml配置文件为

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: 127.0.0.1

tidb_servers:
 - host: 127.0.0.1

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

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

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

tiflash_servers:
 - host: 127.0.0.1

monitoring_servers:
 - host: 127.0.0.1

grafana_servers:
 - host: 127.0.0.1

相应的log为:

2021-08-26T10:49:10.738+0800    INFO    Execute command finished        {"code": 1, "error": "task.env_init.failed: Failed to initialize TiDB environment on remote host '127.0.0.1', cause: task.env_init.sub_command_failed: Failed to create '~/.ssh' directory for user 'tidb', cause: executor.ssh.execute_failed: Failed to execute command over SSH for 'tidb@127.0.0.1:22' {ssh_stderr: , ssh_stdout: , ssh_command: export LANG=C; PATH=$PATH:/usr/bin:/usr/sbin /usr/bin/sudo -H bash -c \"su - tidb -c 'mkdir -p ~/.ssh && chmod 700 ~/.ssh'\"}, cause: ssh: handshake failed: ssh: unable to authenticate, attempted methods [none], no supported methods remain", "errorVerbose": "task.env_init.failed: Failed to initialize TiDB environment on remote host '127.0.0.1', cause: task.env_init.sub_command_failed: Failed to create '~/.ssh' directory for user 'tidb', cause: executor.ssh.execute_failed: Failed to execute command over SSH for 'tidb@127.0.0.1:22' {ssh_stderr: , ssh_stdout: , ssh_command: export LANG=C; PATH=$PATH:/usr/bin:/usr/sbin /usr/bin/sudo -H bash -c \"su - tidb -c 'mkdir -p ~/.ssh && chmod 700 ~/.ssh'\"}, cause: ssh: handshake failed: ssh: unable to authenticate, attempted methods [none], no supported methods remain\
 at github.com/pingcap/tiup/pkg/cluster/executor.(*EasySSHExecutor).Execute()\
\tgithub.com/pingcap/tiup/pkg/cluster/executor/ssh.go:154\
 at github.com/pingcap/tiup/pkg/cluster/executor.(*CheckPointExecutor).Execute()\
\tgithub.com/pingcap/tiup/pkg/cluster/executor/checkpoint.go:85\
 at github.com/pingcap/tiup/pkg/cluster/task.(*EnvInit).execute()\
\tgithub.com/pingcap/tiup/pkg/cluster/task/env_init.go:81\
 at github.com/pingcap/tiup/pkg/cluster/task.(*EnvInit).Execute()\
\tgithub.com/pingcap/tiup/pkg/cluster/task/env_init.go:47\
 at github.com/pingcap/tiup/pkg/cluster/task.(*Serial).Execute()\
\tgithub.com/pingcap/tiup/pkg/cluster/task/task.go:85\
 at github.com/pingcap/tiup/pkg/cluster/task.(*StepDisplay).Execute()\
\tgithub.com/pingcap/tiup/pkg/cluster/task/step.go:87\
 at github.com/pingcap/tiup/pkg/cluster/task.(*Parallel).Execute.func1()\
\tgithub.com/pingcap/tiup/pkg/cluster/task/task.go:134\
 at runtime.goexit()\
\truntime/asm_amd64.s:1371"}

麻烦先参考下面这个帖子排查下:

解决了,这个链接https://docs.pingcap.com/zh/tidb/stable/production-deployment-using-tiup#%E7%AC%AC-4-%E6%AD%A5%E6%89%A7%E8%A1%8C%E9%83%A8%E7%BD%B2%E5%91%BD%E4%BB%A4里的,使用-i,指定私钥地址

但是现在出现了新的问题

Error: failed to enable/disable pd: failed to enable: 127.0.0.1 pd-2379.service, please check the instance's log(/tidb-deploy/pd-2379/log) for more detail.: executor.ssh.execute_failed: Failed to execute command over SSH for 'cyf@127.0.0.1:22' {ssh_stderr: System has not been booted with systemd as init system (PID 1). Can't operate.
Failed to connect to bus: Host is down
, ssh_stdout: , ssh_command: export LANG=C; PATH=$PATH:/usr/bin:/usr/sbin /usr/bin/sudo -H bash -c "systemctl daemon-reload && systemctl enable pd-2379.service"}, cause: Process exited with status 1

Verbose debug logs has been written to /home/cyf/.tiup/logs/tiup-cluster-debug-2021-08-26-15-07-41.log.
Error: run `/home/cyf/.tiup/components/cluster/v1.5.5/tiup-cluster` (wd:/home/cyf/.tiup/data/ShAuuHz) failed: exit status 1

这个问题应该是因为我使用的是wsl2来部署tidb,wsl2用的是service ssh start的方式,而不是systemctl,tidb用的都是systemd的方式来启动,所以会有这个错误,这个错误有么有什么解决的方法?

但是直接tiup playground在wsl2上是跑得起来的,emmmm,pd-2379/里面的log也没有内容

可能 tiup 相关组件在 wsl2 兼容性上有点问题,如果条件允许还是在 Linux 虚机上测试比较靠谱点。

此话题已在最后回复的 1 分钟后被自动关闭。不再允许新回复。