hostnamectl set-hostname tidb1 ---修改主机名
systemctl stop firewalld.service
systemctl disable firewalld.service
以及禁用SELINUX
git clone -b release-2.0 https://github.com/pingcap/tidb-ansible.git
git clone -b release-1.0 https://github.com/pingcap/tidb-ansible.git
[root@tidb1 tidb-ansible]# cat /etc/hosts
127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4
::1 localhost localhost.localdomain localhost6 localhost6.localdomain6
192.168.137.161 tidb1
192.168.137.162 tidb2
192.168.137.163 tidb3
192.168.137.164 tidb4
192.168.137.165 tidb5
192.168.137.166 tidb6
配置 ssh
ssh-keygen -t rsa
ssh-copy-id -i root@192.168.137.161
ssh-copy-id -i root@192.168.137.162
ssh-copy-id -i root@192.168.137.163
ssh-copy-id -i root@192.168.137.164
ssh-copy-id -i root@192.168.137.165
ssh-copy-id -i root@192.168.137.166
ssh localhost
ssh tidb1
ssh tidb2
ssh tidb3
ssh tidb4
ssh tidb5
ssh tidb6
scp -rp /etc/hosts tidb2:/etc/
scp -rp /etc/hosts tidb3:/etc/
scp -rp /etc/hosts tidb4:/etc/
scp -rp /etc/hosts tidb5:/etc/
scp -rp /etc/hosts tidb6:/etc/
[root@tidb1 tidb-ansible]# cd /etc/yum.repos.d/
wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo
wget -O /etc/yum.repos.d/epel.repo http://mirrors.aliyun.com/repo/epel-7.repo
[root@tidb1 ~]# yum install -y ansible
参考文档
https://github.com/pingcap/docs-cn/blob/master/op-guide/ansible-deployment.md#如何使用-ansible-部署-ntp-服务
如何使用 Ansible 部署 NTP 服务
参照在中控机器上下载 TiDB-Ansible下载 TiDB-Ansible,将你的部署目标机器 IP 添加到 [servers] 区块下,ntp_server 变量的值 pool.ntp.org 可替换为其他 NTP server,在启动 NTP 服务前,系统会 ntpdate 该 NTP server,Ansible 安装的 NTP 服务使用安装包默认 server 列表,见配置文件 cat /etc/ntp.conf 中 server 参数。
$ vi hosts.ini
[servers]
192.168.137.164
192.168.137.165
192.168.137.166
192.168.137.161
192.168.137.162
192.168.137.163
[all:vars]
username = tidb
ntp_server = pool.ntp.org
执行以下命令,按提示输入部署目标机器 root 密码。