Skip to content

tiup: clarify limits.conf behavior in no-sudo mode - #23120

Open
doc-claw-bot wants to merge 7 commits into
pingcap:masterfrom
doc-claw-bot:docs/nosudo-limits-user-manager
Open

tiup: clarify limits.conf behavior in no-sudo mode#23120
doc-claw-bot wants to merge 7 commits into
pingcap:masterfrom
doc-claw-bot:docs/nosudo-limits-user-manager

Conversation

@doc-claw-bot

@doc-claw-bot doc-claw-bot commented Jun 23, 2026

Copy link
Copy Markdown
Collaborator

What is changed, added or deleted? (Required)

This PR updates the TiUP no-sudo documentation to clarify how resource limits take effect for the per-user systemd manager.

  • Clarify that /etc/security/limits.conf might be applied through PAM when user@<UID>.service starts, but the effective Max open files value still depends on the limits obtained by the user manager itself.
  • Add a verification step to check the effective Max open files value of the running user@${uid}.service.
  • Add a documented fallback: if the effective value is still too low, configure a system-level drop-in for user@${uid}.service with LimitNOFILE=1000000.
  • Explain that restarting user@${uid}.service stops all user services managed by that user, so existing clusters should be stopped first or handled in a maintenance window.

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.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)

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

Summary by CodeRabbit

  • Documentation
    • Clarified that updating /etc/security/limits.conf may not raise effective open-file limits when systemd user instance limits apply.
    • Expanded the “start systemd user mode” workflow to include restarting user@<UID>.service after changes and verifying Max open files via /proc/<MainPID>/limits.
    • Added guidance to set a systemd drop-in (LimitNOFILE=1000000) when the hard limit is too low, followed by daemon-reload, restart, and re-verification.
    • Updated the final validation to ensure systemctl --user shows the user service started successfully.

@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 Jun 23, 2026
@ti-chi-bot

ti-chi-bot Bot commented Jun 23, 2026

Copy link
Copy Markdown

Hi @doc-claw-bot. 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.

Details

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 the missing-translation-status This PR does not have translation status info. label Jun 23, 2026
@ti-chi-bot ti-chi-bot Bot added the size/XS Denotes a PR that changes 0-9 lines, ignoring generated files. label Jun 23, 2026

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Code Review

This pull request updates the documentation for TiDB in no-sudo mode to explain how to apply limits from /etc/security/limits.conf by restarting the per-user systemd instance. The review feedback suggests improving clarity and readability by using active voice, making the shell code block more copy-paste friendly by moving the conditional restart explanation into the text, and changing "might not take effect" to "will not take effect" for technical accuracy.

Important

The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.

Comment thread tiup/tiup-cluster-no-sudo-mode.md Outdated
Comment on lines 56 to 63
2. Use the `root` user to start the user service. If `user@${uid}.service` is already running after you update `/etc/security/limits.conf`, run `systemctl restart user@${uid}.service` to apply the new limits.

```shell
$ uid=$(id -u tidb) # Get the ID of the tidb user
$ systemctl start user@${uid}.service
# If user@${uid}.service is already running after you update /etc/security/limits.conf, run:
$ systemctl restart user@${uid}.service
$ systemctl status user@${uid}.service

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

medium

Including both start and restart commands with a conditional comment inside a single shell code block makes it cluttered and less copy-paste friendly (users copy-pasting the block will run both commands sequentially). It is cleaner to explain the restart scenario in the text and keep the code block focused on the standard start/status commands.

Suggested change
2. Use the `root` user to start the user service. If `user@${uid}.service` is already running after you update `/etc/security/limits.conf`, run `systemctl restart user@${uid}.service` to apply the new limits.
```shell
$ uid=$(id -u tidb) # Get the ID of the tidb user
$ systemctl start user@${uid}.service
# If user@${uid}.service is already running after you update /etc/security/limits.conf, run:
$ systemctl restart user@${uid}.service
$ systemctl status user@${uid}.service
2. Use the `root` user to start the user service. If `user@${uid}.service` is already running and you have updated `/etc/security/limits.conf`, run `systemctl restart user@${uid}.service` instead of `systemctl start user@${uid}.service` to apply the new limits.
```shell
$ uid=$(id -u tidb) # Get the ID of the tidb user
$ systemctl start user@${uid}.service
$ systemctl status user@${uid}.service
References
  1. Ensure clarity, simplicity, and readability, and avoid unnecessary words and repetition. (link)

Comment thread tiup/tiup-cluster-no-sudo-mode.md Outdated
EOF
```

Because TiDB services in no-sudo mode are managed by the per-user `systemd` instance (`user@<UID>.service`), the limits in `/etc/security/limits.conf` are applied when `user@<UID>.service` starts. If you change `/etc/security/limits.conf` after `user@<UID>.service` is already running, restart `user@<UID>.service` or reboot the target machine before you deploy or restart TiDB services. Otherwise, the new limits might not take effect for the TiDB services.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

low

To improve clarity and accuracy, use active voice ("you must restart") and change "might not take effect" to "will not take effect" (since systemd will definitely not apply the new limits without a restart).

Suggested change
Because TiDB services in no-sudo mode are managed by the per-user `systemd` instance (`user@<UID>.service`), the limits in `/etc/security/limits.conf` are applied when `user@<UID>.service` starts. If you change `/etc/security/limits.conf` after `user@<UID>.service` is already running, restart `user@<UID>.service` or reboot the target machine before you deploy or restart TiDB services. Otherwise, the new limits might not take effect for the TiDB services.
Because TiDB services in no-sudo mode are managed by the per-user `systemd` instance (`user@<UID>.service`), the limits in `/etc/security/limits.conf` only take effect when `user@<UID>.service` starts. If you change `/etc/security/limits.conf` after `user@<UID>.service` is already running, you must restart `user@<UID>.service` or reboot the target machine before deploying or restarting TiDB services. Otherwise, the new limits will not take effect.
References
  1. Write in second person ('you'), prefer present tense, and avoid unnecessary words and repetition. (link)

@ti-chi-bot ti-chi-bot Bot added size/M Denotes a PR that changes 30-99 lines, ignoring generated files. and removed size/XS Denotes a PR that changes 0-9 lines, ignoring generated files. labels Jun 23, 2026
@lilin90 lilin90 added the translation/done This PR has been translated from English into Chinese and updated to pingcap/docs-cn in a PR. label Jun 24, 2026
@lilin90 lilin90 self-assigned this Jun 24, 2026
@ti-chi-bot ti-chi-bot Bot removed the missing-translation-status This PR does not have translation status info. label Jun 24, 2026
@lilin90 lilin90 added missing-translation-status This PR does not have translation status info. ONCALL Relates to documentation oncall. labels Jun 24, 2026
@lilin90

lilin90 commented Jun 24, 2026

Copy link
Copy Markdown
Member

/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 Jun 24, 2026
@lilin90 lilin90 removed the missing-translation-status This PR does not have translation status info. label Jun 24, 2026
@lilin90
lilin90 requested a review from Copilot June 24, 2026 02:51

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

This PR clarifies how file descriptor limits are applied in TiUP no-sudo mode, specifically how user@<UID>.service (the per-user systemd manager) affects the effective Max open files limit for TiDB services.

Changes:

  • Adds an explanation of why /etc/security/limits.conf might not fully take effect for the running user systemd manager.
  • Adds steps to restart user@${uid}.service (when applicable) and verify the effective Max open files value via /proc/<pid>/limits.
  • Documents a fallback using a system-level drop-in to set LimitNOFILE=1000000 for user@${uid}.service, plus an operational warning about the restart impact.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread tiup/tiup-cluster-no-sudo-mode.md Outdated
Comment on lines +79 to +84
If you update `/etc/security/limits.conf` after `user@${uid}.service` is already running, restart `user@${uid}.service` before you deploy or restart TiDB services so that the user `systemd` instance reloads the updated resource limits. Restarting `user@${uid}.service` stops all systemd user services managed by that user. If the cluster is already running, stop it gracefully first or perform this operation during a maintenance window.

```shell
$ uid=$(id -u tidb) # Get the ID of the tidb user
$ systemctl restart user@${uid}.service
```
@lilin90
lilin90 requested a review from bb7133 June 24, 2026 06:56
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
@ti-chi-bot

ti-chi-bot Bot commented Jul 27, 2026

Copy link
Copy Markdown

[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 lilin90. For more information see the Code Review Process.
Please ensure that each of them provides their approval before proceeding.

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

Details 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

@coderabbitai

coderabbitai Bot commented Jul 27, 2026

Copy link
Copy Markdown

Review Change Stack

Warning

Review limit reached

@lilin90, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 46 minutes

Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.
You're only billed for reviews past your plan's rate limits ($0.25/file).

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: a748a95e-1150-4d57-ae18-7e8ce8f3bd30

📥 Commits

Reviewing files that changed from the base of the PR and between 7dcaf15 and 754b858.

📒 Files selected for processing (1)
  • tiup/tiup-cluster-no-sudo-mode.md
📝 Walkthrough

Walkthrough

The no-sudo mode guide now explains how to restart, inspect, and configure the user systemd service’s effective file descriptor limit before validating TiDB startup.

Changes

No-sudo systemd setup

Layer / File(s) Summary
Configure and verify user-service limits
tiup/tiup-cluster-no-sudo-mode.md
Documents the relationship between PAM limits and user systemd limits, adds restart and /proc/<MainPID>/limits checks, provides an optional LimitNOFILE=1000000 drop-in procedure, and retains final systemctl --user validation.

Estimated code review effort: 1 (Trivial) | ~3 minutes

Suggested reviewers: bb7133

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Title check ✅ Passed The title clearly summarizes the no-sudo limits.conf clarification in TiUP documentation.
Description check ✅ Passed The description covers the required change summary, affected versions, and reference links from the template.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

Comment thread tiup/tiup-cluster-no-sudo-mode.md Outdated

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 1


ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: 1f2c60ae-d9c7-425a-9763-650e96060c85

📥 Commits

Reviewing files that changed from the base of the PR and between c14e4fa and b61f636.

📒 Files selected for processing (1)
  • tiup/tiup-cluster-no-sudo-mode.md

Comment thread tiup/tiup-cluster-no-sudo-mode.md Outdated
@lilin90 lilin90 added needs-cherry-pick-release-8.5 Should cherry pick this PR to release-8.5 branch. area/tiup Indicates that the Issue or PR belongs to the area of the TiUP tool. labels Jul 27, 2026

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
tiup/tiup-cluster-no-sudo-mode.md (1)

109-109: 🎯 Functional Correctness | 🟠 Major | ⚡ Quick win

Run a concrete user-manager command.

systemctl --user is not a valid action; it only selects the user manager. Use a real command such as systemctl --user status or systemctl --user list-units so this step fails when the user service mode is not reachable.

Source: MCP tools


ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: 3630c65a-b268-4831-82e4-b7d4b388a789

📥 Commits

Reviewing files that changed from the base of the PR and between b61f636 and 7dcaf15.

📒 Files selected for processing (1)
  • tiup/tiup-cluster-no-sudo-mode.md

Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
@CLAassistant

CLAassistant commented Aug 14, 2026

Copy link
Copy Markdown

CLA assistant check
All committers have signed the CLA.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/tiup Indicates that the Issue or PR belongs to the area of the TiUP tool. 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.5 Should cherry pick this PR to release-8.5 branch. ok-to-test Indicates a PR is ready to be tested. ONCALL Relates to documentation oncall. size/M Denotes a PR that changes 30-99 lines, ignoring generated files. translation/done This PR has been translated from English into Chinese and updated to pingcap/docs-cn in a PR.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants