tidb集群使用普通用户安装报错

【 TiDB 使用环境】生产环境
【 TiDB 版本】v8.5.6
【复现路径】/home/tidb
【遇到的问题】:普通用户 tidb 安装报错(用户非sudoer),请问tidb是否支持非root的普通用户安装(用户环境不允许使用root用户,也禁止使用su和sudo)
【资源配置】进入到 TiDB Dashboard -集群信息 (Cluster Info) -主机(Hosts) 截图此页面
【附件:截图/日志/监控】
[tidb@test-tidb01 ~]$ tiup cluster deploy tidb-test v8.5.6 ./topology.yaml --user tidb -p
Checking updates for component cluster… Input SSH password:

  • Detect CPU Arch Name
    • Detecting node 10.0.4.188 Arch info … Error
    • Detecting node 10.0.4.189 Arch info … Error
    • Detecting node 10.0.1.189 Arch info … Error

Error: failed to fetch cpu-arch or kernel-name: executor.ssh.execute_failed: Failed to execute command over SSH for ‘tidb@10.0.4.188:22’ {ssh_stderr: We trust you have received the usual lecture from the local System
Administrator. It usually boils down to these three things:
#1) Respect the privacy of others.
#2) Think before you type.
#3) With great power comes great responsibility.
sudo: a terminal is required to read the password; either use the -S option to read from standard input or configure an askpass helper
, 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/tidb/.tiup/logs/tiup-cluster-debug-2026-04-17-19-05-19.log.

可以 :clown_face:

想了解这个问题, 你可以了解下什么叫用户态程序

1 个赞

指定用户应该是需要sudo权限的ssh_command: export LANG=C; PATH=$PATH:/bin:/sbin:/usr/bin:/usr/sbin; /usr/bin/sudo -H bash -c “uname -m”}

可以配置ssh免登吗,tiup中控机器到tikv节点

需要有权限执行命令才行。

这个是执行啥命令,能看出来吗

tiup中控机使用的是tidb普通用户,不属于sudoers,无法执行sudo + command ;tiup中控机到tikv节点能够免密登录

感谢各位的回复,问题目前已经解决

配置文件导致的问题

发现配置文件有问题,在使用普通非sudoer用户部署的没有加上参数 systemd_mode: “user”, tiup默认使用的是使用的是“system”
global部分的配置文件如下:

[tidb@test-tidb01 ~]$ cat topology.yaml 
global:
  user: "tidb"
  ssh_port: 22
  deploy_dir: "/tidb-deploy"
  data_dir: "/tidb-data"
  arch: "amd64"

tiup在check和deploy的报错也是这个原因导致的:
tiup ssh到远程机器上调用uname -m时,用的/usr/bin/sudo 去调用,但是tidb不属于sudoer,所以执行报错

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

关于非sudoers用户的集群部署,后续翻到了官方文档

实际执行过程中还是需要用到sudo root为指定用户开启system user
tiup no-sudo模式部署

https://docs.pingcap.com/zh/tidb/stable/tiup-cluster-no-sudo-mode/#gatsby-focus-wrapper

申请sudo把

1 个赞

有些系统信息只能root组的权限才能读取

所以还是需要sudo权限的用户来部署的吧

1 个赞

刚想到,会不会有类似suid sgid sticky这一类的限制权限呢

1 个赞

对的,sudo是为了给普通用户启动 systemd user 模式并启动驻留。后续的安装 no-sudo用户能正常执行了。

问题解决了,结论是no-sudo用户能使用tidb安装,不过还是用要用到sudo/root权限,先给普通用户启动 systemd user 模式并启动驻留。 :smiling_face:

报错的问题,结合这两个报错信息,tiup只是调用ssh去拿系统CPU架构信息,普通用户应该能执行的;插下来发现是配置的问题,可以看一下上面的回复

Detecting node 10.0.4.188 Arch info … Error

, 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

嗯,学习了,这块知识比较薄弱

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