参考https://community.hortonworks.com/questions/147748/ambari-setup-stuck-at-step-3.html?page=1&pageSize=10&sort=votes
问题如下,在确认hosts节点全部成功后,系统检测错误时进入无限等待
进入ambari-server的日志中查看,得到
"Unable to lookup the cluster by ID; assuming that there is no cluster and therefore no configs for this execution command: Cluster not found, clusterName=clusterID=-1"
通过查找资料,在 /var/lib/ambari-agent/data/output-107.txt下发现报错:
There was an unknown error while checking installed packages and existing repositories: list index out of range
Traceback (most recent call last):
File "/var/lib/ambari-agent/cache/custom_actions/scripts/check_host.py", line 170, in actionexecute
installed_packages, repos = self.execute_existing_repos_and_installed_packages_check(config)
File "/var/lib/ambari-agent/cache/custom_actions/scripts/check_host.py", line 234, in execute_existing_repos_and_installed_packages_check
availablePackages = self.pkg_provider.all_available_packages()
File "/usr/lib/python2.6/site-packages/resource_management/core/providers/package/yumrpm.py", line 210, in all_available_packages
return self._get_available_packages(None)
File "/usr/lib/python2.6/site-packages/resource_management/core/providers/package/yumrpm.py", line 146, in _get_available_packages
return self._lookup_packages(cmd, 'Available Packages')
File "/usr/lib/python2.6/site-packages/resource_management/core/providers/package/yumrpm.py", line 191, in _lookup_packages
if items[i + 2].find('@') == 0:
IndexError: list index out of range 2019-3-28 15:05:45,882 - Transparent huge page check started.
发现该处python代码报错,原因是可用的包数量超出了range范围
解决方法:直接修改该处python代码(所有节点都要)
原代码:
def _lookup_packages(self, command, skip_till):
"""
:type command list[str]
:type skip_till str|None
"""
packages = []
result = self._call_with_timeout(command)
if result and 0 == result['retCode']:
lines = result['out'].split('\n')
lines = [line.strip() for line in lines]
items = []
if skip_till:
skip_index = 3
for index in range(len(lines)):
if skip_till in lines[index]:
skip_index = index + 1
break
else:
skip_index = 0
for line in lines[skip_index:]:
items = items + line.strip(' \t\n\r').split()
for i in range(0, len(items), 3):
if '.' in items[i]:
items[i] = items[i][:items[i].rindex('.')]
if items[i + 2].find('@') == 0:
items[i + 2] = items[i + 2][1:]
packages.append(items[i:i + 3])
return packages
修改后的代码:
def _lookup_packages(self, command, skip_till):
"""
:type command list[str]
:type skip_till str|None
"""
packages = []
result = self._call_with_timeout(command)
if result and 0 == result['retCode']:
lines = result['out'].split('\n')
lines = [line.strip() for line in lines]
items = []
if skip_till:
skip_index = 3
for index in range(len(lines)):
if skip_till in lines[index]:
skip_index = index + 1
break
else:
skip_index = 0
for line in lines[skip_index:]:
items = items + line.strip(' \t\n\r').split()
for i in range(0, len(items), 3):
if '.' in items[i]:
items[i] = items[i][:items[i].rindex('.')]
if i + 2 < len(items) :
if items[i + 2].find('@') == 0:
items[i + 2] = items[i + 2][1:]
packages.append(items[i:i + 3])
return packages
重启ambari-server
成功