Note:
This topic has been translated from a Chinese forum by GPT and might contain errors.
Original topic: TIKV水平扩容
[-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.
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.
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.
How to check if mutual trust and password-free login are configured
How to check if mutual trust is configured and password-free login is enabled?
How can I check if mutual trust is configured and passwordless login is enabled?
You can directly SSH into any node from the control machine to find out.
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.
- Log in to the deployment target machine as the
root
user, create the tidb
user, and set the login password.
useradd tidb && \
passwd tidb
- 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
- 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
- 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 ~]$
- 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]#
You execute ssh user@ip date
on that machine.
I tried it. I didn’t configure password-free login. I checked, and there is no /home/root/.ssh/gcp_rsa in my directory.
If it’s not configured, let’s just configure it.
Managing your own keys with tuip is quite convenient. Normally, you can directly input the password interactively.
Configure passwordless login by copying the public key information to other hosts that need to establish mutual trust.
Password-free authentication is not set up properly.