问题1: swap大小通不过
Createa swap file command
Type thefollowing command to create a 2GB swap file on Ubuntu:
# dd if=/dev/zero of=/swapfile bs=1G count=2
Sample outputs:
2+0 records in
2+0 records out
2147483648 bytes (2.1 GB) copied, 20.2256 s, 106 MB/s
Verify thatfile has been created on the server:
# ls -lh /swapfile
Sample outputs:
-rw-r--r-- 1 root root 2.0G Oct 29 14:07 /swapfile
Securethe swap file
Type thefollowing chmod command and chown command to secure and set correct filepermission for security reasons:
# chown root:root /swapfile
# chmod 0600 /swapfile
# ls -lh /swapfile
Sample outputs:
-rw------- 1 root root 2.0G Oct 29 14:07 /swapfile
A world-readable swap file is a huge localvulnerability. The above commands make sure only root user can read and writeto the file.
Turn onthe swap file
First, use themkswap command as follows to enable the swap space on Ubuntu:
# mkswap /swapfile
Sample outputs:
Setting up swapspace version 1, size = 2097148 KiB
no label, UUID=10231c61-6e55-4dd3-8324-9e2a892e7137
Finally,activate the swap file, enter:
# swapon /swapfile
Verifynew swap file and settings on Ubuntu
Type thefollowing command
# swapon -s
Sample outputs:
Filename Type Size Used Priority
/dev/sda5 partition 3998716 704 -1
/swapfile file 2097148 0 -2
问题2: semopm
编辑/etc/sysctl.conf文件,添加
fs.aio-max-nr = 1048576
fs.file-max = 6815744kernel.shmall = 2097152
kernel.shmmax = 536870912
kernel.shmmni = 4096
kernel.sem = 250 32000 100 128
//kernel.semmni = 128
net.ipv4.ip_local_port_range = 9000 65500
net.core.rmem_default = 262144
net.core.rmem_max = 4194304
net.core.wmem_default = 262144
最好执行/sbin/sysctl