This guide describes how to deploy a TiDB cluster offline using Ansible.
Before you start, make sure that you have:
A download machine
Several target machines and one Control Machine
Take the following steps to install system dependencies on the Control Machine installed with the CentOS 7 system.
Download the pip offline installation package to the Control Machine.
# tar -xzvf ansible-system-rpms.el7.tar.gz
# cd ansible-system-rpms.el7
# chmod u+x install_ansible_system_rpms.sh
# ./install_ansible_system_rpms.shNote: This offline installation package includes
pipandsshpass, and only supports the CentOS 7 system.
After the installation is finished, you can use pip -V to check whether it is successfully installed.
# pip -V
pip 8.1.2 from /usr/lib/python2.7/site-packages (python 2.7)Note: If
pipis already installed to your system, make sure that the version is 8.1.2 or later. Otherwise, compatibility error occurs when you install Ansible and its dependencies offline.
tidb user on the Control Machine and generate the SSH keySee Create the tidb user on the Control Machine and generate the SSH key.
Currently, the TiDB 2.0 GA version and the master version are compatible with Ansible 2.5. Ansible and the related dependencies are in the tidb-ansible/requirements.txt file.
Download Ansible 2.5 offline installation package.
Install Ansible and its dependencies offline.
# tar -xzvf ansible-2.5.0-pip.tar.gz
# cd ansible-2.5.0-pip/
# chmod u+x install_ansible.sh
# ./install_ansible.shView the version of Ansible.
After Ansible is installed, you can view the version using ansible --version.
# ansible --version
ansible 2.5.0Install Ansible on the download machine.
Use the following method to install Ansible online on the download machine installed with the CentOS 7 system. After Ansible is installed, you can view the version using ansible --version.
# yum install epel-release
# yum install ansible curl
# ansible --version
ansible 2.5.0Note: Make sure that the version of Ansible is 2.5, otherwise a compatibility issue occurs.
Download TiDB-Ansible.
Use the following command to download the corresponding version of TiDB-Ansible from the GitHub TiDB-Ansible project. The default folder name is tidb-ansible. The following are examples of downloading various versions, and you can turn to the official team for advice on which version to choose.
Download the 2.0 version:
git clone -b release-2.0 https://github.com/pingcap/tidb-ansible.gitor
Download the master version:
git clone https://github.com/pingcap/tidb-ansible.gitRun the local_prepare.yml playbook, and download TiDB binary online to the download machine.
cd tidb-ansible
ansible-playbook local_prepare.ymlAfter running the above command, copy the tidb-ansible folder to the /home/tidb directory of the Control Machine. The ownership authority of the file must be the tidb user.
See Configure the SSH mutual trust and sudo rules on the Control Machine.
See Install the NTP service on the target machines.
Note: If the time and time zone of all your target machines are same, the NTP service is on and is normally synchronizing time, you can ignore this step. See How to check whether the NTP service is normal.
See Configure the CPUfreq governor mode on the target machine.
See Mount the data disk ext4 filesystem with options on the target machines.
inventory.ini file to orchestrate the TiDB clusterSee Edit the inventory.ini file to orchestrate the TiDB cluster.
You do not need to run the playbook in ansible-playbook local_prepare.yml.
You can use the Report button on the Grafana Dashboard to generate the PDF file. This function depends on the fontconfig package and English fonts. To use this function, download the offline installation package, upload it to the grafana_servers machine, and install it. This package includes fontconfig and open-sans-fonts, and only supports the CentOS 7 system.
$ tar -xzvf grafana-font-rpms.el7.tar.gz
$ cd grafana-font-rpms.el7
$ chmod u+x install_grafana_font_rpms.sh
$ ./install_grafana_font_rpms.shWhat’s on this page