[Ubuntu-zh] VPS无法启用swap文件。swapon failed: Operation not permitted
Robot 马
bob1211在gmail.com
星期二 一月 18 08:25:52 UTC 2011
top列出来的是按照CPU占用率排序的,你这里这些CPU占用率大的占内存都很小,看nginx和mysql内存占用都不错了,应该是别的进程。你ps
-el一下,看看哪个进程SZ列比较大的。
在 2011年1月18日 下午4:17,Lanpice Lio <ghosthk21在gmail.com>写道:
> Tasks: 19 total, 2 running, 17 sleeping, 0 stopped, 0 zombie
> Cpu(s): 0.3%us, 0.0%sy, 0.0%ni, 99.7%id, 0.0%wa, 0.0%hi, 0.0%si,
> 0.0%st
> Mem: 262144k total, 237288k used, 24856k free, 0k buffers
> Swap: 0k total, 0k used, 0k free, 0k cached
>
> PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND
>
> 1 root 18 0 1984 684 588 S 0.0 0.3 0:01.56 init
>
> 1644 root 18 0 33136 1288 964 S 0.0 0.5 0:00.18 rsyslogd
>
> 7968 Debian-e 15 0 6136 932 616 S 0.0 0.4 0:00.00 exim4
>
> 8031 root 18 0 4556 696 292 S 0.0 0.3 0:00.00 nginx
>
> 8034 www-data 16 0 5040 1796 812 S 0.0 0.7 0:01.83 nginx
>
> 8062 root 16 0 8020 2584 2132 S 0.0 1.0 0:00.07 sshd
>
> 9406 root 18 0 5276 1032 676 S 0.0 0.4 0:00.00 sshd
>
> 11328 root 18 0 10084 4408 1248 S 0.0 1.7 0:00.32 python
>
> 11670 root 15 0 33444 3204 1268 S 0.0 1.2 0:17.93 php5-fpm
>
> 11674 www-data 16 0 57940 30m 4508 S 0.0 12.0 2:02.91 php5-fpm
>
> 11675 www-data 16 0 58972 31m 4520 S 0.0 12.4 1:58.02 php5-fpm
>
> 11872 root 15 0 10412 4848 2264 R 0.0 1.8 0:01.13 sshd
>
> 13944 root 15 0 4936 1740 1336 S 0.0 0.7 0:00.03 bash
>
> 15474 root 15 0 2260 1076 880 R 0.0 0.4 0:00.33 top
>
> 20422 root 25 0 2716 1328 1084 S 0.0 0.5 0:00.02 mysqld_safe
>
> 22053 mysql 15 0 124m 17m 6036 S 0.0 7.0 0:14.08 mysqld
>
> 22078 root 18 0 1632 536 460 S 0.0 0.2 0:00.00 logger
>
> 22423 wsn 15 0 8160 1764 1264 S 0.0 0.7 0:00.41 sshd
>
> 24456 root 15 0 4116 980 796 S 0.0 0.4 0:00.09 cron
>
> 刚那封带有图片的,由于信件太大,正在审核。用文字版的重发一遍吧。虽然看着很费劲,不好意思。
>
> 内存消耗最大的还是php5-fpm。12.0% 12.4%
> 配置文件就修改了这几项:
> pm = static
> pm.max_children = 2
> hp_admin_value[memory_limit] = 28M
>
> 在 2011年1月18日 下午3:55,Riku <lu.riku在gmail.com>写道:
>
> > 那么看一下是哪个进程占用了大量内存,可以贴一下 top
> >
> > 2011/1/18 Lanpice Lio <ghosthk21在gmail.com>
> >
> > > 我一开始就把max_children
> > > 设置为2了,mysql,nginx,也全部优化了。但是内存使用还是200+MB。一个Debian,一个Ubuntu,全部都这样。我就郁闷了……
> > >
> > > 在 2011年1月18日 上午8:42,Riku <lu.riku在gmail.com>写道:
> > >
> > > > 少开几个 php 进程,对于一般 wordpress blog 来说,几百或几千
> > > > IP的话,根本不需要那么多进程,开几个就足够了。因为你不可能有那么高的并发量。
> > > >
> > > > 2011/1/17 Lanpice Lio <ghosthk21在gmail.com>
> > > >
> > > > > 谢谢,是OpenVZ的,这几天看了些资料,OpenVZ确实不能添加swap。
> > > > > 系统是用的Debian,Nginx+php5-fpm+mysql
> > > > > 也优化了,但是内存还是200MB以上,很容易out of memory。不知道别人的几十M怎么来的。
> > > > >
> > > > > 在 2011年1月17日 下午5:16,Shellexy <jhuangjiahua在gmail.com>写道:
> > > > >
> > > > > > 2011/1/11 Lanpice Lio <ghosthk21在gmail.com>
> > > > > >
> > > > > > > 前两天入手了一台VPS,内存只有256MB,没有swap,便想自己添加一个swap文件用。
> > > > > > > 但是swapon 的时候出现了swapon failed: Operation not permitted
> > > > > > > 操作不允许,我是root啊。
> > > > > > > 另外通过修改fstab,也无法启用。
> > > > > > > 为了确保操作无误,我又做了一遍,还是不行。到自己系统上却很顺利的添加了。
> > > > > > > 去google之,发现有这种情况的无一例外全部是在VPS上的。
> > > > > > > 各位碰到过这种情况吗?有解吗?
> > > > > > > 谢谢。
> > > > > > >
> > > > > >
> > > > > > 你估计是用的 OpenVZ 虚拟化技术的 VPS,
> > > > > > OpenVZ 使用 Host 分配内存,不需要 SWAP。
> > > > > >
> > > > > > 那么请 google openvz vps,
> > > > > > 你先前 google 的关键词可能错了。
> > > > > >
> > > > > > 你跑一个 WP 就用掉 200M 内存,
> > > > > > 估计是用的 apache 而非现在流行的轻巧的 nginx + spawn-fcgi/php5-fpm。
> > > > > >
> > > > > > 如果没其他情况就先这样用了别换了吧,买了机器不压榨干净不浪费嘛。
> > > > > > 想要练手或有其他计划就考虑换下 nginx + php5-fpm 比较好,
> > > > > > 想折腾还可以考虑让 wp 用 sqlite 替换掉 mysql (不更好,只是省资源)
> > > > > >
> > > > > > 其实 256M 不算小内存了, 不过也是可以看看 小内存 VPS 优化建议 (LNMP+WordPress 环境)
> > > > > > <http://wowubuntu.com/vps-optimize.html>
> > > > > > -------------- next part --------------
> > > > > > An HTML attachment was scrubbed...
> > > > > > URL: <
> > > > > >
> > > > >
> > > >
> > >
> >
> https://lists.ubuntu.com/archives/ubuntu-zh/attachments/20110117/522038ae/attachment.html
> > > > > > >
> > > > > > --
> > > > > > ubuntu-zh mailing list
> > > > > > ubuntu-zh在lists.ubuntu.com
> > > > > > https://lists.ubuntu.com/mailman/listinfo/ubuntu-zh
> > > > > >
> > > > >
> > > > >
> > > > >
> > > > > --
> > > > > *签名神马的都是浮云……*
> > > > > *
> > > > > *
> > > > > *我的BLOG <http://lcan.info>*
> > > > > *Twitter: @lcayu <http://www.twitter.com/lcayu>*
> > > > > **Linux
> > > > >
> > > > >
> > > >
> > >
> >
> fan,Ubuntu,KDE,IT小白,SSH翻墙控,裸考帝,犬夜叉迷,步迷,就读于天朝某号称国际化,信息化大学,关注Linux应用,网络与信息安全,ayu,及一切扯淡!求fo!
> > > > > *Facebook: 欢迎访问 <http://www.facebook.com/ghosthk>*
> > > > > -------------- 下一部分 --------------
> > > > > 一个HTML附件被移除...
> > > > > URL: <
> > > > >
> > > >
> > >
> >
> https://lists.ubuntu.com/archives/ubuntu-zh/attachments/20110117/5f768acb/attachment.html
> > > > > >
> > > > > --
> > > > > ubuntu-zh mailing list
> > > > > ubuntu-zh在lists.ubuntu.com
> > > > > https://lists.ubuntu.com/mailman/listinfo/ubuntu-zh
> > > > >
> > > >
> > > >
> > > >
> > > > --
> > > > $ gpg --keyserver keyserver.ubuntu.com --recv-keys E5211133
> > > > -------------- 下一部分 --------------
> > > > 一个HTML附件被移除...
> > > > URL: <
> > > >
> > >
> >
> https://lists.ubuntu.com/archives/ubuntu-zh/attachments/20110118/71eaea19/attachment.html
> > > > >
> > > > --
> > > > ubuntu-zh mailing list
> > > > ubuntu-zh在lists.ubuntu.com
> > > > https://lists.ubuntu.com/mailman/listinfo/ubuntu-zh
> > > >
> > >
> > >
> > >
> > > --
> > > *签名神马的都是浮云……*
> > > *
> > > *
> > > *我的BLOG <http://lcan.info>*
> > > *Twitter: @lcayu <http://www.twitter.com/lcayu>*
> > > **Linux
> > >
> > >
> >
> fan,Ubuntu,KDE,IT小白,SSH翻墙控,裸考帝,犬夜叉迷,步迷,就读于天朝某号称国际化,信息化大学,关注Linux应用,网络与信息安全,ayu,及一切扯淡!求fo!
> > > *Facebook: 欢迎访问 <http://www.facebook.com/ghosthk>*
> > > -------------- 下一部分 --------------
> > > 一个HTML附件被移除...
> > > URL: <
> > >
> >
> https://lists.ubuntu.com/archives/ubuntu-zh/attachments/20110118/fc04ea17/attachment.html
> > > >
> > > --
> > > ubuntu-zh mailing list
> > > ubuntu-zh在lists.ubuntu.com
> > > https://lists.ubuntu.com/mailman/listinfo/ubuntu-zh
> > >
> >
> >
> >
> > --
> > $ gpg --keyserver keyserver.ubuntu.com --recv-keys E5211133
> > -------------- 下一部分 --------------
> > 一个HTML附件被移除...
> > URL: <
> >
> https://lists.ubuntu.com/archives/ubuntu-zh/attachments/20110118/aaa4a604/attachment.html
> > >
> > --
> > ubuntu-zh mailing list
> > ubuntu-zh在lists.ubuntu.com
> > https://lists.ubuntu.com/mailman/listinfo/ubuntu-zh
> >
>
>
>
> --
> *签名神马的都是浮云……*
> *
> *
> *我的BLOG <http://lcan.info>*
> *Twitter: @lcayu <http://www.twitter.com/lcayu>*
> **Linux
>
> fan,Ubuntu,KDE,IT小白,SSH翻墙控,裸考帝,犬夜叉迷,步迷,就读于天朝某号称国际化,信息化大学,关注Linux应用,网络与信息安全,ayu,及一切扯淡!求fo!
> *Facebook: 欢迎访问 <http://www.facebook.com/ghosthk>*
> -------------- 下一部分 --------------
> 一个HTML附件被移除...
> URL: <
> https://lists.ubuntu.com/archives/ubuntu-zh/attachments/20110118/0c8818be/attachment.html
> >
> --
> ubuntu-zh mailing list
> ubuntu-zh在lists.ubuntu.com
> https://lists.ubuntu.com/mailman/listinfo/ubuntu-zh
>
--
Robot Shell
http://robotshell.org/
-------------- 下一部分 --------------
一个HTML附件被移除...
URL: <https://lists.ubuntu.com/archives/ubuntu-zh/attachments/20110118/f383a769/attachment.html>
关于邮件列表 ubuntu-zh 的更多信息