Mysql

yum update MemoryError 1G memory free

  • June 18, 2014

我正在嘗試做yum update並得到“MemoryError”。伺服器(OpenVZ box)有 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 時,yum update工作正常。yum update如果仍然有超過 1G 的可用 RAM,為什麼 MySQL 會失敗?

完整的錯誤輸出是:

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。

首先我建議你啟用 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 一起使用)。

引用自:https://serverfault.com/questions/592836