使用 TiDB Ansible 部署 TiDB 集群报错

你好: 我今天在安装部署TIDB时采用的是v3.0文档里面的[使用 TiDB Ansible 部署 TiDB 集群]部署方式,但是搭建过程中出现了错误,烦请帮忙解答一下,谢谢!具体信息如下: 1、操作系统版本: CentOS Linux release 7.7.1908 (Core) 2、下载的版本: git clone -b v3.0.2 https://github.com/pingcap/tidb-ansible.git 3、执行如下命令报错:

cd /home/tidb/tidb-ansible && \
[tidb@TIDB-02 ~]$ cd /home/tidb/tidb-ansible && \
> sudo pip install -r ./requirements.txt
Collecting ansible==2.7.11 (from -r ./requirements.txt (line 1))
  Retrying (Retry(total=4, connect=None, read=None, redirect=None)) after connection broken by 'NewConnectionError('<pip._vendor.requests.packages.urllib3.connection.VerifiedHTTPSConnection object at 0x7f3fd8ffcbd0>: Failed to establish a new connection: [Errno 101] Network is unreachable',)': /simple/ansible/
  Retrying (Retry(total=3, connect=None, read=None, redirect=None)) after connection broken by 'NewConnectionError('<pip._vendor.requests.packages.urllib3.connection.VerifiedHTTPSConnection object at 0x7f3fd8ffcd50>: Failed to establish a new connection: [Errno 101] Network is unreachable',)': /simple/ansible/
  Retrying (Retry(total=2, connect=None, read=None, redirect=None)) after connection broken by 'NewConnectionError('<pip._vendor.requests.packages.urllib3.connection.VerifiedHTTPSConnection object at 0x7f3fd8ffced0>: Failed to establish a new connection: [Errno 101] Network is unreachable',)': /simple/ansible/
  Retrying (Retry(total=1, connect=None, read=None, redirect=None)) after connection broken by 'NewConnectionError('<pip._vendor.requests.packages.urllib3.connection.VerifiedHTTPSConnection object at 0x7f3fd8fa9090>: Failed to establish a new connection: [Errno 101] Network is unreachable',)': /simple/ansible/
  Retrying (Retry(total=0, connect=None, read=None, redirect=None)) after connection broken by 'NewConnectionError('<pip._vendor.requests.packages.urllib3.connection.VerifiedHTTPSConnection object at 0x7f3fd8fa9210>: Failed to establish a new connection: [Errno 101] Network is unreachable',)': /simple/ansible/
  Could not find a version that satisfies the requirement ansible==2.7.11 (from -r ./requirements.txt (line 1)) (from versions: )
No matching distribution found for ansible==2.7.11 (from -r ./requirements.txt (line 1))
sudo pip install -r ./requirements.txt
![image|690x118](upload://hPSRaoempU1TMu7FmSyY0QU0e11.png)

你好,

尝试执行 sudo pip install --upgrade pip ,看是否解决问题

建议使用 tiup 部署 3.0及以上版本哦,如果初次部署可以使用 3.0 最新版本:
https://pingcap.com/docs-cn/stable/releases/3.0.12/
https://pingcap.com/docs-cn/stable/how-to/deploy/orchestrated/tiup/

好的 谢谢,我试一下

好的~

您好 ,目前最新的稳定版本是哪几个版本?

你好,

目前使用最多的是 3.0 版本, 3.0.12(最新版)即可,可以看下 release note:

https://pingcap.com/docs-cn/stable/releases/3.0.12/

你好! 执行 `sudo pip install --upgrade pip,换成3.0.12还是报同样的错误 [root@TIDB-02 ~]# sudo pip install --upgrade pip Retrying (Retry(total=4, connect=None, read=None, redirect=None)) after connection broken by ‘NewConnectionError(’<pip._vendor.requests.packages.urllib3.connection.VerifiedHTTPSConnection object at 0x7f04a1142410>: Failed to establish a new connection: [Errno 101] Network is unreachable’,)’: /simple/pip/ Retrying (Retry(total=3, connect=None, read=None, redirect=None)) after connection broken by ‘NewConnectionError(’<pip._vendor.requests.packages.urllib3.connection.VerifiedHTTPSConnection object at 0x7f04a1142a50>: Failed to establish a new connection: [Errno 101] Network is unreachable’,)’: /simple/pip/ Retrying (Retry(total=2, connect=None, read=None, redirect=None)) after connection broken by ‘NewConnectionError(’<pip._vendor.requests.packages.urllib3.connection.VerifiedHTTPSConnection object at 0x7f04a1142bd0>: Failed to establish a new connection: [Errno 101] Network is unreachable’,)’: /simple/pip/ Retrying (Retry(total=1, connect=None, read=None, redirect=None)) after connection broken by ‘NewConnectionError(’<pip._vendor.requests.packages.urllib3.connection.VerifiedHTTPSConnection object at 0x7f04a1142d50>: Failed to establish a new connection: [Errno 101] Network is unreachable’,)’: /simple/pip/ Retrying (Retry(total=0, connect=None, read=None, redirect=None)) after connection broken by ‘NewConnectionError(’<pip._vendor.requests.packages.urllib3.connection.VerifiedHTTPSConnection object at 0x7f04a1142ed0>: Failed to establish a new connection: [Errno 101] Network is unreachable’,)’: /simple/pip/ Requirement already up-to-date: pip in /usr/lib/python2.7/site-packages

你好,

ping www.baidu.com

检查下服务器是否可连接外网,感谢!

您好: 我这边生产服务器是代理上网的

您好:

我在 在中控机上配置部署机器 SSH 互信及 sudo 规则,用tidb用户在中控机上执行如下命令时, ansible-playbook -i hosts.ini create_users.yml -u root -k 报如下错误: [root@TIDB-01 ~]# su - tidb Last login: Tue Apr 14 14:58:26 CST 2020 on pts/0 [tidb@TIDB-01 ~]$ /bin/ansible -i /home/tidb/tidb-ansible/inventory.ini all -m shell -a ‘whoami’ Traceback (most recent call last): File “/bin/ansible”, line 40, in from ansible.errors import AnsibleError, AnsibleOptionsError, AnsibleParserError ImportError: cannot import name AnsibleError [tidb@TIDB-01 ~]$ ansible-playbook -i hosts.ini create_users.yml -u root -k Traceback (most recent call last): File “/bin/ansible-playbook”, line 40, in from ansible.errors import AnsibleError, AnsibleOptionsError, AnsibleParserError ImportError: cannot import name AnsibleError

你好,

上面执行 sudo pip install --upgrade pip 就已经报错网络不通的状态,请检查下先,亦可以提供下 ansible 的版本,如果网络情况良好,按照官网步骤操作是可以成功部署的。

如果有需要可以尝试使用 ansible 离线部署方案
https://pingcap.com/docs-cn/v3.0/how-to/deploy/orchestrated/offline-ansible/

好的 ,我试一下,谢谢!

:fist_right:,如有新的问题可开新帖继续讨论哦