ããã«ã¡ã¯ã@yoheiMuneã§ãã Amazon EC2ã®Amazon Linuxã§ãJavaã®ææ°çãã¤ã³ã¹ãã¼ã«ãããã¨ããã£ãã®ã§ããã®æé ãããã°ã«æ®ãããã¨æãã¾ãã ç®æ¬¡ 対象ã®ç°å¢ Amazon EC2ã§ã¯æ§ã ãªOSãæ±ãã¾ããããã®è¨äºã®å¯¾è±¡ã¯Amazon Linuxã§ãã ã¾ããå·çæç¹ã§ã®Javaææ°çã¯1.8ãªã®ã§ããããã¤ã³ã¹ãã¼ã«ããå 容ã§å·çãã¾ãã ãã¬ã¤ã³ã¹ãã¼ã«ã®Javaã確èªãã Amazon Linuxã«ã¯ãæåããjavaãå°å ¥ããã¦ãã¾ãã $ java -version java version "1.7.0_151" OpenJDK Runtime Environment (amzn-2.6.11.0.74.amzn1-x86_64 u151-b00) OpenJDK 64-Bit Server VM (build 24.151-b00,
ããã«ã¡ã¯ã@yoheiMuneã§ãã ä»æ¥ã¯ãnginxã«Basicèªè¨¼ãè¨å®ããæ¹æ³ãããã°ã«æ¸ãããã¨æãã¾ãã ç®æ¬¡ ä»åã®æ¤è¨¼ç°å¢ã¯ãã¡ã nginxãèªç±ã«è©¦ããã°ã©ãã§ãè¯ãã®ã§ãããä»åã¯Dockerã§æ¤è¨¼ãã¦ã¿ããã¨æãã¾ããDockerã«ã¤ãã¦ã¯ãDockerã«å ¥éããï¼ã¤ã³ã¹ãã¼ã«ãOSã¤ã¡ã¼ã¸å ¥æãã³ã³ããèµ·åãã³ã³ãã管çï¼ãã¨ããããã°ãæ¸ãã¾ããã®ã§ãåèã«ãªãã°å¹¸ãã§ãã CentOS7ã®ã¤ã¡ã¼ã¸ã使ã£ã¦ã以ä¸ã®ããã«ã³ã³ãããèµ·åãã¦ãã°ã¤ã³ãã¾ãã # CentOS7ã®ã¤ã¡ã¼ã¸ãå ¥æ $ docker pull centos:7 # ã³ã³ããã®èµ·åã¨ãã°ã¤ã³ # -pãªãã·ã§ã³ã§ãDockerå ã®80ãã¼ãããã¹ãï¼Macãªã©ï¼ã§ã¯8080ãã¼ãã§ã¢ã¯ã»ã¹ã§ããããã«ãã¦ãã¾ã. # ã¾ãã--rmãªãã·ã§ã³ãã¤ãã¦ããã°ã¢ã¦ãããã¨èªåçã«ã³ã³ãããå
ããã«ã¡ã¯ã@yoheiMuneã§ãã ãµã¼ãã¼ã§ã·ã¹ãã ãéç¨ãã¦ãããã ãã ãã¨ãã¡ã¤ã«ãå¢ãã¦ãã¼ããã£ã¹ã¯ããã£ã±ãã«ã»ã»ã»ããããªæã«å¤ããã¡ã¤ã«ãè¦ã¤ãã¦åé¤ããæ¹æ³ãããã°ã«æ¸ãããã¨æãã¾ãã ç®æ¬¡ findã³ãã³ãã§æ¥ä»ãã¼ã¹ã§ãã¡ã¤ã«ãè¦ã¤ãã findã³ãã³ãã®mtimeãatimeã®ãªãã·ã§ã³ãæå®ãã¦ãæ¥ä»ã§ãã¡ã¤ã«ãæ¢ããã¨ãã§ãã¾ãã ãªãã·ã§ã³ æ¦è¦ ããã¦ããªãã·ã§ã³ã®å¾ãã«ã¯ãã+nï¼næ¥ä»¥åããnï¼ã¡ããã©næ¥åãã-nï¼næ¥åã¾ã§ããæå®ãããã¨ãã§ãã¾ãã # æçµæ´æ°æ¥ãã10æ¥åãéå»ãã§ãããã¡ã¤ã« $ find /opt/myapp/data/ -mtime +10 # æçµæ´æ°æ¥ãã10æ¥åãã§ãããã¡ã¤ã« $ find /opt/myapp/data/ -mtime 10 # æçµæ´æ°æ¥ããç¾å¨ã10æ¥åãã§ãããã¡ã¤ã« $ find
ããã«ã¡ã¯ã@yoheiMuneã§ãã ä»æ¥ã¯Linuxã§root権éã§ã³ãã³ããå®è¡ããsudoã«ã¤ãã¦ããã¹ã¯ã¼ããªãã§è¡ãããã®è¨å®ãããã°ã«æ¸ãããã¨æãã¾ãã ç®æ¬¡ è¨å®ãã対象 以éã®èª¬æã¯ä»¥ä¸ã®ã³ãã³ãã§ç·¨éãè¡ãã¾ãã $ sudo visudo ã°ã«ã¼ãå¥ã«æå®ãã ã°ã«ã¼ãå¥ã«ãã¹ã¯ã¼ããªããè¨å®ããã«ã¯ãvisudoã³ãã³ãã§ä»¥ä¸ã®å 容ã追å ãã¾ãã # visudo # my_opeã°ã«ã¼ãã«ãã¹ã¯ã¼ããªãè¨å®ãè¡ãå ´å %my_ope ALL=(ALL) NOPASSWD: ALL ã¾ããç¹å®ã®ã³ãã³ãã®ã¿ãã¹ã¯ã¼ããªãã«ãããå ´åã«ã¯ã以ä¸ã®ããã«è¨å®ãã¾ãã # visudo # my_opeã°ã«ã¼ãã«shutdownã®ã¿ãã¹ã¯ã¼ããªãã§ããããã«ãã %my_ope ALL=(ALL) NOPASSWD: /sbin/shutdown ããã§ã®ãã¤ã³ãã¯ã°ã«
ããã«ã¡ã¯ããµã¼ãã¼é¢é£ã®ã¹ãã«ã¢ããä¸ã®@yoheiMuneã§ãã ä»æ¥ã¯Linuxã§ããã£ã¹ã¯ã®ä½¿ç¨éããã©ã«ãããã¡ã¤ã«ã®ãµã¤ãºã調ã¹ãæ¹æ³ãããã°ã«æ¸ãããã¨æãã¾ãã ç®æ¬¡ ãã£ã¹ã¯ããã©ã¤ãã®ä½¿ç¨éã調ã¹ãï¼dfã³ãã³ãï¼ ç©ºå®¹éããªããªã£ã¦ããéã«ã¾ãè¦ããã®ãdfã³ãã³ãã§ãããã®ã³ãã³ãã使ããã¨ã§ããã£ã¹ã¯ããã©ã¤ãå ¨ä½ã§ã®ç©ºå®¹éãç¥ããã¨ãã§ãã¾ãã $ df Filesystem 1K-blocks Used Available Use% Mounted on /dev/vda3 203974444 89116776 104489620 47% / tmpfs 961104 0 961104 0% /dev/shm /dev/vda1 243823 85007 146016 37% /boot # -hãªãã·ã§ã³ã§ããæãã®ãµã¤ãºã§è¡¨ç¤ºãããï¼ä»¥ä¸ã¯GBåä½ã¨MBå
ãªãªã¼ã¹ãé害æ å ±ãªã©ã®ãµã¼ãã¹ã®ãç¥ãã
ææ°ã®äººæ°ã¨ã³ããªã¼ã®é ä¿¡
å¦çãå®è¡ä¸ã§ã
j次ã®ããã¯ãã¼ã¯
kåã®ããã¯ãã¼ã¯
lãã¨ã§èªã
eã³ã¡ã³ãä¸è¦§ãéã
oãã¼ã¸ãéã
{{#tags}}- {{label}}
{{/tags}}