Cannot allocate memory

Tác giả Network Engineer, T.Sáu 03, 2020, 04:01:28 CHIỀU

« Chủ đề trước - Chủ đề tiếp »

0 Thành viên và 1 Khách đang xem chủ đề.

Cannot allocate memory


Trong quản lý OpenVZ đôi khi khi truy cập máy chủ ảo từ Node, bạn sẽ gặp thông báo lỗi: Unable to fork: Cannot allocate memory. ID của VPS là 273.

Mã nguồn [Chọn]
# vzctl enter 273
Unable to fork: Cannot allocate memory


  Hãy xem liệu đó có phải đây là vấn đề với bộ nhớ của Node không?

Mã nguồn [Chọn]
# free -m

     total used free shared buffers cached

Mem: 7956 6865 1091 0 145 3106

-/+ buffers/cache: 3614 4342

Swap: 4102 877 3224

  Không phải vậy, vì vậy hãy đi đến tập tin của hệ thống là /proc/user_beancounters và ID của VPS là 273, hãy kiểm tra nó:

Mã nguồn [Chọn]
# cat /proc/user_beancounters | grep 273


Version: 2.5

uid resource held maxheld barrier limit failcnt

273: kmemsize 4605362 4722434 2147483646 2147483646 0

lockedpages 0 0 999999 999999 0

privvmpages 786416 786419 786432 786432 18

shmpages 128 128 262144 262144 0

dummy 0 0 0 0 0

numproc 47 50 999999 999999 0

physpages 76013 76212 0 2147483647 0

vmguarpages 0 0 262144 2147483647 0

oomguarpages 76013 76212 262144 2147483647 0

numtcpsock 9 16 7999992 7999992 0

numflock 5 6 999999 999999 0

numpty 0 0 500000 500000 0

numsiginfo 0 2 999999 999999 0

tcpsndbuf 157536 159864 214748160 396774400 0

tcprcvbuf 180504 477096 214748160 396774400 0

othersockbuf 6984 13736 214748160 396774400 0

dgramrcvbuf 0 8472 214748160 396774400 0

numothersock 11 13 7999992 7999992 0

dcachesize 351186 418905 2147483646 2147483646 0

numfile 930 1037 23999976 23999976 0

dummy 0 0 0 0 0

dummy 0 0 0 0 0

dummy 0 0 0 0 0

numiptent 15 15 999999 999999 0

  Hãy nhìn vào dòng này:

Mã nguồn [Chọn]
privvmpages 786416 786419 786432 786432 18
  Nó có nghĩa là bộ nhớ được phân bổ cho VPS này đã hết. Để chỉnh sửa tham số này, tập tin cấu hình của VPS nằm trong đường dẫn sau trên Node  /etc/sysconfig/vz-scripts

Mã nguồn [Chọn]
vi /etc/sysconfig/vz-scripts/

# Copyright (C) 2000-2006 SWsoft. All rights reserved.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#
ONBOOT="no"
# UBC parameters (in form of barrier:limit)
# Primary parameters
AVNUMPROC="40:40″
NUMPROC="999999:999999″
NUMTCPSOCK="7999992:7999992″
NUMOTHERSOCK="7999992:7999992″
VMGUARPAGES="262144:2147483647″
# Secondary parameters
KMEMSIZE="2147483646:2147483646″
TCPSNDBUF="214748160:396774400″
TCPRCVBUF="214748160:396774400″
OTHERSOCKBUF="214748160:396774400″
DGRAMRCVBUF="214748160:396774400″
OOMGUARPAGES="262144:2147483647″
# Auxiliary parameters
LOCKEDPAGES="999999:999999″
SHMPAGES="262144:262144″
PRIVVMPAGES="786432:786432″
NUMFILE="23999976:23999976″
NUMFLOCK="999999:999999″
NUMPTY="500000:500000″
NUMSIGINFO="999999:999999″
DCACHESIZE="2147483646:2147483646″
PHYSPAGES="0:2147483647″
NUMIPTENT="999999:999999″
# Disk quota parameters (in form of softlimit:hardlimit)

  Tăng thông số sau lên và khởi động lại VPS

Mã nguồn [Chọn]
PRIVVMPAGES="1086432:1086432"
Mã nguồn [Chọn]
#vzctl restart 273

Restarting container
Stopping container ...
Container was stopped
Container is unmounted
Starting container ...
Container is mounted
Adding IP address(es): xx.xx.xx.xx
Setting CPU limit: 400
Setting CPU units: 1000
Setting CPUs: 4
Configure meminfo: 786432
Set hostname: server1.com
File resolv.conf was modified
Setting quota ugidlimit: 10000
Container start in progress...