Tidb ansible部署报错

你好! 目前我的环境是Centos 7.7 版本是3.0.12,tidb和pd 共用三台,三台tikv ,中控机单独部署,中控机一台,目标机一台,我在hosts.ini 和inventory.ini里面是否需要添加中控机的信息?在中控机上执行ansible-playbook bootstrap.yml时,报如下错误:

fatal: [localhost]: FAILED! => {“changed”: true, “cmd”: “pip show jmespath | grep Version |grep -v Metadata-Version”, “delta”: “0:00:00.565095”, “end”: “2020-04-21 09:04:24.788000”, “msg”: “non-zero return code”, “rc”: 1, “start”: “2020-04-21 09:04:24.222905”, “stderr”: “Exception:\nTraceback (most recent call last):\n File “/usr/lib/python2.7/site-packages/pip/basecommand.py”, line 215, in main\n status = self.run(options, args)\n File “/usr/lib/python2.7/site-packages/pip/commands/show.py”, line 40, in run\n if not print_results(results, options.files):\n File “/usr/lib/python2.7/site-packages/pip/commands/show.py”, line 125, in print_results\n for dist in distributions:\n File “/usr/lib/python2.7/site-packages/pip/commands/show.py”, line 60, in search_packages_info\n ‘requires’: [dep.project_name for dep in dist.requires()],\n File “/usr/lib/python2.7/site-packages/pip/_vendor/pkg_resources/init.py”, line 2489, in requires\n dm = self._dep_map\n File “/usr/lib/python2.7/site-packages/pip/_vendor/pkg_resources/init.py”, line 2713, in _dep_map\n self.__dep_map = self._compute_dependencies()\n File “/usr/lib/python2.7/site-packages/pip/_vendor/pkg_resources/init.py”, line 2722, in _compute_dependencies\n for req in self._parsed_pkg_info.get_all(‘Requires-Dist’) or []:\n File “/usr/lib/python2.7/site-packages/pip/_vendor/pkg_resources/init.py”, line 2704, in _parsed_pkg_info\n metadata = self.get_metadata(self.PKG_INFO)\n File “/usr/lib/python2.7/site-packages/pip/_vendor/pkg_resources/init.py”, line 1469, in get_metadata\n return self._get(self._fn(self.egg_info, name))\n File “/usr/lib/python2.7/site-packages/pip/_vendor/pkg_resources/init.py”, line 1580, in _get\n with open(path, ‘rb’) as stream:\nIOError: [Errno 13] Permission denied: ‘/usr/lib/python2.7/site-packages/jmespath-0.9.5.dist-info/METADATA’\nYou are using pip version 8.1.2, however version 20.0.2 is available.\nYou should consider upgrading via the ‘pip install --upgrade pip’ command.”, “stderr_lines”: [“Exception:”, “Traceback (most recent call last):”, " File “/usr/lib/python2.7/site-packages/pip/basecommand.py”, line 215, in main", " status = self.run(options, args)", " File “/usr/lib/python2.7/site-packages/pip/commands/show.py”, line 40, in run", " if not print_results(results, options.files):", " File “/usr/lib/python2.7/site-packages/pip/commands/show.py”, line 125, in print_results", " for dist in distributions:", " File “/usr/lib/python2.7/site-packages/pip/commands/show.py”, line 60, in search_packages_info", " ‘requires’: [dep.project_name for dep in dist.requires()],", " File “/usr/lib/python2.7/site-packages/pip/_vendor/pkg_resources/init.py”, line 2489, in requires", " dm = self._dep_map", " File “/usr/lib/python2.7/site-packages/pip/_vendor/pkg_resources/init.py”, line 2713, in _dep_map", " self.__dep_map = self._compute_dependencies()", " File “/usr/lib/python2.7/site-packages/pip/_vendor/pkg_resources/init.py”, line 2722, in _compute_dependencies", " for req in self._parsed_pkg_info.get_all(‘Requires-Dist’) or []:", " File “/usr/lib/python2.7/site-packages/pip/_vendor/pkg_resources/init.py”, line 2704, in _parsed_pkg_info", " metadata = self.get_metadata(self.PKG_INFO)", " File “/usr/lib/python2.7/site-packages/pip/_vendor/pkg_resources/init.py”, line 1469, in get_metadata", " return self._get(self._fn(self.egg_info, name))", " File “/usr/lib/python2.7/site-packages/pip/_vendor/pkg_resources/init.py”, line 1580, in _get", " with open(path, ‘rb’) as stream:", “IOError: [Errno 13] Permission denied: ‘/usr/lib/python2.7/site-packages/jmespath-0.9.5.dist-info/METADATA’”, “You are using pip version 8.1.2, however version 20.0.2 is available.”, “You should consider upgrading via the ‘pip install --upgrade pip’ command.”], “stdout”: “”, “stdout_lines”: []} to retry, use: --limit @/home/tidb/tidb-ansible/retry_files/bootstrap.retry

PLAY RECAP ************************************************************************************************************************************************************************************************************ localhost : ok=3 changed=2 unreachable=0 failed=1

ERROR MESSAGE SUMMARY ************************************************************************************************************************************************************************************************* [localhost]: Ansible FAILED! => playbook: bootstrap.yml; TASK: check_config_static : Get jmespath info; message: {“changed”: true, “cmd”: “pip show jmespath | grep Version |grep -v Metadata-Version”, “delta”: “0:00:00.565095”, “end”: “2020-04-21 09:04:24.788000”, “msg”: “non-zero return code”, “rc”: 1, “start”: “2020-04-21 09:04:24.222905”, “stderr”: “Exception:\nTraceback (most recent call last):\n File “/usr/lib/python2.7/site-packages/pip/basecommand.py”, line 215, in main\n status = self.run(options, args)\n File “/usr/lib/python2.7/site-packages/pip/commands/show.py”, line 40, in run\n if not print_results(results, options.files):\n File “/usr/lib/python2.7/site-packages/pip/commands/show.py”, line 125, in print_results\n for dist in distributions:\n File “/usr/lib/python2.7/site-packages/pip/commands/show.py”, line 60, in search_packages_info\n ‘requires’: [dep.project_name for dep in dist.requires()],\n File “/usr/lib/python2.7/site-packages/pip/_vendor/pkg_resources/init.py”, line 2489, in requires\n dm = self._dep_map\n File “/usr/lib/python2.7/site-packages/pip/_vendor/pkg_resources/init.py”, line 2713, in _dep_map\n self.__dep_map = self._compute_dependencies()\n File “/usr/lib/python2.7/site-packages/pip/_vendor/pkg_resources/init.py”, line 2722, in _compute_dependencies\n for req in self._parsed_pkg_info.get_all(‘Requires-Dist’) or []:\n File “/usr/lib/python2.7/site-packages/pip/_vendor/pkg_resources/init.py”, line 2704, in _parsed_pkg_info\n metadata = self.get_metadata(self.PKG_INFO)\n File “/usr/lib/python2.7/site-packages/pip/_vendor/pkg_resources/init.py”, line 1469, in get_metadata\n return self._get(self._fn(self.egg_info, name))\n File “/usr/lib/python2.7/site-packages/pip/_vendor/pkg_resources/init.py”, line 1580, in _get\n with open(path, ‘rb’) as stream:\nIOError: [Errno 13] Permission denied: ‘/usr/lib/python2.7/site-packages/jmespath-0.9.5.dist-info/METADATA’\nYou are using pip version 8.1.2, however version 20.0.2 is available.\nYou should consider upgrading via the ‘pip install --upgrade pip’ command.”, “stderr_lines”: [“Exception:”, “Traceback (most recent call last):”, " File “/usr/lib/python2.7/site-packages/pip/basecommand.py”, line 215, in main", " status = self.run(options, args)", " File “/usr/lib/python2.7/site-packages/pip/commands/show.py”, line 40, in run", " if not print_results(results, options.files):", " File “/usr/lib/python2.7/site-packages/pip/commands/show.py”, line 125, in print_results", " for dist in distributions:", " File “/usr/lib/python2.7/site-packages/pip/commands/show.py”, line 60, in search_packages_info", " ‘requires’: [dep.project_name for dep in dist.requires()],", " File “/usr/lib/python2.7/site-packages/pip/_vendor/pkg_resources/init.py”, line 2489, in requires", " dm = self._dep_map", " File “/usr/lib/python2.7/site-packages/pip/_vendor/pkg_resources/init.py”, line 2713, in _dep_map", " self.__dep_map = self._compute_dependencies()", " File “/usr/lib/python2.7/site-packages/pip/_vendor/pkg_resources/init.py”, line 2722, in _compute_dependencies", " for req in self._parsed_pkg_info.get_all(‘Requires-Dist’) or []:", " File “/usr/lib/python2.7/site-packages/pip/_vendor/pkg_resources/init.py”, line 2704, in _parsed_pkg_info", " metadata = self.get_metadata(self.PKG_INFO)", " File “/usr/lib/python2.7/site-packages/pip/_vendor/pkg_resources/init.py”, line 1469, in get_metadata", " return self._get(self._fn(self.egg_info, name))", " File “/usr/lib/python2.7/site-packages/pip/_vendor/pkg_resources/init.py”, line 1580, in _get", " with open(path, ‘rb’) as stream:", “IOError: [Errno 13] Permission denied: ‘/usr/lib/python2.7/site-packages/jmespath-0.9.5.dist-info/METADATA’”, “You are using pip version 8.1.2, however version 20.0.2 is available.”, “You should consider upgrading via the ‘pip install --upgrade pip’ command.”], “stdout”: “”, “stdout_lines”: []}

你好,

请检查是否执行 cd /home/tidb/tidb-ansible && \ sudo pip install -r ./requirements.txt 来安装相关依赖,如果出现 pip 相关提示,可以尝试在 python2.7 执行下。

3.0 版本目前可以使用 tiup 进行部署,简单方便,并且没有 ansible 相互的依赖关系可以尝试下。

已经执行过这个命令了,

请检查下当前部署用户是否有相关权限,是否在正确的用户下进行操作

我是用tidb 用户执行的如下命令: cd /home/tidb/tidb-ansible sudo pip install -r ./requirements.txt -i https://pypi.doubanio.com/simple --proxy=代理ip

需要添加,host.ini 配置集群中所有服务器;inventory.ini 配置各组件的信息。

你好,中控机不作为目标机,那中控机的IP部署在哪个位置?

你好,

如果中控机不作为组件部署机,也是需要写在 host.ini 中

你好 ,我现在部署成功了,但是ansible-playbook start.yml这个命令只能在中控机上执行,其他的目标机执行不了,这条命令能在其他的目标机执行吗

您好:

    1. start.yml需要启动所有的pd,tidb,tikv,只有中控机是和所有节点互信联通的。
    2. 其他目标机可以控制自己的节点,在安装目录/scripts/目录下有对应实例的start_xxx.sh和stop_xx.sh控制单个实例的启停
    3. 可以在其他节点安装中控机的方式部署,类似于在其他地方在装一遍中控机,只是不用部署实例。 这样就有两套中控机可以控制了

好的 谢谢!

:handshake: