cetos error "Lack of free swap space" solutions

Premise: Today has found a host alarm: swap memory is used up

1, the view of the server memory [found in the case of the physical memory still remaining, swap began to be used, and even to be exhausted]
[Note1 the root @ ~] # -H Free
Total Free Shared Used BUFF / Cache Available
Mem: 4.9G 169M 141M 10G 10G 15G
Swap: 4.0G 3.4G 651M

2, the value of the file view swappiness
[Note1 the root @ ~] # CAT / proc / SYS / VM / swappiness
30

Description: In centos inside, the size of the value of swappiness of how to use the swap partition is has great links.
swappiness = 0 indicates when the maximum physical memory and swap space is;
when swappiness = 100 indicates a positive swap partitions, and the timely data transfer memory to the swap space on the inside.
Two extremes, the default setting for Centos, this value is equal to 60, 10 proposed changes.

3, modified swappiness value
[Note1 the root @ ~] 10 = # sysctl vm.swappiness
vm.swappiness = 10

# modify the configuration file, to ensure that not restored to the default value after restarting
[root @ note1 ~] # echo vm.swappiness = 10 >> /etc/sysctl.conf

4, restart swap
// turn off virtual memory
[root @ note1 ~] # swapoff -a

// turn on virtual memory
[root @ note1 ~] # swapon -a

5, once again view the memory situation
// close the swap memory conditions
[root @ note1 ~] # as Free -h
Total Used as Free Shared BUFF / Cache the Available
Mem: 165M 393m 15G 7.7 g 7.6 g 7.0 g
Swap: 0B 0B 0B

// restart after the swap
[Note1 the root @ ~] # -H Free
Total Free Shared Used BUFF / Cache Available
Mem: 165M 393m. 15G 7.7 g of 7.6 g of 7.0 g
Swap: 4.0G 4.0G 0B

Reference link: https: //blog.51cto.com/davidbj/1172879

Guess you like

Origin www.cnblogs.com/xiaoyaojinzhazhadehangcheng/p/11611285.html