0

我正在尝试将 CHD3 安装到 3 节点集群上。我通过 Cloudera Manager 启动安装。所有三个安装都失败。

Cloudera 安装失败后,我在 /var/log/cloudera-scm-agent/cloudera-scm-agent.out 中看到此错误:

  File "/usr/lib64/cmf/agent/src/cmf/agent.py", line 19, in <module>
    import psutil
  File "/usr/lib64/cmf/agent/build/env/lib/python2.6/site-packages/psutil-0.3.0-py2.6-linux-x86_64.egg/psutil/__init__.py", line 84, in <module>
    TOTAL_PHYMEM = _psplatform.phymem_usage()[0]
  File "/usr/lib64/cmf/agent/build/env/lib/python2.6/site-packages/psutil-0.3.0-py2.6-linux-x86_64.egg/psutil/_pslinux.py", line 122, in phymem_usage
    percent = usage_percent(total - (free + buffers + cached), total,
TypeError: unsupported operand type(s) for +: 'int' and 'NoneType'

显然,在启动时运行的 Python 解释器将“free”、“buffers”或“cached”视为具有 NoneType 并且此错误会导致整个安装回滚。

谁能建议为什么会发生这种情况和/或解决问题的方法?

提前致谢。

4

1 回答 1

1

问题出在 _pslinux.py 的 phymem_usage() 中:

def phymem_usage():
    # total, used and free values are matched against free cmdline utility
    # the percentage matches top/htop and gnome-system-monitor
    f = open('/proc/meminfo', 'r')
    try:
        total = free = buffers = cached = None
        for line in f:
            if line.startswith('MemTotal:'):
                total = int(line.split()[1]) * 1024
            elif line.startswith('MemFree:'):
                free = int(line.split()[1]) * 1024
            elif line.startswith('Buffers:'):
                buffers = int(line.split()[1]) * 1024
            elif line.startswith('Cached:'):
                cached = int(line.split()[1]) * 1024
                break
        used = total - free
        percent = usage_percent(total - (free + buffers + cached), total,
                                _round=1)
        return ntuple_sysmeminfo(total, used, free, percent)
    finally:
        f.close()

请注意,它正在检查 /proc/meminfo 并将字段转换为整数,而不检查这些字段是否存在。在某些系统上,包括某些虚拟化技术,缓冲区或缓存可能会丢失。(LSB 规范指出这些字段中的大多数都是可选的。)

一个快速的解决方法是将 /proc/meminfo 更改为 /tmp/meminfo,“cat /proc/meminfo >/tmp/meminfo”,并添加如下行:

缓冲区:0 kB

于 2012-08-02T14:25:39.557 回答