搭建TiDB分布式数据库常见问题

文章目录

    • 问题1
    • 问题2
    • 问题3
    • 问题4

问题1

[tikv_servers]: Ansible UNREACHABLE! => playbook: bootstrap.yml; TASK: pre-ansible : disk space check - fail when disk is full; message: {"changed": false, "msg": "Failed to connect to the host via ssh: ssh: Could not resolve hostname tikv_servers: Name or service not known\r\n", "unreachable": true}

[pd_servers]: Ansible UNREACHABLE! => playbook: bootstrap.yml; TASK: pre-ansible : disk space check - fail when disk is full; message: {"changed": false, "msg": "Failed to connect to the host via ssh: ssh: Could not resolve hostname pd_servers: Name or service not known\r\n", "unreachable": true}

解决办法:
修改主机名(永久生效)

修改配置文件/etc/hostname来实现主机名的修改。把该文件内容hostname name中的name替换成自己想要的主机名重启即可。

$vim /etc/hostname 
hostname  myname

问题2

[spark_master]: Ansible UNREACHABLE! => playbook: bootstrap.yml; TASK: pre-ansible : disk space check - fail when disk is full; message: {"changed": false, "msg": "Failed to connect to the host via ssh: ssh: Could not resolve hostname spark_master: Name or service not known\r\n", "unreachable": true}

[spark_slaves]: Ansible UNREACHABLE! => playbook: bootstrap.yml; TASK: pre-ansible : disk space check - fail when disk is full; message: {"changed": false, "msg": "Failed to connect to the host via ssh: ssh: Could not resolve hostname spark_slaves: Name or service not known\r\n", "unreachable": true}

[192.168.56.155]: Ansible FAILED! => playbook: bootstrap.yml; TASK: check_system_optional : Preflight check - Check TiDB server's CPU; message: {"changed": false, "msg": "This machine does not have sufficient CPU to run TiDB, at least 8 cores."}

[192.168.56.155]: Ansible FAILED! => playbook: bootstrap.yml; TASK: check_system_optional : Preflight check - Check TiDB server's CPU; message: {"changed": false, "msg": "This machine does not have sufficient CPU to run TiDB, at least 8 cores."}

TASK [check_system_optional : Preflight check - Check TiDB server's CPU] ************************************************************************
fatal: [192.168.56.155]: FAILED! => {"changed": false, "msg": "This machine does not have sufficient CPU to run TiDB, at least 8 cores."}


NO MORE HOSTS LEFT ******************************************************************************************************************************
to retry, use: --limit @/root/tidb-ansible/retry_files/bootstrap.retry

PLAY RECAP **************************************************************************************************************************************
192.168.56.150            : ok=0    changed=0    unreachable=1    failed=0   
192.168.56.151            : ok=30   changed=8    unreachable=0    failed=1   
192.168.56.152            : ok=30   changed=8    unreachable=0    failed=0   
192.168.56.153            : ok=33   changed=10   unreachable=0    failed=0   
192.168.56.154            : ok=33   changed=10   unreachable=0    failed=0   
192.168.56.155            : ok=33   changed=10   unreachable=0    failed=0   
localhost                  : ok=1    changed=0    unreachable=0    failed=0   

ERROR MESSAGE SUMMARY ***************************************************************************************************************************
[192.168.56.155]: Ansible UNREACHABLE! => playbook: bootstrap.yml; TASK: pre-ansible : disk space check - fail when disk is full; message: {"changed": false, "msg": "Failed to connect to the host via ssh: Permission denied (publickey,gssapi-keyex,gssapi-with-mic,password).\r\n", "unreachable": true}

[192.168.56.155]: Ansible FAILED! => playbook: bootstrap.yml; TASK: check_system_optional : Preflight check - Check TiDB server's CPU; message: {"changed": false, "msg": "This machine does not have sufficient CPU to run TiDB, at least 8 cores."}

ERROR MESSAGE SUMMARY ***************************************************************************************************************************
[192.168.56.155]: Ansible UNREACHABLE! => playbook: bootstrap.yml; TASK: pre-ansible : disk space check - fail when disk is full; message: {"changed": false, "msg": "Failed to connect to the host via ssh: Permission denied (publickey,gssapi-keyex,gssapi-with-mic,password).\r\n", "unreachable": true}

解决办法:
修改vim bootstrap.yml文件,并注释掉以下的内容

在目录/home/tidb/tidb-ansible下

- name: check system
  hosts: all
  any_errors_fatal: true
  roles:
    - check_system_necessary
#- { role: check_system_optional, when: not dev_mode }

如果是非SSD 测试的话 ,最好将如下的内容注释掉

- name: tikv_servers machine benchmark
  hosts: tikv_servers
  gather_facts: false
  roles:
# - { role: machine_benchmark, when: not dev_mode }

问题3

2018-12-08 17:23:10,210 p=7460 u=tidb |  TASK [pre-ansible : Redhat/CentOS - install python] ***************************************************************
2018-12-08 17:23:10,282 p=7460 u=tidb |  TASK [pre-ansible : Redhat/CentOS - Make sure ntp, ntpstat have been installed] ***********************************
2018-12-08 17:23:11,596 p=7460 u=tidb |  ok: [192.168.56.156] => (item=[u'ntp'])
2018-12-08 17:23:11,616 p=7460 u=tidb |  TASK [pre-ansible : Debian/Ubuntu - Make sure ntp, ntpstat have been installed] ***********************************
2018-12-08 17:23:11,838 p=7460 u=tidb |  TASK [bootstrap : gather facts] ***********************************************************************************

解决办法:
修改vim inventory.ini文件,将enable_ntpd 设置为False

在目录/home/tidb/tidb-ansible下

enable_ntpd = False
set_hostname = False

注意:tidb中的配置文件第一个字母都是大写

在生产环境,必须安装NTP来保证各个数据库服务器时间一致

具体配置请自行百度

问题4

2018-12-08 18:49:19,574 p=30037 u=tidb |  TASK [import grafana dashboards - run import script] **************************************************************
2018-12-08 18:49:20,200 p=30037 u=tidb |  fatal: [192.168.56.155 -> localhost]: FAILED! => {"changed": true, "cmd": "./grafana-config-copy.py", "delta": "0:00:00.383906", "end": "2018-12-08 18:49:20.169766", "msg": "non-zero return code", "rc": 126, "start": "2018-12-08 18:49:19.785860", "stderr": "/bin/sh: ./grafana-config-copy.py: 权限不够", "stderr_lines": ["/bin/sh: ./grafana-config-copy.py: 权限不够"], "stdout": "", "stdout_lines": []}
2018-12-08 18:49:20,200 fail [192.168.43.191]: Ansible FAILED! => playbook: start.yml; TASK: import grafana dashboards - run import script; message: {"changed": true, "cmd": "./grafana-config-copy.py", "delta": "0:00:00.383906", "end": "2018-12-08 18:49:20.169766", "msg": "non-zero return code", "rc": 126, "start": "2018-12-08 18:49:19.785860", "stderr": "/bin/sh: ./grafana-config-copy.py: 权限不够", "stderr_lines": ["/bin/sh: ./grafana-config-copy.py: 权>限不够"], "stdout": "", "stdout_lines": []}
2018-12-08 18:49:20,202 p=30037 u=tidb |        to retry, use: --limit @/home/tidb/tidb-ansible/retry_files/start.retry

本人多次添加授权等方法都不行。
最后还是修改了 start.yml 文件。
原始的文件是这样
搭建TiDB分布式数据库常见问题_第1张图片

修改后的文件
搭建TiDB分布式数据库常见问题_第2张图片

你可能感兴趣的:(DataBase,TiDB)