TiKV Horizontal Scaling

Note:
This topic has been translated from a Chinese forum by GPT and might contain errors.

Original topic: TIKV水平扩容

| username: TiDBer_bOR8eMEn

[-i /home/root/.ssh/gcp_rsa] in the command tiup cluster check scale-out.yml --cluster --user root [-p] [-i /home/root/.ssh/gcp_rsa] in the article Using TiUP to Scale TiDB Cluster | PingCAP Documentation Center means specifying the SSH private key file for authentication.

| username: TiDBer_jYQINSnf | Original post link

The SSH key is used to log in to the target machine. Generally, the target machine is configured for passwordless authentication with this SSH key.

| username: TiDBer_QYr0vohO | Original post link

  • [-i] and [-p] are optional. If passwordless login to the target machine is already configured, you do not need to fill them in. Otherwise, you can choose either one. [-i] is the private key for the root user (or another user specified by --user) that can log in to the target machine, or you can use [-p] to interactively input the password for that user.
| username: 这里介绍不了我 | Original post link

If you have configured mutual trust and password-free login between each node and the TiUP control machine before deployment, you don’t need to add a string; /home/root/.ssh/gcp_rsa is the location of your private key file.

| username: TiDBer_bOR8eMEn | Original post link

How to check if mutual trust and password-free login are configured

| username: TiDBer_bOR8eMEn | Original post link

How to check if mutual trust is configured and password-free login is enabled?

| username: TiDBer_bOR8eMEn | Original post link

How can I check if mutual trust is configured and passwordless login is enabled?

| username: lemonade010 | Original post link

  • [-i] and [-p] are optional. If passwordless login to the target machine is already configured, you do not need to fill them in. Otherwise, you can choose either one. [-i] is the private key for the root user (or another user specified by --user) that can log in to the target machine, or you can use [-p] to interactively input the password for that user.
| username: 这里介绍不了我 | Original post link

You can directly SSH into any node from the control machine to find out.

| username: lemonade010 | Original post link

For scenarios where manual configuration of mutual trust between the control machine and target nodes is required, you can refer to this section. Typically, it is recommended to use the TiUP deployment tool, which will automatically configure SSH mutual trust and passwordless login, so you can ignore this section.

  1. Log in to the deployment target machine as the root user, create the tidb user, and set the login password.
useradd tidb && \
passwd tidb
  1. Execute the following command to add tidb ALL=(ALL) NOPASSWD: ALL to the end of the file, configuring passwordless sudo.
visudo
tidb ALL=(ALL) NOPASSWD: ALL
  1. Log in to the control machine as the tidb user and execute the following commands. Replace 10.0.1.1 with the IP of your deployment target machine, enter the tidb user password for the target machine as prompted. After successful execution, SSH mutual trust will be established. Repeat for other machines as needed. The newly created tidb user does not have a .ssh directory, so you need to execute the command to generate the RSA key to create the .ssh directory. If you need to deploy TiDB components on the control machine, you need to configure mutual trust between the control machine and itself.
ssh-keygen -t rsa
ssh-copy-id -i ~/.ssh/id_rsa.pub 10.0.1.1
  1. Log in to the control machine as the tidb user and use ssh to log in to the target machine IP. If you can log in successfully without entering a password, the SSH mutual trust configuration is successful.
ssh 10.0.1.1
[tidb@10.0.1.1 ~]$
  1. After logging in to the deployment target machine as the tidb user, execute the following command. If you can switch to the root user without entering a password, the passwordless sudo configuration for the tidb user is successful.
sudo -su root
[root@10.0.1.1 tidb]#
| username: TiDBer_QYr0vohO | Original post link

You execute ssh user@ip date on that machine.

| username: TiDBer_bOR8eMEn | Original post link

I tried it. I didn’t configure password-free login. I checked, and there is no /home/root/.ssh/gcp_rsa in my directory.

| username: 这里介绍不了我 | Original post link

:rofl: If it’s not configured, let’s just configure it.

| username: DBAER | Original post link

Managing your own keys with tuip is quite convenient. Normally, you can directly input the password interactively.

| username: yytest | Original post link

Configure passwordless login by copying the public key information to other hosts that need to establish mutual trust.

| username: zhh_912 | Original post link

Password-free authentication is not set up properly.