ãªãã¦ãã¨ã§ããããt2.microãt2.smallãªã©å°è¦æ¨¡ã¤ã³ã¹ã¿ã³ã¹ã®å ´åã«ã¯ãã¹ã¯ããé åããªãã®ã§ãã
ã¡ã¢ãªä½¿ç¨éãå¤ãã®å ´åã«ã¯ãã¡ã¢ãªã¨ã©ã¼ã«ãªã£ã¦ãã¾ããã¨ãã
ãªã®ã§ãèªåã§Swapé åã確ä¿ãã¦ãããªããã°ããã¾ãããã¨ãããã¨ã§ããã®æã®åå¿é²Ï(..)ã¡ã¢ã¡ã¢
ã¹ã¯ããé åã追å ãã
#!/bin/bash # 1Mã®ãããã¯ã512åã§åè¨512Mã®ãã¡ã¤ã«ã/swapfile1ã¨ãã¦ä½æ sudo dd if=/dev/zero of=/swapfile1 bs=1M count=512 # 644ã ã¨swaponã®ã¨ãã«æãããã®ã§ã600ã«ã¢ã¯ã»ã¹æ¨©éãå¤æ´ sudo chmod 600 /swapfile1 # ã¹ã¯ããé åãä½æ sudo mkswap /swapfile1 # ã¹ã¯ããé åãæå¹å sudo swapon /swapfile1 # åèµ·åãã¦ãã¹ã¯ããé åããã¦ã³ããããããã«ã/etc/fstabã«è¿½å sudo sh -c 'echo "/swapfile1 none swap sw 0 0" >> /etc/fstab'
ã¹ã¯ããã®é »åº¦ãå¤æ´
ã¹ã¯ããããã¨ããã¡ã¤ã«I/Oãçºçããã®ã§ãé
ããªããã¨ããã
ãªã®ã§ãã¹ã¯ããã®é »åº¦ãå°ãªãè¨å®ãã¾ãã
# ç¾å¨ã®é »åº¦ãç¢ºèª cat /proc/sys/vm/swappiness # => 60 # ã¹ã¯ããé »åº¦ã10ã«å¤æ´ echo 10 | tee /proc/sys/vm/swappiness echo vm.swappiness = 10 | tee -a /etc/sysctl.conf
ã¹ã¯ããé åãå ã«æ»ã
# ã¹ã¯ããé åãç¡å¹å swapoff /swapfile1 # ã¹ã¯ãããã¡ã¤ã«ãåé¤ rm -f /swapfile1
åèã«ãããµã¤ãæ§
- AWSã®EC2ã§å¿ è¦ãªswapé åã®è¿½å ã¨ã¹ã¯ãããæ¸ããè¨å® - Qiita:title
- AWS Amazon Linux ã¹ã¯ãããã¡ã¤ã«ä½æã«ããSwapé åã®ãµã¤ãºãå¢ãã - Qiita
- Amazon EC2(Linux)ã®swapé åãã¹ããã©ã¯ãã£ã¹ ï½ Developers.IO
- GitLabã®åä½ãé ãã®ã§ã¹ã¯ããé »åº¦ãå¤ãã¦ã¿ã | Ystk Log ãã¨ã·ã¿ã«ãã°ã