yum update MemoryError 1G内存可用

yum update MemoryError 1G内存可用

我正在尝试执行此操作yum update并收到“MemoryError”。服务器(OpenVZ 框)有 2G RAM 和 Percona MySQL 服务器,运行配置了 1G InnoDB 缓冲区。操作系统是 CentOS 6.5,内核 2.6.32-openvz-042stab088.4-amd64。

free -m输出:

             total       used       free     shared    buffers     cached
Mem:          2048        728       1319          0          0         21
-/+ buffers/cache:        706       1341
Swap:         2048          0       2048

在主机上,盒子内存配置为:

vzctl set 101 --physpages 0:2G --swappages 0:2G --kmemsize unlimited --privvmpages 2000M:2G --vmguarpages 2000M:2G --oomguarpages 2G --save

当我停止 MySQL 时,它运行正常。为什么如果仍有超过 1G 的可用 RAM,yum updateMySQL 会失败?yum update

完整的错误输出是:

yum update
Loaded plugins: fastestmirror, priorities
Loading mirror speeds from cached hostfile
 * base: mirror.mel.bkb.net.au
 * contrib: mirror.mel.bkb.net.au
 * epel: mirror.overthewire.com.au
 * extras: mirror.mel.bkb.net.au
 * updates: mirror.optus.net
Traceback (most recent call last):
  File "/usr/bin/yum", line 29, in <module>
    yummain.user_main(sys.argv[1:], exit_code=True)
  File "/usr/share/yum-cli/yummain.py", line 285, in user_main
    errcode = main(args)
  File "/usr/share/yum-cli/yummain.py", line 136, in main
    result, resultmsgs = base.doCommands()
  File "/usr/share/yum-cli/cli.py", line 434, in doCommands
    self._getTs(needTsRemove)
  File "/usr/lib/python2.6/site-packages/yum/depsolve.py", line 99, in _getTs
    self._getTsInfo(remove_only)
  File "/usr/lib/python2.6/site-packages/yum/depsolve.py", line 110, in _getTsInfo
    pkgSack = self.pkgSack
  File "/usr/lib/python2.6/site-packages/yum/__init__.py", line 887, in <lambda>
    pkgSack = property(fget=lambda self: self._getSacks(),
  File "/usr/lib/python2.6/site-packages/yum/__init__.py", line 683, in _getSacks
    self.plugins.run('exclude')
  File "/usr/lib/python2.6/site-packages/yum/plugins.py", line 184, in run
    func(conduitcls(self, self.base, conf, **kwargs))
  File "/usr/lib/yum-plugins/priorities.py", line 129, in exclude_hook
    repopkgs_archless = _pkglist_to_dict(conduit.getPackages(repo), repo.priority)
  File "/usr/lib/python2.6/site-packages/yum/plugins.py", line 592, in getPackages
    return self._base.pkgSack.returnPackages(arg)
  File "/usr/lib/python2.6/site-packages/yum/packageSack.py", line 499, in returnPackages
    ignore_case=ignore_case)
  File "/usr/lib/python2.6/site-packages/yum/sqlitesack.py", line 1646, in returnPackages
    pkgobjlist = self._buildPkgObjList(repoid, patterns, ignore_case)
  File "/usr/lib/python2.6/site-packages/yum/sqlitesack.py", line 1610, in _buildPkgObjList
    po = self._packageByKeyData(repo, x['pkgKey'], x)
  File "/usr/lib/python2.6/site-packages/yum/sqlitesack.py", line 754, in _packageByKeyData
    po = self.pc(repo, data)
  File "/usr/lib/python2.6/site-packages/yum/sqlitesack.py", line 187, in __init__
    self._loadedfiles = False
MemoryError

类似问题这里但由于我有更多的 RAM,所以这没什么帮助。

答案1

首先我建议你启用 vSwap 内存模型,因为它比旧的 UBC 风格系统更简单、更可靠。使用它你可以vzctl set 101 --physpages 0:2G --swappages 0:2G --kmemsize unlimited --privvmpages 2000M:2G --vmguarpages 2000M:2G --oomguarpages 2G --savevzctl set 101 --physpages 2G --swappages 2G --save

此后请向我显示此命令结果: cat /proc/user_beancounters

这个问题看起来像内存问题,但它与无法通过 free 或 top 显示(只能通过 cat /proc/user_beancounters)的二级内存限制有关。

相关内容