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.
pip offline installation package on the download machine and then upload it to the Control Machine.
This offline installation package includes
sshpass, and only supports the CentOS 7 system.
Install system dependencies on 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.sh
After the installation is finished, you can use
pip -V to check whether it is successfully installed.
pip 8.1.2 from /usr/lib/python2.7/site-packages (python 2.7)
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.
tidbuser on the Control Machine and generate the SSH key
Currently, all the versions of Ansible from 2.4 to 2.7.11 are supported. The versions of Ansible and the related dependencies are listed in the
tidb-ansible/requirements.txt file. The following installation steps take Ansible 2.5 as an example.
Download Ansible 2.5 offline installation package on the download machine and then upload it to the Control Machine.
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.sh
View the version of Ansible.
After Ansible is installed, you can view the version using
The relationship between the
tidb-ansible version and the TiDB version is as follows:
|TiDB version||tidb-ansible tag||Note|
|2.0 version||v2.0.10, v2.0.11||The stable version 2.0 is not recommended for new users to use in the production environment.|
|2.1 version||v2.1.x||The stable version 2.1 can be used in the production environment.|
Install 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
yum install epel-release && yum install ansible curl && ansible --version
Make sure that the version of Ansible is 2.5, otherwise a compatibility issue occurs.
Download TiDB Ansible.
git clone -b $tag https://github.com/pingcap/tidb-ansible.git
$tagwith the value of the selected tag version, such as
- It is required to use the corresponding tidb-ansible version when you deploy and upgrade the TiDB cluster. If you deploy TiDB using a mismatched version of tidb-ansible (such as using tidb-ansible v2.1.4 to deploy TiDB v2.1.6), an error might occur.
local_prepare.yml playbook, and download TiDB binary online to the download machine.
cd tidb-ansible && ansible-playbook local_prepare.yml
After 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
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 skip this step. See How to check whether the NTP service is normal.
inventory.inifile to orchestrate the TiDB cluster
You do not need to run the playbook in
You can use the
Report button on the Grafana Dashboard to generate a 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
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.sh