Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add tiup no-sudo doc #19753

Open
wants to merge 16 commits into
base: master
Choose a base branch
from
Open

Conversation

Yujie-Xie
Copy link

@Yujie-Xie Yujie-Xie commented Feb 8, 2025

First-time contributors' checklist

What is changed, added or deleted? (Required)

Which TiDB version(s) do your changes apply to? (Required)

Tips for choosing the affected version(s):

By default, CHOOSE MASTER ONLY so your changes will be applied to the next TiDB major or minor releases. If your PR involves a product feature behavior change or a compatibility change, CHOOSE THE AFFECTED RELEASE BRANCH(ES) AND MASTER.

For details, see tips for choosing the affected versions (in Chinese).

  • master (the latest development version)
  • v9.0 (TiDB 9.0 versions)
  • v8.5 (TiDB 8.5 versions)
  • v8.4 (TiDB 8.4 versions)
  • v8.3 (TiDB 8.3 versions)
  • v8.1 (TiDB 8.1 versions)
  • v7.5 (TiDB 7.5 versions)
  • v7.1 (TiDB 7.1 versions)
  • v6.5 (TiDB 6.5 versions)
  • v6.1 (TiDB 6.1 versions)
  • v5.4 (TiDB 5.4 versions)

What is the related PR or file link(s)?

Do your changes match any of the following descriptions?

  • Delete files
  • Change aliases
  • Need modification after applied to another branch
  • Might cause conflicts after applied to another branch

@CLAassistant
Copy link

CLAassistant commented Feb 8, 2025

CLA assistant check
All committers have signed the CLA.

Copy link

ti-chi-bot bot commented Feb 8, 2025

Welcome @Yujie-Xie!

It looks like this is your first PR to pingcap/docs-cn 🎉.

I'm the bot to help you request reviewers, add labels and more, See available commands.

We want to make sure your contribution gets all the attention it needs!



Thank you, and welcome to pingcap/docs-cn. 😃

@ti-chi-bot ti-chi-bot bot added contribution This PR is from a community contributor. first-time-contributor Indicates that the PR was contributed by an external member and is a first-time contributor. needs-ok-to-test Indicates a PR created by contributors and need ORG member send '/ok-to-test' to start testing. labels Feb 8, 2025
Copy link

ti-chi-bot bot commented Feb 8, 2025

Hi @Yujie-Xie. Thanks for your PR.

I'm waiting for a pingcap member to verify that this patch is reasonable to test. If it is, they should reply with /ok-to-test on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work. Regular contributors should join the org to skip this step.

Once the patch is verified, the new status will be reflected by the ok-to-test label.

I understand the commands that are listed here.

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository.

@ti-chi-bot ti-chi-bot bot added missing-translation-status This PR does not have translation status info. size/L Denotes a PR that changes 100-499 lines, ignoring generated files. labels Feb 8, 2025
@hfxsd hfxsd added translation/from-docs This PR is translated from a PR in pingcap/docs. and removed missing-translation-status This PR does not have translation status info. labels Feb 10, 2025
Copy link

ti-chi-bot bot commented Feb 10, 2025

@kaaaaaaang: adding LGTM is restricted to approvers and reviewers in OWNERS files.

In response to this:

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository.

tiup/tiup-cluster-no-sudo-mode.md Outdated Show resolved Hide resolved
tiup/tiup-cluster-no-sudo-mode.md Outdated Show resolved Hide resolved
tiup/tiup-cluster-no-sudo-mode.md Outdated Show resolved Hide resolved
tiup/tiup-cluster-no-sudo-mode.md Outdated Show resolved Hide resolved
tiup/tiup-cluster-no-sudo-mode.md Outdated Show resolved Hide resolved
tiup/tiup-cluster-no-sudo-mode.md Outdated Show resolved Hide resolved
tiup/tiup-cluster-no-sudo-mode.md Outdated Show resolved Hide resolved
tiup/tiup-cluster-no-sudo-mode.md Outdated Show resolved Hide resolved
tiup/tiup-cluster-no-sudo-mode.md Outdated Show resolved Hide resolved
tiup/tiup-cluster-topology-reference.md Outdated Show resolved Hide resolved
Co-authored-by: xixirangrang <hfxsd@hotmail.com>
@hfxsd hfxsd self-assigned this Feb 11, 2025
Copy link

ti-chi-bot bot commented Feb 11, 2025

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by:
Once this PR has been reviewed and has the lgtm label, please ask for approval from hfxsd, ensuring that each of them provides their approval before proceeding. For more information see the Code Review Process.

The full list of commands accepted by this bot can be found here.

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@hfxsd
Copy link
Collaborator

hfxsd commented Feb 11, 2025

/retest

@hfxsd hfxsd added needs-cherry-pick-release-8.1 Should cherry pick this PR to release-8.1 branch. needs-cherry-pick-release-8.5 Should cherry pick this PR to release-8.5 branch. labels Feb 11, 2025
@hfxsd
Copy link
Collaborator

hfxsd commented Feb 11, 2025

/ok-to-test

@ti-chi-bot ti-chi-bot bot added ok-to-test Indicates a PR is ready to be tested. and removed needs-ok-to-test Indicates a PR created by contributors and need ORG member send '/ok-to-test' to start testing. labels Feb 11, 2025
TOC.md Outdated Show resolved Hide resolved
@hfxsd hfxsd requested a review from lilin90 February 11, 2025 08:57
Co-authored-by: xixirangrang <hfxsd@hotmail.com>
@@ -0,0 +1,212 @@
---
title: 使用 TiUP no-sudo 模式部署运维 TiDB 线上集群
summary: 介绍如何使用 TiUP no-sudo 模式部署运维 TiDB 线上集群
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
summary: 介绍如何使用 TiUP no-sudo 模式部署运维 TiDB 线上集群
summary: 了解如何使用 TiUP no-sudo 模式部署运维 TiDB 线上集群


## 准备用户并配置 SSH 互信

1. 以 `tidb` 用户为例,你需要依次登录到所有的部署目标机器,并以 `root` 用户使用如下命令创建一个普通用户 `tidb`。在 no-sudo 模式下,不需要为 `tidb` 用户配置 sudo 免密,即无需将 `tidb` 用户加入 `sudoers` 中。
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
1.`tidb` 用户为例,你需要依次登录到所有的部署目标机器,并以 `root` 用户使用如下命令创建一个普通用户 `tidb`。在 no-sudo 模式下,不需要为 `tidb` 用户配置 sudo 免密,即无需将 `tidb` 用户加入 `sudoers`
1.`tidb` 用户为例。依次登录所有的部署目标机器,并以 `root` 用户使用如下命令创建一个普通用户 `tidb`。在 no-sudo 模式下,不需要为 `tidb` 用户配置 sudo 免密,即无需将 `tidb` 用户加入 `sudoers` 文件中

└─3358 /usr/bin/pulseaudio --daemonize=no --log-target=journal
```

执行 `systemctl --user`。如果没有报错,说明 `systemd user` 模式已经正常启动。
Copy link
Member

@lilin90 lilin90 Feb 18, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

建议采用子步骤,因为是一个具体操作。

Suggested change
执行 `systemctl --user`。如果没有报错,说明 `systemd user` 模式已经正常启动。
3. 执行 `systemctl --user`。如果没有报错,说明 `systemd` user 模式已经正常启动。

Comment on lines +56 to +64
3. 使用 `root` 用户执行以下命令,为 systemd 用户 `tidb` 启用驻留。

```bash
loginctl enable-linger tidb
```

更多详情,请参考 [systemd 用户实例的自动启动](https://wiki.archlinux.org/title/Systemd/User#Automatic_start-up_of_systemd_user_instances)。

3. 在中控机使用 ssh-keygen 生成密钥,并将公钥复制到其他部署机器,完成 SSH 互信。
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  1. 这里开始建议另起一个 step 3,上面 systemd user 模式正常启动已完成 step 2。
  2. 使用 ssh-keygen 这一步是否要提供具体的操作命令?
Suggested change
3. 使用 `root` 用户执行以下命令,为 systemd 用户 `tidb` 启用驻留。
```bash
loginctl enable-linger tidb
```
更多详情,请参考 [systemd 用户实例的自动启动](https://wiki.archlinux.org/title/Systemd/User#Automatic_start-up_of_systemd_user_instances)。
3. 在中控机使用 ssh-keygen 生成密钥,并将公钥复制到其他部署机器,完成 SSH 互信。
3. 使用 `root` 用户执行以下命令,为 systemd 用户 `tidb` 启用驻留。
```bash
loginctl enable-linger tidb
```
更多详情,参见 [systemd 用户实例的自动启动](https://wiki.archlinux.org/title/Systemd/User#Automatic_start-up_of_systemd_user_instances)。
4. 在中控机上使用 `ssh-keygen` 生成密钥,并将公钥复制到其他部署机器,完成 SSH 互信。


2. 编辑拓扑文件。

相比以往的模式,使用 no-sudo 模式的 TiUP 时,需要在 `topology.yaml` 的 `global` 模块中新增一行 `systemd_mode: "user"`。该 `systemd_mode` 参数用于设置是否使用 `systemd user` 模式。如果不设置该参数,其默认值为 `system`,表示需要使用 sudo 权限。
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这里“以往的”是指 sudo 模式吗?

Suggested change
相比以往的模式,使用 no-sudo 模式的 TiUP 时,需要在 `topology.yaml` 的 `global` 模块中新增一行 `systemd_mode: "user"`。该 `systemd_mode` 参数用于设置是否使用 `systemd user` 模式。如果不设置该参数,其默认值为 `system`,表示需要使用 sudo 权限。
相比以往的 sudo 模式,使用 no-sudo 模式的 TiUP 时,需要在 `topology.yaml` 的 `global` 模块中新增一行 `systemd_mode: "user"`。该 `systemd_mode` 参数用于设置是否使用 `systemd user` 模式。如果不设置该参数,其默认值为 `system`,表示需要使用 sudo 权限。

adduser tidb
```

2. 在每台部署目标机器上,为 `tidb` 用户启动 `systemd user` 模式。该步骤是必须的,请勿跳过。
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

英文里只给 systemd 加了行内代码格式,请确认下保持两边一致。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
contribution This PR is from a community contributor. first-time-contributor Indicates that the PR was contributed by an external member and is a first-time contributor. needs-cherry-pick-release-8.1 Should cherry pick this PR to release-8.1 branch. needs-cherry-pick-release-8.5 Should cherry pick this PR to release-8.5 branch. ok-to-test Indicates a PR is ready to be tested. size/L Denotes a PR that changes 100-499 lines, ignoring generated files. translation/from-docs This PR is translated from a PR in pingcap/docs.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants