1. 报错内容
[29/Jul/2019 15:14:20 +0000] 11107 MainThread agent INFO Using parcels directory from server provided value: /opt/cloudera/parcels
[29/Jul/2019 15:14:20 +0000] 11107 MainThread parcel INFO Agent does create users/groups and apply file permissions
[29/Jul/2019 15:14:20 +0000] 11107 MainThread parcel_cache INFO Using /opt/cloudera/parcel-cache for parcel cache
[29/Jul/2019 15:14:20 +0000] 11107 MainThread agent ERROR Caught unexpected exception in main loop.
Traceback (most recent call last):
File "/usr/lib64/cmf/agent/build/env/lib/python2.7/site-packages/cmf-5.11.0-py2.7.egg/cmf/agent.py", line 710, in __issue_heartbeat
self._init_after_first_heartbeat_response(resp_data)
File "/usr/lib64/cmf/agent/build/env/lib/python2.7/site-packages/cmf-5.11.0-py2.7.egg/cmf/agent.py", line 948, in _init_after_first_heartbeat_response
self.client_configs.load()
File "/usr/lib64/cmf/agent/build/env/lib/python2.7/site-packages/cmf-5.11.0-py2.7.egg/cmf/client_configs.py", line 713, in load
new_deployed.update(self._lookup_alternatives(fname))
File "/usr/lib64/cmf/agent/build/env/lib/python2.7/site-packages/cmf-5.11.0-py2.7.egg/cmf/client_configs.py", line 434, in _lookup_alternatives
return self._parse_alternatives(alt_name, out)
File "/usr/lib64/cmf/agent/build/env/lib/python2.7/site-packages/cmf-5.11.0-py2.7.egg/cmf/client_configs.py", line 446, in _parse_alternatives
path, _, _, priority_str = line.rstrip().split(" ")
ValueError: too many values to unpack
[29/Jul/2019 15:14:25 +0000] 11107 MainThread agent INFO CM server guid: 2ffb8518-eb39-4108-b668-b33586af781a
以上为报错内容,截图如下:
2. 解决办法
2.1 备份文件
- 若不备份,修改失败后就会发现服务启动不了了!注意集群中所有服务器均要备份与修改
# 备份报错中的client_configs.py文件
cp /usr/lib64/cmf/agent/build/env/lib/python2.7/site-packages/cmf-5.11.0-py2.7.egg/cmf/client_configs.py ~/soft/client_configs.py
2.2 修改文件
- 一定要注意Python的
缩进
,一旦缩进不正确文件无法生效,服务无法启动,问题不能得到解决。
# 修改前
ret = {}
for line in output.splitlines():
if line.startswith("/"):
path, _, _, priority_str = line.rstrip().split(" ")
# Ignore the alternative if it's not managed by CM.
if CM_MAGIC_PREFIX not in os.path.basename(path):
continue
try:
priority = int(priority_str)
except ValueError:
THROTTLED_LOG.info("Failed to parse %s: %s", name, line)
key = ClientConfigKey(name, path)
value = ClientConfigValue(priority, self._read_generation(path))
ret[key] = value
return ret
# 修改后
ret = {}
for line in output.splitlines():
if line.startswith("/"):
if len(line.rstrip().split(" "))<=4:
path, _, _, priority_str = line.rstrip().split(" ")
# Ignore the alternative if it's not managed by CM.
if CM_MAGIC_PREFIX not in os.path.basename(path):
continue
try:
priority = int(priority_str)
except ValueError:
THROTTLED_LOG.info("Failed to parse %s: %s", name, line)
key = ClientConfigKey(name, path)
value = ClientConfigValue(priority, self._read_generation(path))
ret[key] = value
else:
pass
return ret
- 修改前
- 修改后
3. 重启agent服务
重启所有节点的agent服务
systemctl restart cloudera-scm-agent