Skip to content

Commit

Permalink
op-guide: update ansible and offline deployment (#431)
Browse files Browse the repository at this point in the history
* op-guide: update ansible and offline deployment

Via: pingcap/docs-cn#682

* Address the comment

* op-guide: address the comment
  • Loading branch information
lilin90 authored and CaitinChen committed Apr 23, 2018
1 parent a2c04c5 commit f9b0431
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 40 deletions.
29 changes: 1 addition & 28 deletions op-guide/ansible-deployment.md
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ git clone https://github.com/pingcap/tidb-ansible.git

## Install Ansible and dependencies in the Control Machine

Use `pip` to install Ansible and dependencies on the Control Machine of CentOS 7 system. After installation, you can use `ansible --version` to view the Ansible version. Currently releases-1.0 and release-2.0 depend on Ansible 2.4, while the master version is compatible with Ansible 2.4 and Ansible 2.5.
Use `pip` to install Ansible and dependencies on the Control Machine of CentOS 7 system. After installation, you can use `ansible --version` to view the Ansible version. Currently releases-1.0 depends on Ansible 2.4, while release-2.0 and the master version are compatible with Ansible 2.4 and Ansible 2.5.

Ansible and related dependencies are recorded in the `tidb-ansible/requirements.txt` file. Install Ansible and dependencies as follows, otherwise compatibility issue occurs.

Expand Down Expand Up @@ -241,7 +241,6 @@ TiKV1-1 ansible_host=172.16.10.4 deploy_dir=/data1/deploy
| ---- | ------- |
| cluster_name | the name of a cluster, adjustable |
| tidb_version | the version of TiDB, configured by default in TiDB-Ansible branches |
| deployment_method | the method of deployment, binary by default, Docker optional |
| process_supervision | the supervision way of processes, systemd by default, supervise optional |
| timezone | the timezone of the managed node, adjustable, `Asia/Shanghai` by default, used with the `set_timezone` variable |
| set_timezone | to edit the timezone of the managed node, True by default; False means closing |
Expand Down Expand Up @@ -269,11 +268,6 @@ To deploy TiDB using a normal user account, take the following steps:

```
## Connection
# ssh via root:
# ansible_user = root
# ansible_become = true
# ansible_become_user = tidb
# ssh via normal user
ansible_user = tidb
```
Expand Down Expand Up @@ -537,27 +531,6 @@ $ sudo yum install ntp ntpdate
$ sudo systemctl start ntpd.service
```
### How to deploy TiDB using Docker?
- Install Docker on the Control Machine and the managed node. The normal user (such as `ansible_user = tidb`) account in `inventory.ini` must have the sudo privileges or [running Docker privileges](https://docs.docker.com/engine/installation/linux/linux-postinstall/).
- Install the `docker-py` module on the Control Machine and the managed node.
```
sudo pip install docker-py
```
- Edit the `inventory.ini` file:
```
# deployment methods, [binary, docker]
deployment_method = docker
# process supervision, [systemd, supervise]
process_supervision = systemd
```
The Docker installation process is similar to the binary method.
### How to adjust the supervision method of a process from supervise to systemd?
```
Expand Down
45 changes: 33 additions & 12 deletions op-guide/offline-ansible-deployment.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,41 +19,62 @@ Before you start, make sure that you have:
- For system requirements and configuration, see [Prepare the environment](ansible-deployment.md#prepare).
- It is acceptable without access to the Internet.

## Install Ansible and dependencies in the Control Machine
## Install Ansible and dependencies offline in the Control Machine

1. Install Ansible offline on the CentOS 7 system:
Take the following steps to install Ansible offline on the CentOS 7 system:

> Download the [Ansible 2.4.2](https://download.pingcap.org/ansible-2.4.2-rpms.el7.tar.gz) offline installation package to the Control Machine.
1. Install `pip` offline.

> Download the [`pip`](https://download.pingcap.org/pip-rpms.el7.tar.gz) offline installation package to the Control Machine.
```bash
# tar -xzvf pip-rpms.el7.tar.gz
# cd pip-rpms.el7
# chmod u+x install_pip.sh
# ./install_pip.sh
```

After the installation is finished, you can use `pip -V` to check whether it is successfully installed:

```bash
# tar -xzvf ansible-2.4.2-rpms.el7.tar.gz
# pip -V
pip 8.1.2 from /usr/lib/python2.7/site-packages (python 2.7)
```

# cd ansible-2.4-rpms.el7
2. Install Ansible and its dependencies offline.

# chmod u+x install_ansible.sh
Currently releases-1.0 depends on Ansible 2.4, while release-2.0 and the master version are compatible with Ansible 2.4 and Ansible 2.5. Ansible and related dependencies are recorded in the `tidb-ansible/requirements.txt` file. Download the corresponding offline installation version to the Control Machine.

- Download [Ansible 2.4 offline installation package](https://download.pingcap.org/ansible-2.4.2-pip.tar.gz)
- Download [Ansible 2.5 offline installation package](https://download.pingcap.org/ansible-2.5.0-pip.tar.gz)

The installing methods of Ansible 2.4 and Ansible 2.5 are similar. Take Ansible 2.5 as an example:

```
# tar -xzvf ansible-2.5.0-pip.tar.gz
# cd ansible-2.5.0-pip/
# chmod install_ansible.sh
# ./install_ansible.sh
```

2. After Ansible is installed, you can view the version using `ansible --version`.
After Ansible is installed, you can view the version using `ansible --version`.

```bash
# ansible --version
ansible 2.4.2.0
ansible 2.5.0
```

## Download TiDB-Ansible and TiDB packages on the download machine

1. Install Ansible on the download machine.

Use the following method to install Ansible online on the download machine installed with the CentOS 7 system. Installing using the EPEL source automatically installs the related Ansible dependencies (such as `Jinja2==2.7.2 MarkupSafe==0.11`). After Ansible is installed, you can view the version using `ansible --version`.
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`.

```bash
# yum install epel-release
# yum install ansible curl
# ansible --version
ansible 2.4.2.0
ansible 2.5.0
```
> **Note:** Make sure that the version of Ansible is 2.4 or later, otherwise compatibility problem might occur.

Expand Down

0 comments on commit f9b0431

Please sign in to comment.