服务器出现严重问题了,大家帮忙!!

发表于:2007-06-09来源:作者:点击数: 标签:
[color=red:5ee5bbb87b]Allmbufclustersexhausted,Pleaseseetuning(7)[/color:5ee5bbb87b] 我的服务器现在一启动就出现上面的错误信息,满屏满屏的滚,根本无法登陆,按alt+f3(f4、f5等)则可以登陆,从而导致服务器严重丢包(丢100%以上),大家帮忙看看是怎

[color=red:5ee5bbb87b]All mbuf clusters exhausted ,  Please see tuning(7)[/color:5ee5bbb87b]
我的服务器现在一启动就出现上面的错误信息,满屏满屏的滚,根本无法登陆,按alt + f3(f4、f5等)则可以登陆,从而导致服务器严重丢包(丢100%以上),大家帮忙看看是怎么回事啊?

 quakelee 回复于:2003-07-04 23:15:56
先把网线罢了看看

 白狐狸 回复于:2003-07-04 23:19:38
对了,我的服务器主要跑的是 apache + mysql,用来提供免费个人主页的,跑了几个月都很好,今天晚上突然出现不能访问的现象,机房人员重启服务器后就说出现上面的错误,郁闷啊,从没遇到这样的问题,幸好不是硬盘坏,心里总算塌实了点啊,各位英雄给指点指点啊

 白狐狸 回复于:2003-07-04 23:22:42
quakelee,我现在不在机房啊,离服务器一千多公里呢,我ping服务器,基本上丢包率在99%以上,根本无法远程登陆进去,真正体会到干着急是什么意境了
 ops:  ops:  ops:  ops:

 quakelee 回复于:2003-07-04 23:23:22
你让机房的人先把网线拔了再重启看看

 白狐狸 回复于:2003-07-04 23:26:04
这是我在 google 上找到的相关内容:

RH Linux has a (really dumb) default of using UDP mounts with a 16K
read and write size.  A small percentage of packet loss will cause
many fragments to build up on the IP reassembly queues and run you out
of mbuf clusters.

There are 3 things you could do to fix this:

a) Use more reasonable NFS mount options on the linux boxes.  8K UDP
should help quite a bit, 32K TCP should totally eliminate the problem.

b) Drastically reduce net.inet.ip.maxfragpackets (make sure that
(maxfragpackets * (16384/1472)) < (maxmbufclusters - some_constant).
This will limit the amount of packets (and therefor mbufs) on the IP
reassembly queues.  This may could destroy your observed NFS write
performance from the linux side if you do not also implement (a)
above. 

c) Eliminate all packet loss in your network between the client and
server.  Not likely,  as I suspect some of the packet loss might even
be inside the linux or freebsd boxes.

I suggest you do both (a) and (b).

 白狐狸 回复于:2003-07-04 23:27:46
跟NFS有什么关系呀,我服务器根本没开启这个什么NFS服务,是不是/var/log日志文件把整个/var分区给占满了呀

 quakelee 回复于:2003-07-04 23:28:47
我记得其实增加
maxusers就能增加mbuf的大小
你原来设置的是多少?
有可能有人进攻你的机器,当然是dos,所以先把网线拔了看看,如果不出这个了,最好能让人在本地修改一下内核配置

 白狐狸 回复于:2003-07-04 23:33:05
这需要重新编译内核吗?我再找找啊,刚刚在网上看到解决方法,但还是看不太明白啊

 白狐狸 回复于:2003-07-04 23:50:37
网上找的相关资料,研究中。。。。大家也帮我看看啊,急死了      
Content-Transfer-Encoding: quoted-printable

I killed my FreeBSD 4.8-PRE (2003-02-1 server today by exhausting the
available mbufs.  I'd seen warnings like "All mbuf clusters exhausted,
please see tuning(7)." in /var/log/messages, so I added
`kern.ipc.nmbclusters=3D"16384"' to /boot/loader.conf.local a while back.

This server has 768MB of memory, and I run at least two copies of PostgreSQL
(it has multiple jails) at any given time and use it to server NFS to a
couple of Linux clients.  Today I wanted to test Bochs on one of the Linux
machines, ran the bochsconf program, watched it run "createdisk" to make a
512MB disk image in my home directory, and saw the server panic within a few
seconds.  When it came back up, I bumped nmbclusters to 32768, rebooted, and
tried createdisk it.  This time I watched `netstat -m' as the dreaded "All
mbuf clusters exhausted..." message began to scroll up the screen.  This
time, the server stayed alive, but it clearly maxed out all available
buffers.  After createdisk was finished, the mbuf usage went back to normal:

    $ netstat -m
    389/36736/131072 mbufs in use (current/peak/max):
            389 mbufs allocated to data
    388/32768/32768 mbuf clusters in use (current/peak/max)
    74720 Kbytes allocated to network (33% of mb_map in use)
    345 requests for memory denied
    1 requests for memory delayed
    0 calls to protocol drain routines

My questions are these:

1) Is there a guideline for how many nmbclusters to allocate?  Short of
   running out of physical memory, is there such a thing as too many?

2) I've already allocated 64MB to network buffering.  This seems like a huge
   amount to me.  Is it?

3) Should running out of mbufs be expected to crash the server, or should I
   try to reproduce it and file a PR?

4) What could createdisk have been doing to spike usage that heavily?

5) Could Linux's NFS client implementation have aggravated the situation?

 zhangpiwang 回复于:2003-07-05 00:50:13
最好的办法,坐飞机回去现场,自己立刻解决!

 darkclearcase/" target="_blank" >cc 回复于:2003-07-05 01:29:27
服务器  机器---------

 i2era 回复于:2003-07-05 09:23:39
see man tuning.7
here is the Chinese version:
http://community.freebsdchina.org/document.php?topic=3039&forum=31

 ★可乐∮ 回复于:2003-07-05 12:05:18
你使用df -i看看节点使用情况!
然后编译核心,增加maxuser的数量!
这样就可以了!

 与时俱进 回复于:2003-07-05 12:34:09
您好!
    你的服务器在哪里?在德国,找红姐,在重庆可找我,在北京,也可找人到现场去看看吗!

 hdcola 回复于:2003-07-06 09:57:05
[quote:7e502691f5="★可乐∮"]你使用df -i看看节点使用情况!
然后编译核心,增加maxuser的数量!
这样就可以了![/quote:7e502691f5]     

错误和inode没关系的呀

 hdcola 回复于:2003-07-06 10:01:24
[quote:e70be5e570="白狐狸"]
我的服务器现在一启动就出现上面的错误信息,满屏满屏的滚,根本无法登陆,按alt + f3(f4、f5等)则可以登陆,从而导致服务器严重丢包(丢100%以上),大家帮忙看看是怎么回事啊?[/quote:e70be5e570]     

从All mbuf clusters exhausted , Please see tuning(7) 
来看,是你的mbuf clusters已经用完,查看可以使用 netstat -rm来看到。
改进办法是重新make kernel增加maxuser(可能不对,记不清了,问quaklee罢,他记这些单词记的好)
也可以通过sysctl来临时增加mbuf

对了,查查你的网卡罢,是不是有问题,是什么型号的?烂卡很容易出这个问题的。

 void 回复于:2003-07-06 11:48:13
[quote:ca033ec94b="白狐狸"]
我的服务器现在一启动就出现上面的错误信息,满屏满屏的滚,根本无法登陆,按alt + f3(f4、f5等)则可以登陆,从而导致服务器严重丢包(丢100%以上),大家帮忙看看是怎么回事啊?[/quote:ca033ec94b]     
在/boot/loader.conf 里面设置合适的NMBCLUSTERS数值,然后从新启动,就可以解决你的问题.
详见handbook:
http://www.freebsd.org/doc/en_US.ISO8859-1/books/handbook/configtuning-kernel-limits.html
里面6.13.2 Network Limits这节叙述.
其实错误报告里告诉你man 7 tuning了哈.呵呵(开个玩笑)
另:不可以在系统运行时用sysctl来调整这个参数.

 hdcola 回复于:2003-07-07 02:44:11
[quote:4e1f8ed4c6="void"]    
在/boot/loader.conf 里面设置合适的NMBCLUSTERS数值,然后从新启动,就可以解决你的问题.
详见handbook:
http://www.freebsd.org/doc/en_US.ISO8859-1/books/handbook/configtuning-kernel-limits.html
里面..........[/quote:4e1f8ed4c6]     

sysctl中没有相关参数吗?。。。。。。。。。。。。。

 hdcola 回复于:2003-07-07 02:45:18
[quote:beda653b1b="hdcola"]    

sysctl中没有相关参数吗?。。。。。。。。。。。。。看来我是有问题了,不过还是make kernel的保险[/quote:beda653b1b]

 void 回复于:2003-07-07 08:13:16
[quote:1ffd6dc08a="hdcola"]    

sysctl中没有相关参数吗?。。。。。。。。。。。。。[/quote:1ffd6dc08a] 
晕哦,我什么时候说sysctl没有这个参数了,不过不能调整这个参数罢了,有一些参数需要在系统启动时候加载才可以的嘛~

 jedi-k 回复于:2003-07-07 09:44:05
[quote:c4aa572403="hdcola"]    

sysctl中没有相关参数吗?。。。。。。。。。。。。。[/quote:c4aa572403]     

nmbcluseter这个参数用sysctl -w写不进去的
要写在loader.conf里启动时加载
或者option写入内核重编
只有两种方法

 葱头 回复于:2003-07-07 10:15:22
打开/boot/defaults/loader.conf

找到kern.ipc.nmbclusters=字段,把里面的数字改大一点,我这里是40768,你可以参考一下,实际按你的服务器需要而定。

重新启动即可完成。

 白狐狸 回复于:2003-07-13 00:18:06
非常感谢大家的帮忙,服务器终于好了    

谢谢楼上各位无私的支持和帮助!!

 夜猫子 回复于:2003-07-13 04:21:00
可以用netstat -m查看mbufs的使用情况来检测mbufs是不是不够用了,不过问题已经解决,我这只是马后炮

 rocket_boy 回复于:2003-07-28 23:24:54
哪请总结一下研竟是什么问题啊!有以上的哪一种点解决呢?

 edwardj 回复于:2003-07-29 10:04:23
[quote:21492771fc="rocket_boy"]哪请总结一下研竟是什么问题啊!有以上的哪一种点解决呢?[/quote:21492771fc]     

系统一开始就提示mbuf不足了啊。

 rocket_boy 回复于:2003-08-04 20:01:55
thanks!

 cqfanli 回复于:2003-09-15 10:33:06
謝謝,chinaunix的確很團結的!

原文转自:http://www.ltesting.net