初始化ansible-playbook bootstrap.yml报错

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

  • 【TiDB 版本】:3.0.9
  • 【os 版本】:centos7.6
  • 【问题描述】: 测试环境使用 TiDB Ansible 部署 TiDB 集群,在 ansible-playbook bootstrap.yml初始化环节,有如下报错: [192.168.8.157]: Ansible FAILED! => playbook: bootstrap.yml; TASK: machine_benchmark : get fio randread iops; message: {“changed”: true, “cmd”: “python parse_fio_output.py --target=‘fio_randread_result.json’ - -read-iops”, “delta”: “0:00:00.424637”, “end”: “2020-01-26 18:27:28.061353”, “msg”: “non-zero return code”, “rc”: 1, “start”: “2020-01-26 18:27:27.636716”, “stderr”: “Traceback (most recent call last):\n File “parse_fio_output.py”, line 35, in \n result = json.load(fp)\n File “/usr/lib64/python2.7/json/init.py”, line 290, in load\n **kw)\n File “/usr/lib64/python2.7/json/init.py”, line 338, in loads\n return _default_decoder.decode(s)\n File “/usr/lib64/python2.7/json/decoder.py”, line 366, in decode\n obj, end = self.raw_decode(s, idx=_w(s, 0).end())\n File “/usr/lib64/python2.7/json/decoder.py”, line 384, in raw_decode\n raise ValueError(“No JSON object could be decoded”)\nValueError: No JSON object could be decoded”, “stderr_lines”: [“Traceback (most recent call last):”, " File “parse_fio_output.py”, line 35, in “, " result = json.load(fp)”, " File “/usr/lib64/python2.7/json/init.py”, line 290, in load", " **kw)", " File “/usr/lib64/python2.7/json/init.py”, line 338, in loads", " return _default_decoder.decode(s)", " File “/usr/lib64/python2.7/json/decoder.py”, line 366, in decode", " obj, end = self.raw_decode(s, idx=_w(s, 0).end())", " File “/usr/lib64/python2.7/json/decoder.py”, line 384, in raw_decode", " raise ValueError(“No JSON object could be decoded”)", “ValueError: No JSON object could be decoded”], “stdout”: “”, “stdout_lines”: []} [192.168.8.151]: Ansible FAILED! => playbook: bootstrap.yml; TASK: machine_benchmark : get fio randread iops; message: {“changed”: true, “cmd”: “python parse_fio_output.py --target=‘fio_randread_result.json’ - -read-iops”, “delta”: “0:00:00.408496”, “end”: “2020-01-26 18:27:28.065872”, “msg”: “non-zero return code”, “rc”: 1, “start”: “2020-01-26 18:27:27.657376”, “stderr”: “Traceback (most recent call last):\n File “parse_fio_output.py”, line 35, in \n result = json.load(fp)\n File “/usr/lib64/python2.7/json/init.py”, line 290, in load\n **kw)\n File “/usr/lib64/python2.7/json/init.py”, line 338, in loads\n return _default_decoder.decode(s)\n File “/usr/lib64/python2.7/json/decoder.py”, line 366, in decode\n obj, end = self.raw_decode(s, idx=_w(s, 0).end())\n File “/usr/lib64/python2.7/json/decoder.py”, line 384, in raw_decode\n raise ValueError(“No JSON object could be decoded”)\nValueError: No JSON object could be decoded”, “stderr_lines”: [“Traceback (most recent call last):”, " File “parse_fio_output.py”, line 35, in “, " result = json.load(fp)”, " File “/usr/lib64/python2.7/json/init.py”, line 290, in load", " **kw)", " File “/usr/lib64/python2.7/json/init.py”, line 338, in loads", " return _default_decoder.decode(s)", " File “/usr/lib64/python2.7/json/decoder.py”, line 366, in decode", " obj, end = self.raw_decode(s, idx=_w(s, 0).end())", " File “/usr/lib64/python2.7/json/decoder.py”, line 384, in raw_decode", " raise ValueError(“No JSON object could be decoded”)", “ValueError: No JSON object could be decoded”], “stdout”: “”, “stdout_lines”: []} 请问针对以上错误产生的原因和解决办法? 谢谢

您好,请问在安装过程中,有修改什么配置文件吗?

您好。 因为是测试环境,硬件配置无法满足默认的配置安装要求,所以我自行将./roles/check_system_option/default/main.yml中的配置要求修改了

看起来你修改的文件格式不正确,请参考其它项,注意对齐和空格,再重新试试,多谢

请问,tidb有没有最低安全配置要求?我核对了相关修改内容,并没有发现格式错误。附件为初始化日志和配置文件,感谢error.txt (32.7 KB) inventory.ini (1.8 KB) main.yml (268 字节)

官网有硬件配置相关要求及安装部署参数模板,可以看一下:https://pingcap.com/docs-cn/stable/how-to/deploy/hardware-recommendations/

请问房老板,我上面初始化环节报的错误产生原因是什么? 是环境没达到最低配置要求还是其他的什么?感谢

看报错应该是解析 fio_randread_result.json 文件的时候报错了,麻烦确认下:

  1. fio_randread_result.json 的内容是否是标准的 json 文件该文件应该是 fio 生成的。具体可以看下 fio_randread.yml 的逻辑。
  2. 到问题机器执行 python parse_fio_output.py --target='fio_randread_result.json' --read-iops", "delta": "0:00:00.434681", "end": "2020-01-28 17:31:02.318802 看下能否执行成功。

“到问题机器执行 python parse_fio_output.py --target='fio_randread_result.json' --read-iops", "delta": "0:00:00.434681", "end": "2020-01-28 17:31:02.318802 看下能否执行成功。”

可以执行成功,

抱歉,之前命令复制多了,麻烦看下 python parse_fio_output.py --target='fio_randread_result.json' --read-iops 能否执行成功,另外 方便的话上传下 fio_randread_result.json 文件用于分析。

感谢帮助,这个命令执行报错了,我看了下fio_randread_result.json是个空文件。看来是fio没有正确生成,这种情况我该如何处理呢?

可以看下 {tidb-ansible_deploy_path}/roles/machine_benchmark/tasks/fio_randread.yml 这个文件里面的逻辑。 fio_randread_result.json 是通过 fio -ioengine=psync -bs=32k -fdatasync=1 -thread -rw=randread -size=10G -filename=fio_randread_test.txt -name='fio randread test' -iodepth=4 -runtime=60 -numjobs=4 -group_reporting --output-format=json --output=fio_randread_result.json

谢谢,我重新生成下

问题定位到了,由于我测试服务器硬盘为普通sata盘,我把/roles/machine_benchmark/tasks/中的fio_randread.yml和fio_randread_write_latency.yml硬盘检查项注释掉就好了。感谢指导!fio_randread.yml (1.5 KB) fio_randread_write_latency.yml (2.8 KB)

:+1: 普通盘测试性能可能存在差距,建议按照官网硬件配置相关要求部署。辛苦。