tidb-server和pd-server的那台主机挂了,主机重启后,运行ansible-playbook start.yml启动报如下错误,启动失败,请问要怎么处理呢?

为提高效率,提问时请提供以下信息,问题描述清晰可优先响应。

  • 【TiDB 版本】:tidb 3.0
  • 【问题描述】: 我这边使用 TiDB Ansible 部署 TiDB 集群的方式部署了4台机的tidb集群,其中tidb-server和pd-server在同一台机器上,其他3台是tikv-server;
    现在tidb-server和pd-server的那台主机挂了,主机重启后,运行ansible-playbook start.yml启动报如下错误,启动失败,请问要怎么处理呢?谢谢!
    [tidb@tidb scripts]$ ansible-playbook /home/tidb/tidb-ansible/start.yml

[WARNING]: Unable to parse /etc/ansible/hosts as an inventory source

[WARNING]: No inventory was parsed, only implicit localhost is available

[WARNING]: provided hosts list is empty, only localhost is available. Note that the implicit localhost does not match ‘all’

PLAY [check config locally] *******************************************************************************************************

TASK [Gathering Facts] ************************************************************************************************************

ok: [localhost]

TASK [check_config_static : Ensure only one monitoring host exists] ***************************************************************

fatal: [localhost]: FAILED! => {“msg”: "The conditional check ‘groups[‘monitoring_servers’] | length != 1’ failed. The error was: error while evaluating conditional (groups[‘monitoring_servers’] | length != 1): ‘dict object’ has no attribute ‘monitoring_servers’

The error appears to have been in ‘/home/tidb/tidb-ansible/roles/check_config_static/tasks/main.yml’: line 4, column 3, but may
be elsewhere in the file depending on the exact syntax problem.

The offending line appears to be:

\

  • name: Ensure only one monitoring host exists
    ^ here
    "}

NO MORE HOSTS LEFT ****************************************************************************************************************

    to retry, use: --limit @/home/tidb/tidb-ansible/start.retry

PLAY RECAP ************************************************************************************************************************

localhost : ok=1 changed=0 unreachable=0 failed=1inventory.ini (1.9 KB)

请提供一下 hosts.ini 文件,从报错的情况来看有 “provided hosts list is empty” 相关的警告

/home/tidb/tidb-ansible,请问是这个目录下面的hosts.ini 文件吗?

是的,就是 /home/tidb/tidb-ansible/hosts.ini

这个文件用的是默认的 [servers] 192.168.0.2 192.168.0.3 192.168.0.4 192.168.0.5 192.168.0.6 192.168.0.7 192.168.0.8 192.168.0.10

[all:vars] username = tidb ntp_server = pool.ntp.org

请检查一下 TiKV 的端口有没有起来,有没有端口冲突之类的问题

检查了其他三台机器的TiKV 的端口起来了,但还是报如下错误:

请看一下 TiKV 上有没有错误日志输出?

/data/tidb/deploy/log/tikv.log的日志如下:

从日志分析来看,是 TiKV 连接 PD 失败且返回 OS 113 Error,所以请检查一下防火墙是否关闭

关了防火墙可以了,谢谢大神!再请问一下,执行启动命令ansible-playbook /home/tidb/tidb-ansible/start.yml是不是一定要在/home/tidb/tidb-ansible目录下执行的?因为我不在这个目录下面执行就还是会报一开始的错误。还有就是我的/home/tidb/tidb-ansible/hosts.ini文件之前部署的时候就是默认的。

是的一定要在 /home/tidb/tidb-ansible 目录下执行,这部分有优化的空间

好的,明白了,谢谢大神!

感谢使用 TiDB,若有问题请继续提问,谢谢!

此话题已在最后回复的 1 分钟后被自动关闭。不再允许新回复。