The remote Ansible user (the
incentory.inifile) can use the root user account to deploy TiDB, but it is not recommended.
The following example uses the
tidb user account as the user running the service.
To deploy TiDB using a root user account, take the following steps:
inventory.ini as follows.
Remove the code comments for
ansible_user = root,
ansible_become = true and
ansible_become_user. Add comments for
ansible_user = tidb.
## Connection # ssh via root: ansible_user = root ansible_become = true ansible_become_user = tidb # ssh via normal user # ansible_user = tidb
Connect to the network and download TiDB binary to the Control Machine.
Initialize the system environment and edit the kernel parameters.
If the service user does not exist, the initialization operation will automatically create the user.
If the remote connection using the root user requires a password, use the
-k (lower case) parameter. This applies to other playbooks as well:
ansible-playbook bootstrap.yml -k
Deploy the TiDB cluster.
ansible-playbook deploy.yml -k
Start the TiDB cluster.
ansible-playbook start.yml -k