ps£º²é¿´ÏµÍ³ÖеĽø³Ì£¬LinuxÖпÉÒÔʹÓÃps -aux²é¿´ËùÓнø³Ì
²ÎÊýw±íʾ¼Ó¿íÏÔʾµÄÃüÁîÐУ¬²ÎÊýw¿ÉÒÔд¶à´Î£¬Í¨³£×î¶àд3´Î£¬±íʾ¼Ó¿í3´Î£¬Õâ×ãÒÔÏÔʾºÜ³¤µÄÃüÁîÐÐÁË¡£
ÀýÈ磺ps -auxwww
top£ºÏÔʾϵͳÄÚ´æ¡¢cpuʹÓÃÇé¿ö£¬²¢¿É×Ô¶¯Ë¢Ð½ø³ÌÁбí
vmstat£ºÏÔʾµ±Ç°µÄÄÚ´æʹÓÃÇé¿ö
netstat£ºÏÔʾÍøÂç×´¿ö£¬Ê¹ÓòÎÊýp¿ÉÒԲ鿴¶ÔÓ¦µÄ½ø³ÌºÅ¼°³ÌÐòÃû£¬
ͨ³£Ê¹ÓòÎÊýa£¨ÏÔʾËùÓÐÁ¬½ÓÇé¿ö£©ºÍn£¨²»·´²éÓòÃûºÍ·þÎñÃû£©£¬
ÀýÈ磺netstat -anp
²é¿´·þÎñÆ÷ÕìÌýÇé¿ö£¬Ê¹Óãº
netstat -an | grep LISTEN
²é¿´·þÎñÆ÷Òѽ¨Á¢µÄÁ¬½Ó£¬Ê¹Óãº
netstat -an | grep ESTABLISHED
ifconfig£º²é¿´(»òÉèÖã©ÍøÂçÉ豸ÐÅÏ¢
ifconfig -a£º²é¿´ËùÓÐÍøÂçÉèÖÃÐÅÏ¢
last£ºÏÔʾµÇ¼µ½·þÎñÆ÷µÄÇé¿öÒÔ¼°·þÎñÆ÷ÖØÆôÇé¿ö
df£ºÏÔʾӲÅ̿ռ估ʹÓÃÇé¿ö£¬LinuxÏ¿ÉÒÔ´ø²ÎÊýh£¬ÏÔʾ½á¹û¸üÈËÐÔ»¯¡£ÀýÈ磺
df -h Ó²Å̿ռ䰴ÈËÐÔ»¯ÏÔʾ
df -k Ó²Å̿ռ䰴KBÏÔʾ
df -m Ó²Å̿ռ䰴MBÏÔʾ
w£ºÏÔʾµÇ¼µ½·þÎñÆ÷ÉϵÄÓû§Áбí
ÒÔϼ¸¸öÃüÁî½öÕë¶ÔLinux
lsof£ºÏÔʾµ±Ç°´ò¿ªµÄÎļþÁÐ±í£¬°üÀ¨½¨Á¢µÄsocketÁ¬½ÓµÈ¡£±¾ÃüÁî¿ÉÒÔÓÃÓÚ³ÌÐòÔ±¼ì²é±àдµÄ³ÌÐò´ò¿ªµÄÎļþÊý¡£
sysctl£ºÏÔʾ£¨»òÉèÖã©ÏµÍ³Äں˲ÎÊý
sysctl -a ÏÔʾËùÓÐÄں˲ÎÊý
sysctl -w ²ÎÊýÃû=²ÎÊýÖµ
ÀýÈ磺sysctl -w fs.file-max=10240 ÉèÖÃϵͳÔÊÐíͬʱ´ò¿ªµÄ×î´óÎļþÊýΪ10240¡£
Äں˲ÎÊýfs.file-nr°üÀ¨Èý¸ö²ÎÊýÖµ£¬µÚÒ»¸ö²ÎÊý±íʾϵͳÖÐÔø¾Í¬Ê±´ò¿ª¹ýµÄÎļþÊý·åÖµ£¬
µÚ¶þ¸ö²ÎÊý±íʾ¿ÕÏУ¨·ÖÅäºóÒÑÊÍ·Å£©µÄÎļþÊý£¬
µÚÈý¸ö²ÎÊý±íʾ¿ÉÒÔ´ò¿ªµÄ×î´óÎļþÊý£¬ÆäÖµµÈÓÚfs.file-max¡£
µ±Ç°´ò¿ªµÄÎļþÊý = µÚÒ»¸ö²ÎÊýÖµ - µÚ¶þ¸ö²ÎÊýÖµ
ÀýÈ磺
fs.file-nr = 977 223 10240
µ±Ç°´ò¿ªµÄÎļþÊý = 977 - 233 = 744
ÉèÖÃÄں˲ÎÊýʱÎñ±ØСÐÄ£¬Èç¹ûÉèÖò»µ±»áµ¼ÖÂϵͳÒì³££¬ÉõÖÁµ±»ú¡£
ulimit£ºÏÔʾ£¨»òÉèÖã©Óû§¿ÉÒÔʹÓõÄ×ÊÔ´ÏÞÖÆ
ulimit -a ÏÔʾÓû§¿ÉÒÔʹÓõÄ×ÊÔ´ÏÞÖÆ
ulimit unlimited ²»ÏÞÖÆÓû§¿ÉÒÔʹÓõÄ×ÊÔ´£¬µ«±¾ÉèÖöԿɴò¿ªµÄ×î´óÎļþÊý£¨max open files£©
ºÍ¿ÉͬʱÔËÐеÄ×î´ó½ø³ÌÊý£¨max user processes£©ÎÞЧ
ulimit -n <¿ÉÒÔͬʱ´ò¿ªµÄÎļþÊý> ÉèÖÃÓû§¿ÉÒÔͬʱ´ò¿ªµÄ×î´óÎļþÊý£¨max open files£©
ÀýÈ磺ulimit -n 8192
Èç¹û±¾²ÎÊýÉèÖùýС£¬¶ÔÓÚ²¢·¢·ÃÎÊÁ¿´óµÄÍøÕ¾£¬¿ÉÄÜ»á³öÏÖtoo many open filesµÄ´íÎó
ulimit -u <¿ÉÒÔÔËÐеÄ×î´ó²¢·¢½ø³ÌÊý> ÉèÖÃÓû§¿ÉÒÔͬʱÔËÐеÄ×î´ó½ø³ÌÊý£¨max user processes£©
ÀýÈ磺ulimit -u 1024
licq2000 ÓÚ 2006-08-25 11:14:29·¢±í:
ºÃ¶«Î÷£¬Ð»Ð»Â¥Ö÷