LinuxÎå´ó¼òµ¥µÄÃüÁî½â¾öϵͳÐÔÄÜÎÊÌâ
¹ÜÀíLinuxÖ÷»úµÄÐÔÄÜ¿´ÆðÀ´¾³£ÏóÊÇÔÚ±äħÊõÒ»Ñù¡£Ðí¶à¹ÜÀíÔ±ÔÚÓöµ½ÐÔÄÜÎÊÌâµÄʱºò³£³£¼òµ¥»¯´¦Àí£¬ÒÀ¿¿Ó²¼þµÄ¸üл»´ú£¬¸ü´óµÄÄÚ´æºÍ¸üÇ¿µÄCPUÀ´½â¾öÎÊÌâ¡£ÊÂʵÉÏ£¬ÀûÓÃһЩ¼òµ¥µÄLinuxÃüÁ¿ÉÒÔ·¢ÏÖÐí¶à¹ÜÀíÖ÷»úµÄϸ½ÚÎÊÌâ²¢ÇÒÄÜѸËÙ¶ø¼òµ¥µØ½â¾öÐÔÄÜÎÊÌâ¡£
Ò»¡¢top
¶ÔÐí¶à¹ÜÀíÔ±À´Ëµ£¬×îÐÂѧ»áµÄ¾ÍÊÇTOPÃüÁËü¿ÉÒÔÏÔʾ³öµ±Ç°ÔËÐеÄËùÓÐÄÚºËÈÎÎñ£¬²¢ÇÒÌṩÁËһЩÖ÷»ú״̬µÄͳ¼Æ±¨¸æ¡£Ä¬Èϵأ¬TOPÃüÁîÿ¸ôÎå·ÖÖÓ×Ô¶¯¸üÐÂÒ»´ÎÕâ¸öÊý¾Ý£¨Õâ¸ö¸üмä¸ôÊÇ¿ÉÉèÖõģ©¡£
TOPÃüÁîµÄ¹¦Äܷḻµ½ÁîÈËÄÑÒÔÖÃÐÅ£¨¹À¼ÆºÜÉÙÓÐÈËʹÓùýÒ»°ëÒÔÉϵŦÄÜ£©¡£Ò»°ãÀ´ËµÄã»áÒÔ¡®h¡¯¼ü¿ªÊ¼£¬¾ÍÊÇ¡®help¡¯£¨ËµÃ÷ÎĵµÒ²·Ç³£¾«²Ê£©¡£°ïÖú²ÎÊý¿ÉÒÔ¿ìËÙÏÔʾ³öÄãÄÜ´ÓÖÐÔö¼ÓºÍ¼õÈ¥µÄÄÚÈÝ£¬Í¬Ê±Ò²¿ÉÒԸıäÅÅÐò¡£Ä㻹¿ÉÒÔÓÃkÀ´½áÊø½ø³Ì»òÕßÓÃr±ê×¢ÌرðµÄ½ø³Ì¡£
TopÃüÁîÏÔʾµ±ÌìµÄÕý³£ÔËÐÐʱ¼ä¡¢ÏµÍ³¸ºÔØ¡¢´¦ÀíÆ÷µÄÊýÁ¿¡¢ÄÚ´æµÄʹÓÃÂʺÍÄÄЩ½ø³ÌʹÓÃÁË´ó¶àÊýCPU×ÊÔ´£¨°üÀ¨Ã¿¸ö½ø³ÌµÄ´óÁ¿Ïà¹ØÐÅÏ¢£¬ÀýÈçÔÚÏßÓû§ºÍÕýÔÚÖ´ÐеÄÃüÁîµÈ£©¡£
¶þ¡¢vmstat
VmstatÃüÁîÌṩ¸øÄãÒ»¸öµ±Ç°CPU¡¢IO¡¢½ø³ÌºÍÄÚ´æʹÓÃÂʵĿìÕÕ¡£ºÍTOPÃüÁîÒ»Ñù£¬Ëü×Ô¶¯¶¯Ì¬Ë¢Ð£¬²¢ÇÒ¿ÉÒÔÓÃÏÂÃæµÄÃüÁîÖ´ÐУº
$ vmstat 10
ÔÚÕâÀïÑÓ³ÙÊÇÖ¸Á½´Îˢмä¸ôµÄÒÔÃëΪµ¥Î»µÄʱ¼ä£¬ÕâÀïÊÇ10ÃëÖÓ¡£VMSTATÃüÁî»á½«¼ì²éµÄ½á¹û²»Í£Ë¢ÐÂÏÔʾÔÚÆÁÄ»ÉÏ£¬Ö±µ½ÄãÓÃCTRL-CÃüÁî ½áÊøËü£¨»òÕßÄãÒ²¿ÉÒÔÔÚÖ´ÐеÄʱºòÉèÖÃÒ»¸öÏÞÖÆ£©¡£Õâ¸ö³ÖÐøÊä³öµÄ½á¹ûÓÐʱºò±»ÓÃÀ´µ¼Èëµ½ÎļþÖÐÓÃÀ´·ÖÎöÐÔÄÜÇ÷ÊÆ£¬µ«ÊÇÎÒÃǽ«ÕÒµ½¸üºÃµÄ·½Ê½À´×öÕâ¼þÊ Ç飬ÔÚÎÄÕºóÃæµÄ²¿·Ö»á½éÉÜ¡£
µÚÒ»ÁÐÏÔʾµÄÊÇ´¦ÀíÆ÷£¬ rÁÐÊÇ´ýÃüµÄ´¦ÀíÆ÷£¬¶øbÁÐÊÇÐÝÃߵĴ¦ÀíÆ÷¡£Èç¹ûÄãÔÚÕâÀï¿´µ½ºÃ¶à¸ö´ýÃüµÄ´¦ÀíÆ÷£¬ÄÇ˵Ã÷Äã¿ÉÄÜÔÚij¸öµØ·½Óöµ½ÁËÐÔÄÜÆ¿¾±¡£µÚ¶þÁÐÏÔʾµÄÊÇÄڴ棺ÐéÄâµÄ£¬ ¿ÕÏеģ¬»º³åºÍ»º´æÄÚ´æ¡£µÚÈýÁÐÏÔʾµÄÊǽ»»»´æ´¢ÒÔ¼°¾ßÌåÓжàÉÙÄÚ´æÔںʹÅÅÌ×ö½»»»¡£µÚËÄÁÐÔòÊÇI/OÐÅÏ¢£¬ÏÔʾÁË¿é·þÎñ½ÓÊպͷ¢Ë͵ĿéÊý¾ÝÐÅÏ¢¡£
×îºóÁ½ÁÐÏÔʾÁËϵͳºÍCPUÏà¹ØµÄÐÅÏ¢¡£ÏµÍ³ÁÐÏÔʾµÄÊdzåÍ»µÄÊýÁ¿ºÍÿÃëÖӵĽ»»»¡£CPUÁÐÊÇÏÔʾÁËÌرðÓÐÓõÄÐÅÏ¢¡£Ã¿¸ö·ÖÁÐÏÔʾÁËÒ»¸öCPUʱ¼äµÄ°Ù·Ö±È¡£ÕâЩ·ÖÁÐÈçÏ£º
US£ºÔËÐÐÓû§ÈÎÎñºÍ´úÂëºÄ·ÑµÄʱ¼ä
SY:ÔËÐÐÄں˻òÕßϵͳ´úÂëºÄ·ÑµÄʱ¼ä
ID:¿ÕÏÐʱ¼ä
WA:µÈ´ýIOºÄ·ÑµÄʱ¼ä
ST:ÐéÄâ»úÕ¼ÓõÄʱ¼ä
VMSTATÃüÁîÉó¤ÓÃÀ´²éѯCPUʹÓÃÇé¿ö£¬ËäÈ»¼Çסÿ¸ö²ÎÊýÖ÷Ҫȡ¾öÓÚ³ÖÐøµÄ¼à¿Ø£¬ÒòΪ¶ÔCPU½øÐжÌʱ¼äµÄ¹Û²ìÄã¿ÉÄÜÎÞ·¨»ñÖªCPUÕæÕýµÄÎÊÌâËùÔÚ¡£ÄãÐèÒª²é¿´³¤ÆÚµÄÔËÐÐÇ÷ÊÆÀ´»ñµÃÒ»¸öÈ·ÇеÄCPUÐÔÄÜÐÅÏ¢¡£
Èý¡¢iostat
ÎÒÃǽÓÏÂÀ´Òª½²µÄÃüÁîÊÇIOSTAT¡£IOSTATÃüÁî(ÔÚUBUNTU¡¢ºìñºÍFEDORAϵͳÖж¼ÊÇÓÉSYSSTATÈí¼þ°üÌṩµÄ)¿ÉÒÔÌṩÈý ¸ö±¨¸æ£ºCPUʹÓÃÂÊ¡¢É豸ʹÓÃÂʺÍÍøÂçÎļþϵͳʹÓÃÂÊ¡£Èç¹ûÄã²»¼ÓÈκβÎÊýµØÔËÐиÃÃüÁËü»áÏÔʾËùÓÐÕâÈý¸ö±¨¸æ£¬Äã¿ÉÒÔͨ¹ý¼Ó²ÎÊý-c¡¢-dºÍ£hÀ´ µ¥¶ÀÏÔʾËüÃÇÖеÄÒ»ÖÖ¡£
ÔÚÉÏÃæµÄͼÖÐÄã¿ÉÒÔ¿´µ½ËüÃÇÖеÄÆäÖÐÁ½¸ö±¨¸æ£¬µÚÒ»¸öÊÇCPUʹÓÃÂÊ£¬Ëü½«¸÷½ø³ÌÕ¼ÓõÄCPUÓðٷֱȷÖÀàÁгöÀ´ÁË¡£ÄãÄÜ¿´µ½Óû§½ø³Ì¡¢ÏµÍ³½ø³Ì¡¢iowaitºÍ¿ÕÏÐʱ¼äµÈÐÅÏ¢¡£
µÚ¶þ¸ö±¨¸æÊǹØÓÚÉ豸ʹÓÃÂÊ£¬ÏÔʾÁË°²×°ÔÚ¸ÃÖ÷»úÉϵÄÿ¸öÉ豸ºÍһЩÓÐÓõÄÐÅÏ¢£¬ÖîÈçÿÃë´«ÊäÁ¿¡¢Êý¾Ý¿é¶Áд£¬²¢ÇÒÔÊÐíÄã¶ÔÓÐÐÔÄÜÎÊÌâµÄÉ豸×ö±ê ¼Ç¡£Äã¿ÉÒÔͨ¹ýÌí¼Ó£k»òÕߣm²ÎÊýÀ´°´ÕÕǧ×Ö½Ú»òÕßÕ××Ö½ÚÏÔʾͳ¼ÆÐÅÏ¢£¬¶ø²»ÊÇÒÔÊý¾Ý¿éΪµ¥Î»£¬ÕâÑùÔÚijЩÇé¿öÏ»á¸ü±ãÓÚ²éÔĺÍÀí½â¡£
×îºóÒ»¸ö±¨¸æ£¬Ã»ÓнØͼ£¬ÏÔʾµÄÐÅÏ¢ºÍÉÏÃæ½éÉܵÄÉ豸ʹÓÃÂÊÓеãÏàËÆ£¬Ö»ÊǶÔÏó´Ó¸½¼þµÄÉ豸»»³ÉÁ˹ÒÔصÄÍøÂçÎļþϵͳ¡£
ËÄ¡¢free
ÏÂÒ»¸öÃüÁîfree£¬¿ÉÒÔÏÔʾÖ÷ÄÚ´æºÍ½»»»ÄÚ´æµÄͳ¼ÆÁ¿¡£
Äã¿ÉÒÔͨ¹ýÌí¼Ó£t²ÎÊýÀ´ÏÔʾ×ܵÄÄڴ棬»òÕßͨ¹ýÌí¼Ó£b²ÎÊýºÍ£m²ÎÊýÀ´ÓÃ×Ö½ÚÊýÏÔʾ£¨Ä¬ÈÏÇé¿öÊÇÓÃǧ×Ö½ÚΪµ¥Î»£©¡£
FREEÃüÁ¿ÉÒÔͨ¹ýʹÓãs²ÎÊýÀ´Ê¹ÆäÒÔij¸ö¼ä¸ôʱ¼ä³ÖÐøˢеØÔËÐУº
$ free -s 5
Õâ¸öÃüÁîÊÇÒÔÿ¸ô5ÃëÖÓË¢ÐÂÒ»´ÎµÄ·½Ê½ÔËÐÐFREEÃüÁî²¢Êä³ö½á¹û¡£
Îå¡¢sar
ÏóÎÒÃǼû¹ýµÄÐí¶àÆäËü¹¤¾ßÒ»Ñù£¬ÎÒÃÇ¿ÉÒÔÓÃsarÃüÁîÀ´ÊÕ¼¯¡¢²é¿´ºÍ¼Ç¼·þÎñÆ÷µÄÐÔÄÜÊý¾Ý¡£Ëü±ÈÎÒÃǼû¹ýµÄÈκÎÀàËƹ¤¾ß¶¼¸üÇ¿´ó£¬²¢ÇÒ¿ÉÒÔÊÕ¼¯ºÍÏÔʾ³¤Ê±¼ä¶ÎµÄÊý¾Ý¡£ÔÚºìñºÍUBUNTUÉÏ£¬Ëüͨ¹ýSYSSTAT°üÀ´°²×°¡£ÈÃÎÒÃÇ´Ó²»Ìí¼ÓÈκβÎÊýÔËÐÐSARÃüÁʼ°É£º
$ sar
´ÓÕâÀïÎÒÃÇ¿ÉÒÔ¿´µ½sarÃüÁîµÄ»ù±¾Êä³öÐÅÏ¢£¬°üÀ¨CPUͳ¼Æ£¨Ã¿¸ô10·ÖÖÓÒ»´ÎµÄÊý¾ÝºÍ×îºóµÄƽ¾ùÊý¾Ý£©¡£¸ÃÐÅÏ¢ÊÇ´ÓÒ»¸öÒÔ24СʱΪµ¥Î»²»Í£ÊÕ ¼¯ÐÅÏ¢µÄÈÕͳ¼ÆÎļþÖÐץȡ³öÀ´µÄ£¨Õâ¸öÎļþ´æ´¢ÔÚĿ¼/var/log/sa/ÖУ¬²¢ÇÒ±»ÃüÁîΪsaxxÕâÑùµÄ¸ñʽ£¬xx´ú±í¸ÃÊý¾ÝÊÕ¼¯µÄÈÕÆÚ£©¡£ÁíÍâËü »¹ÊÕ¼¯¹ØÓÚÄÚ´æ¡¢É豸¡¢ÍøÂçµÈµÄͳ¼ÆÐÅÏ¢£¨ÀýÈ磬ͨ¹ý¼Ó£b²ÎÊý¿ÉÒԲ鿴¿éÉ豸ͳ¼ÆÐÅÏ¢£¬£n²É²é¿´ÍøÂçÊý¾Ý£¬£r²ÎÊý¿´ÄÚ´æʹÓã©¡£Ä㻹¿ÉÒÔÓãA²ÎÊý À´²é¿´ËùÓÐÊÕ¼¯µÄÊý¾Ý¡£
Ä㻹¿ÉÒÔ³¤Ê±¼äÔËÐÐsarÃüÁîÈ»ºó½«Êä³öÊý¾Ýµ¼ÈëÒ»¸öÎļþÖÐÀ´ÊÕ¼¯Êý¾Ý¡£Òª´ïµ½Õâ¸öЧ¹û£¬ÐèҪʹÓòÎÊý£oºÍÒ»¸öÎļþÃû³Æ£¬ÒªÔËÐиÃÃüÁîµÄʱ¼ä¼ä¸ô £¨¼ÇµÃÊÕ¼¯Êý¾Ý»áµ¼ÖÂÐÔÄܱä²î£¬ËùÒÔ×îºÃÈ·±£Õâ¸ö¼ä¸ô²»ÒªÌ«¶Ì£©ºÍÑ»·µÄ´ÎÊý£ÄãÒª¼Ç¼µÄ¼ä¸ô´ÎÊý¡£Èç¹ûÄã²»ÊäÈëÑ»·´ÎÊý£¬ÔòsarÃüÁî»áÒ»Ö±ÔËÐÐÏÂÈ¥£¬ ÀýÈ磺
$ sar -A -o /var/log/sar/sar.log 600 >/dev/null 2>&1 &
ÕâÀïÎÒÃǽ«ÊÕ¼¯ËùÓÐÊý¾Ý(-A),¼Ç¼µ½Îļþ/var/log/sar/sar.logÖУ¬Ã¿¸ô600Ã루»òÕß5·ÖÖÓ£©ÊÕ¼¯Ò»´Î£¬³ÖÐøÔÚºǫ́ÔËÐС£Èç¹û½ÓÏÂÀ´ÎÒÃÇÏëÒªÏÔʾÕâ¸öÊý¾ÝÎÒÃÇ¿ÉÒÔÓÃsarÃüÁî¼ÓÉÏ-f²ÎÊý£¬ÀýÈ磺
$ sar -A -f /var/log/sar/sar.log
ÍƼöÐÅÏ¢
- linuxÃüÁîѧϰ±Ê¼Ç£¨11£©£ºnlÃüÁî
- linuxÃüÁîѧϰ±Ê¼Ç£¨5£©£ºrmÃüÁî
- linuxÃüÁîѧϰ±Ê¼Ç£¨4£©£ºmkdirÃüÁî
- linuxÃüÁîѧϰ±Ê¼Ç£¨1£©£ºlsÃüÁî
- ½«CentosµÄyumÔ´¸ü»»Îª¹úÄڵİ¢ÀïÔÆÔ´
- ʹÓÃNginxÌí¼Óheader·ÀÖ¹ÍøÒ³±»frame
- linuxϼÓËÙscp´«Êä´óÎļþµÄËÙ¶È
- linuxϵͳÉ϶ÔnginxÈÕÖ¾·Ö¸î´¦Àí
- lnmp/nginxϵͳÕæÕýÓÐЧµÄͼƬ·ÀµÁÁ´ÍêÕûÉèÖÃÏê½â
- Í»ÆÆÊ®Íò²¢·¢µÄNginxµÄÅäÖü°ÓÅ»¯
ÈÈÃÅÐÅÏ¢
- nohup: redirecting stderr to stdou....
- ʹÓÃlog_formatΪNginx·þÎñÆ÷ÉèÖøüÏêϸµÄÈÕÖ¾¸ñʽ
- jquery easyUI--dataGrid-Json
- [Ô´´]·ÂGoogle Reader¡¢ÐÂÀË΢²©¡¢ÌÚѶ΢²©µ....
- ÀûÓÃKeepalived+mysql¹¹½¨¸ß¿ÉÓÃMySQLË«Ö÷×Ô¶....
- Nginx+keepalivedʵÏÖ¸ºÔؾùºâºÍË«»úÈȱ¸¸ß¿ÉÓÃ
- jqueryʵÏÖÒ³Ãæ¼ÓÔؽø¶ÈÌõ
- Rolling cURL: PHP²¢·¢×î¼Ñʵ¼ù
- codeigniter ·ÓÉÖÕ¼«ÓÅ»¯(url rewrite)
- linuxÏÂÉèÖÃsshÎÞÃÜÂëµÇ¼
×î½ü¸üÐÂ
- ²éÕÒ²¢É¾³ý.svnĿ¼Îļþ
- redis ÆßÖÖÊý¾ÝÀàÐ͵ÄʹÓó¡¾°
- linux ÏÂÎļþ¸´ÖƵ½windowsÏÂÂÒÂëµÄ½â¾ö°ì·¨
- nginx³öÏÖ502 upstream sent too big he....
- linuxÏÂsudoÅäÖÃÏê½â
- linuxÃüÁîѧϰ±Ê¼Ç£¨15£©£ºtailÃüÁî
- linuxÃüÁîѧϰ±Ê¼Ç£¨14£©£ºheadÃüÁî
- linuxÃüÁîѧϰ±Ê¼Ç£¨13£©£ºlessÃüÁî
- linuxÃüÁîѧϰ±Ê¼Ç£¨12£©£ºmoreÃüÁî
- ¼ÓÃÜËã·¨±È½Ï3DES AES RSA ECC MD5 SHA1µÈ
ÆÀÂÛ