-
Notifications
You must be signed in to change notification settings - Fork 685
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
base: master
Are you sure you want to change the base?
TiDB Quick Start refresh #19412
Conversation
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: 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 |
=============================================== | ||
``` | ||
```shell | ||
source ~/.bash_profile |
There was a problem hiding this comment.
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:
Lines 55 to 67 in 063e85c
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: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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."
There was a problem hiding this comment.
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: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Select the endpoint to connect, and try your first commands: | |
Press <kbd>Enter</kbd> to connect to the endpoint, and try your first statements: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
source ${your_shell_profile} | ||
``` | ||
```shell | ||
tiup playground display |
There was a problem hiding this comment.
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. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- 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 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
## 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: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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: |
```shell | ||
tiup clean dev-env | ||
``` | ||
|
There was a problem hiding this comment.
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 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- 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: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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 |
There was a problem hiding this comment.
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: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
See all TiUP playground options with: | |
Open a new terminal, and then see all TiUP playground options with: |
There was a problem hiding this comment.
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 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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 |
There was a problem hiding this comment.
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: |
There was a problem hiding this comment.
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.
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": |
There was a problem hiding this comment.
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 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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 |
There was a problem hiding this comment.
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 |
There was a problem hiding this comment.
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 |
There was a problem hiding this comment.
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 |
There was a problem hiding this comment.
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 |
There was a problem hiding this comment.
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]`. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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 | |||
|
There was a problem hiding this comment.
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.
@alastori: The following test failed, say
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. |
What is changed, added or deleted? (Required)
Significantly improved the Quick Start Guide to make it more user-friendly and educational:
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)
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.