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

TiDB Quick Start refresh #19412

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

Conversation

alastori
Copy link
Contributor

What is changed, added or deleted? (Required)

Significantly improved the Quick Start Guide to make it more user-friendly and educational:

  • Restructured content to follow a clear learning path
  • Added a sample weather monitoring application to demonstrate real-world usage
  • Improved monitoring and scaling sections with practical examples
  • Added detailed explanations of components and their roles
  • Included developer workflow best practices with tagged environments
  • Enhanced the guide with monitoring visualization tips
  • Added clear "What's next" section with targeted resources
  • Improved code examples with proper formatting and explanations
  • Added more contextual information about TiDB's capabilities
  • Improved navigation and readability

The changes aim to provide a better first-time user experience while maintaining technical accuracy and demonstrating TiDB's key features through practical examples.

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

  • master (the latest development version)

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

This PR updates the existing Quick Start Guide with modern documentation best practices and a more comprehensive learning approach.

@ti-chi-bot ti-chi-bot bot added missing-translation-status This PR does not have translation status info. size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. labels Nov 15, 2024
@lilin90 lilin90 self-assigned this Nov 15, 2024
Copy link

ti-chi-bot bot commented Nov 15, 2024

[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, 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

@lilin90 lilin90 requested a review from likidu November 15, 2024 02:47
@ti-chi-bot ti-chi-bot bot added the area/develop This PR relates to the area of TiDB App development. label Nov 15, 2024
@lilin90 lilin90 added the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Nov 15, 2024
===============================================
```
```shell
source ~/.bash_profile
Copy link
Collaborator

@Oreoxmt Oreoxmt Nov 22, 2024

Choose a reason for hiding this comment

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

source ~/.bash_profile

The current description is too specific and may mislead users, as shell profile paths can vary across different Linux distributions and shell types. I recommend keeping the original, more flexible instructions:

Note the Shell profile path in the output above. You need to use the path in the next step.
2. Declare the global environment variable:
> **Note:**
>
> After the installation, TiUP displays the absolute path of the corresponding Shell profile file. You need to modify `${your_shell_profile}` in the following `source` command according to the path. In this case, `${your_shell_profile}` is `/Users/user/.zshrc` from the output of Step 1.
{{< copyable "shell-regular" >}}
```shell
source ${your_shell_profile}
```

For example, in the installation output shown below, the shell profile is /home/codespace/.bashrc:

Successfully set mirror to https://tiup-mirrors.pingcap.com
Detected shell: bash
Shell profile:  /home/codespace/.bashrc
/home/codespace/.bashrc has been modified to add tiup to PATH
open a new terminal or source /home/codespace/.bashrc to use it
Installed path: /home/codespace/.tiup/bin/tiup
===============================================
Have a try:     tiup playground
===============================================

open a new terminal or source /home/codespace/.bashrc to use it


{{< copyable "shell-regular" >}}
You should see this output:
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
You should see this output:
The output is as follows:

should, should be link
Generally avoid.
Because should is ambiguous by definition, it can be problematic.
"If an outcome is expected: Describe the outcome in terms of what is expected. For example: "The process returns 10 items."

https://developers.google.com/style/word-list#should

github-actions bot pushed a commit to Oreoxmt/pingcap-docsite-preview that referenced this pull request Nov 22, 2024
quick-start-with-tidb.md Outdated Show resolved Hide resolved
github-actions bot pushed a commit to Oreoxmt/pingcap-docsite-preview that referenced this pull request Nov 29, 2024
Copy link
Collaborator

Choose a reason for hiding this comment

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


This command returns the access methods of the cluster:
Select the endpoint to connect, and try your first commands:
Copy link
Collaborator

@qiancai qiancai Nov 29, 2024

Choose a reason for hiding this comment

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

Suggested change
Select the endpoint to connect, and try your first commands:
Press <kbd>Enter</kbd> to connect to the endpoint, and try your first statements:

Copy link
Collaborator

Choose a reason for hiding this comment

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

Reason: It seems that pressing ↑ or ↓ is not working to switch the endpoint does not work. Users have to press Enter to connect to the default endpoint.

image

source ${your_shell_profile}
```
```shell
tiup playground display
Copy link
Collaborator

@qiancai qiancai Nov 29, 2024

Choose a reason for hiding this comment

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

Could we guide users to run this command before introducing the concepts of TiDB, TiKV, PD, and TiFlash components? This way, they will first see which components have been installed from the output of this command, and then get the explanations of these components in our document.

A new version of playground is available: v1.14.1 -> v1.16.1

    To update this component:   tiup update playground
    To update all components:   tiup update --all

Pid    Role     Uptime
---    ----     ------
18997  pd       50m54.278572s
19089  tikv     50m6.9280185s
19353  tidb     47m42.160680084s
20593  tiflash  36m26.515627792s


- To start a TiDB cluster of the latest version with 1 TiDB instance, 1 TiKV instance, 1 PD instance, and 1 TiFlash instance, run the following command:
The previous steps gave you an ephemeral environment - perfect for first experiments but everything is lost when you stop the playground. Let's set up a more suitable environment for development.
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
The previous steps gave you an ephemeral environment - perfect for first experiments but everything is lost when you stop the playground. Let's set up a more suitable environment for development.
The previous steps gave you an ephemeral environment - perfect for first experiments but everything is lost when you stop the playground. You can set up a more suitable environment for development.

1. View your running queries:

- Go to "SQL Statements" to see your weather data queries
- Check execution times, and additional optional columns, and click on the statement for more execution details
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
- Check execution times, and additional optional columns, and click on the statement for more execution details
- Check execution times, and additional optional columns, and click the statement for more execution details


1. Download and install TiUP:
## Scaling your cluster
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
## Scaling your cluster
## Scale your cluster

- `user: "tidb"`: Use the `tidb` system user (automatically created during deployment) to perform the internal management of the cluster. By default, use port 22 to log in to the target machine via SSH.
- `replication.enable-placement-rules`: This PD parameter is set to ensure that TiFlash runs normally.
- `host`: The IP of the target machine.
Let's remove one TiKV node. For these scale-in operations, we specify the exact node we want to remove using its PID. First, in your available terminal, check the TiKV nodes PIDs:
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
Let's remove one TiKV node. For these scale-in operations, we specify the exact node we want to remove using its PID. First, in your available terminal, check the TiKV nodes PIDs:
Remove one TiKV node. For these scale-in operations, you can specify the exact node you want to remove using its PID. First, in your available terminal, check the TiKV nodes PIDs:

```shell
tiup cluster deploy <cluster-name> <version> ./topo.yaml --user root -p
```
You can scale-in your cluster by removing one TiKV node of your choice using its PID. For example, run the following replacing the `--pid` value with your `tikv` PID:
Copy link
Collaborator

@hfxsd hfxsd Nov 29, 2024

Choose a reason for hiding this comment

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

Suggested change
You can scale-in your cluster by removing one TiKV node of your choice using its PID. For example, run the following replacing the `--pid` value with your `tikv` PID:
You can scale in your cluster by removing one TiKV node of your choice using its PID. For example, run the following to replace the `--pid` value with your `tikv` PID:

Comment on lines +198 to 201
```shell
tiup clean dev-env
```

Copy link
Collaborator

@qiancai qiancai Nov 29, 2024

Choose a reason for hiding this comment

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

move this command to the Tip (https://github.com/pingcap/docs/pull/19412/files#r1863110475), as it doesn’t need to be executed at this point.


{{< copyable "shell-regular" >}}
- TiDB Dashboard, "Cluster Info", "Instances". Check the new TiDB instance
- Grafana, search for "TiProxy-Summary", and expand the "Query Summary" or "Traffic". You should see a new instance in the backend and the traffic is being balanced across them
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
- Grafana, search for "TiProxy-Summary", and expand the "Query Summary" or "Traffic". You should see a new instance in the backend and the traffic is being balanced across them
- Grafana, search for "TiProxy-Summary", and expand the "Query Summary" or "Traffic". You can see a new instance in the backend and the traffic is being balanced across them


6. Access the [TiDB Dashboard](/dashboard/dashboard-intro.md) at <http://127.0.0.1:2379/dashboard>. The default username is `root`, and the password is empty.
To add a TiProxy instance as a load balancer to your existing `sample-app-env` environment with:
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
To add a TiProxy instance as a load balancer to your existing `sample-app-env` environment with:
To add a TiProxy (a load balancer for TiDB) instance to your existing `sample-app-env` environment with:

```shell
tiup playground v8.4.0 --db 2 --pd 3 --kv 3
```
Tags also makes cleanup explicit with:
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
Tags also makes cleanup explicit with:
Tags also make cleanup explicit with:


8. (Optional) [Load data to TiFlash](/tiflash/tiflash-overview.md#use-tiflash) for analysis.
```shell
tiup playground v8.1.0 --tag sample-app-env --db 2 --kv 3 --pd 1 --tiflash 0 --tiproxy 1
Copy link
Collaborator

Choose a reason for hiding this comment

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

Every time I execute this command, I encounter the following error. However, if I clean up the existing sample-app-env using tiup clean sample-app-env and then re-execute the command, it works fine. Therefore, I’m unsure if adding TiProxy to an existing cluster this way is correct.

Start pd instance: v8.1.0
Start tikv instance: v8.1.0
Start tikv instance: v8.1.0
Start tikv instance: v8.1.0
Start tidb instance: v8.1.0
Start tidb instance: v8.1.0
Start tiproxy instance: v1.3.0
Waiting for tidb and tiproxy instances ready
127.0.0.1:62346 ... Error
127.0.0.1:62348 ... Error


> **Note:**
See all TiUP playground options with:
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
See all TiUP playground options with:
Open a new terminal, and then see all TiUP playground options with:

Copy link
Collaborator

Choose a reason for hiding this comment

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

reason: Avoid users closing the terminal with the Proxy connection so they can proceed with the steps in "Sample scalable database application".

TiDB Playground Cluster is started, enjoy!
Connect TiDB: mysql --host 127.0.0.1 --port 4001 -u root
Connect TiDB: mysql --host 127.0.0.1 --port 4000 -u root
Connect TiProxy: mysql --host 127.0.0.1 --port 6000 -u root
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
Connect TiProxy: mysql --host 127.0.0.1 --port 6000 -u root
Connect TiProxy: mysql --host 127.0.0.1 --port 6000 -u root
TiDB Dashboard: http://127.0.0.1:60434/dashboard
Grafana: http://127.0.0.1:60838

Copy link
Collaborator

Choose a reason for hiding this comment

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

reason: We can instruct users to note the Dashboard link as it will be used in "TiDB Dashboard: SQL insights" to check "weather data queries"


### TiDB Dashboard: SQL insights

Access TiDB Dashboard by checking its URL on the terminal you are running TiUP playground (typically http://127.0.0.1:2379/dashboard - user: `root`, no password) to:
Copy link
Collaborator

@qiancai qiancai Nov 29, 2024

Choose a reason for hiding this comment

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

"typically http://127.0.0.1:2379/dashboard" is confusing here because this section assumes TiProxy is added. In that case, "http://127.0.0.1:60434/dashboard/" is also typical.

Suggested change
Access TiDB Dashboard by checking its URL on the terminal you are running TiUP playground (typically http://127.0.0.1:2379/dashboard - user: `root`, no password) to:
Access TiDB Dashboard by using its URL (for example, http://127.0.0.1:2379/dashboard) in the terminal where you are running TiUP playground. The default login is root with no password.


### Grafana: system performance

Access Grafana by checking its URL on the terminal you are running TiUP playground (typically http://127.0.0.1:3000 - user: `admin`, password: `admin`). Change the password or Skip. You can visualize the built-in dashboards by clicking on the Search icon and the folder "Test-Cluster":
Copy link
Collaborator

Choose a reason for hiding this comment

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

"typically http://127.0.0.1:2379/dashboard" is confusing here because this section assumes TiProxy is added. In that case, " http://127.0.0.1:60838" is also typical.


2. TiProxy Load Balancing:

Search for "TiProxy", and check the "Balance" row
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
Search for "TiProxy", and check the "Balance" row
Search for "TiProxy", click the search result, and then check the "Balance" row


{{< copyable "shell-regular" >}}
Go to "Cluster Info", "Store Topology"
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
Go to "Cluster Info", "Store Topology"
Go to "Cluster Info" -> "Store Topology"


4. If the TiUP cluster is already installed on the machine, update the software version:
```shell
tiup playground scale-out --kv 2
Copy link
Collaborator

Choose a reason for hiding this comment

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

Do we need to update it to tiup playground --tag sample-app-env scale-out --kv 2 because we are viewing the Dashboard for sample-app-env?


7. Execute the cluster deployment command:
```shell
tiup playground display
Copy link
Collaborator

Choose a reason for hiding this comment

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

same here, do we need to add --tag sample-app-env

- `<version>`: Set the TiDB cluster version, such as `v8.4.0`. You can see all the supported TiDB versions by running the `tiup list tidb` command
- `-p`: Specify the password used to connect to the target machine.
```shell
tiup playground scale-in --pid 51464
Copy link
Collaborator

Choose a reason for hiding this comment

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

same here, do we need to add --tag sample-app-env

Input SSH password:
```
```shell
tiup playground scale-out --db 1
Copy link
Collaborator

Choose a reason for hiding this comment

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

same here, do we need to add --tag sample-app-env


```shell
tiup cluster start <cluster-name>
tiup playground scale-out --tiflash 1
Copy link
Collaborator

Choose a reason for hiding this comment

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

same here, do we need to add --tag sample-app-env


- Access TiDB. The password is empty:
Once the replica is ready (progress=1.0), you can run analytical queries that will automatically use TiFlash when beneficial. Check the in the TiDB Dashboard, SQL Statements, "#Plans" columns. If there is a new plan, you can inspect the execution details to see if there is a task performed by `mpp[tiflash]`.
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
Once the replica is ready (progress=1.0), you can run analytical queries that will automatically use TiFlash when beneficial. Check the in the TiDB Dashboard, SQL Statements, "#Plans" columns. If there is a new plan, you can inspect the execution details to see if there is a task performed by `mpp[tiflash]`.
Once the replica is ready (progress=1), you can run analytical queries that will automatically use TiFlash when beneficial. On the TiDB Dashboard, click **SQL Statements**, and then check the **#Plans**column. If there is a new plan, you can click the new plan and inspect the execution details to see if there is a task performed by `mpp[tiflash]`.

@@ -6,510 +6,532 @@ aliases: ['/docs/dev/quick-start-with-tidb/','/docs/dev/test-deployment-using-do

Copy link
Collaborator

@qiancai qiancai Nov 29, 2024

Choose a reason for hiding this comment

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

Hi @alastori, thank you for writing this detailed document. It is quite helpful for users to learn how to use the monitoring tools and scale clusters. I’ve tested the steps on my macOS, and while following the instructions, these steps guide me to set up a local cluster four times as follows 😂 , which is time-consuming.

tiup playground
tiup playground --tag dev-env
tiup playground v8.1.0 --tag sample-app-env --db 2 --kv 3 --pd 1 --tiflash 0
tiup playground v8.1.0 --tag sample-app-env --db 2 --kv 3 --pd 1 --tiflash 0 --tiproxy 1

Would it be possible to provide just one or two cluster setup commands and list the rest as a tip? This could help streamline the setup process for users.

By the way, I’m not sure if introducing the usage of --tag is necessary for first-time users, as it makes the command longer. Without introducing --tag in this doc, we can avoid concerns about whether users are scaling or monitoring the correct cluster.

quick-start-with-tidb.md Show resolved Hide resolved
quick-start-with-tidb.md Show resolved Hide resolved
quick-start-with-tidb.md Outdated Show resolved Hide resolved
quick-start-with-tidb.md Outdated Show resolved Hide resolved
quick-start-with-tidb.md Outdated Show resolved Hide resolved
quick-start-with-tidb.md Outdated Show resolved Hide resolved
quick-start-with-tidb.md Outdated Show resolved Hide resolved
quick-start-with-tidb.md Outdated Show resolved Hide resolved
quick-start-with-tidb.md Outdated Show resolved Hide resolved
quick-start-with-tidb.md Outdated Show resolved Hide resolved
Copy link

ti-chi-bot bot commented Dec 2, 2024

@alastori: The following test failed, say /retest to rerun all failed tests or /retest-required to rerun all mandatory failed tests:

Test name Commit Details Required Rerun command
pull-verify 894a19c link true /test pull-verify

Full PR test history. Your PR dashboard.

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/test-infra repository. I understand the commands that are listed here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/develop This PR relates to the area of TiDB App development. do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. missing-translation-status This PR does not have translation status info. size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants