ãµã¼ããã¡ã³ãããæã«ä¾¿å©ãª Linux ã³ãã³ã 3ã¤
ã¯ããã«
ãµã¼ããéç¨ãããç°å¢ãæ§ç¯ããããã¦ãã¦ãããããã®ããã»ã¹ã§åãã¦ããã°ã©ãã ã£ãã»ã»ããªã©å°ãã¨ããããã¾ãã
ãããªã¨ãã«é ¼ãã«ãªããããããªãã³ãã³ãã 3ã¤ãç´¹ä»ãã¾ãã
@madeth 師å ã«æãã¦ããã ãã¾ããã
1. proc ã§ããã»ã¹ã使ã£ã¦ãããã¡ã¤ã«ãè¦ã
å°ã£ããã¨
ããã»ã¹ã®åããã°ã®ãã¹ãã©ããã¦ãåãããªãã»ã»ã
è§£æ±ºæ³ (ç·¨é 2014/09/10)
ç¥ãããããã»ã¹ã® ID ã調ã¹ã¾ãã
$ ps aux | grep unicorn deploy 3335 xxx xxx xxx xxx X XX 15:14 0:07 unicorn master -c /var/www/myproject/unicorn/staging.rb -E staging -D
ããã»ã¹ID (ãã®å ´å㯠3335) ããã¨ã« root 権éã§ãã¡ã¤ã«ãã£ã¹ã¯ãªãã¿ãã®ããã¾ãã
$ sudo ls -l /proc/3335/fd -wx------ 1 deploy deploy 64 Jun 26 16:56 X -> /hard/to/find/log/unicorn.log -wx------ 1 deploy deploy 64 Jun 26 16:56 Y -> /hard/to/find/log/unicorn_err.log ...
ããããããªã¨ããã«ãã°ãããã¾ããï¼
ä»ã«ãã½ã±ããã»ãã¤ãã»å®è¡ãã¡ã¤ã«ã¨ãã£ãæ å ±ãè¦ãããããã§ãã
2. mlocate ã§ãã¡ã¤ã«ãæ¤ç´¢ãã (2014å¹´06æ30æ¥æ´æ°)
å°ã£ããã¨
ãã®è¨å®ãã¡ã¤ã«ã©ãç½®ããã£ãã»ã»ã
解決æ³
mlocate ã使ãã¾ããã¤ã³ããã¯ã¹ãå ã«é«éã§ãã¡ã¤ã«ãæ¤ç´¢ãããã¼ã«ã§ããå¥éã¤ã³ã¹ãã¼ã«ãå¿ è¦ã§ãã
$ sudo yum -y install mlocate # ã¤ã³ããã¯ã¹ãä½æããã¡ã¤ã«æ§æãå¤ãã£ããé½åº¦å®è¡ããã®ãå¿ããã«ï¼ # è² è·ããããæä½ãªã®ã§æ³¨æ $ sudo updatedb
æ¤ç´¢ããããã¡ã¤ã«åã§ã³ãã³ããå®è¡ãã¦ã¿ã¾ãããã
$ locate nginx.conf /etc/nginx/nginx.conf /etc/nginx/nginx.conf.default /this/path/is/abnormal/nginx.conf
ããããããããªå ´æããè¦ã¤ãããã¨ãã§ãã¾ããã
ãã¹ã§çµãè¾¼ããã¨ãã§ãã¾ãã
$ locate "/nginx/nginx.conf" /etc/nginx/nginx.conf /etc/nginx/nginx.conf.default
3. ããã»ã¹ã«é¢ããæ å ±ãããããç¥ã
å°ã£ããã¨
ããã»ã¹ã®æ å ±ãã¹ãã¼ãã«ç¥ãããã
解決æ³
top ã³ãã³ãã®ä¾¿å©ãªä½¿ãæ¹ããç´¹ä»ãã¾ãã
- ã¦ã¼ã¶ã§çµãè¾¼ã¿ãã: u ãæã£ã¦ã¦ã¼ã¶åãå ¥åããã¨çµãè¾¼ãã
- ã³ãã³ãã©ã¤ã³ãè¦ãã: c ãæã¤
- CPUãå°ã£ã¦ãé ã«ä¸¦ã¹æ¿ããã: Shift+P ãæã¤
- ã¡ã¢ãªãå°ã£ã¦ãé ã«ä¸¦ã¹æ¿ããã: Shift+M ãæã¤
- ã³ã¢æ°ã確èªããã: 1 ãæã¤
ä»ã®ãªãã·ã§ã³ãæ°ã«ãªãæ¹ã¯こちらãã覧ãã ããã
top ã«ã¯ htop といった派生ツールが色々あるããã§ãã
ãããã«
ç¥ããããã¨ãã¹ãã¼ãã«ç¥ããããã«ç·´åº¦ãé«ããããªã (ææ³)ã