본문 바로가기
IT 인터넷

[오라클클라우드] 프리티어 회수 대비용

by zzom~ 2024. 10. 7.
반응형

오라클에서 제공하는 무료 클라우드(프리티어)는

무료 사용자의 장기 유휴 리소스는 주기적으로 회수하는 정책이 적용되었습니다.

 

회수를 위해서 인스턴스를 중지시켜버립니다.

조건에 해당된다고 바로 삭제되지는 않지만 접근이 되지 않아서 인스턴스 재시작을 해줘야합니다.

 

무료 계정의 경우 인스턴스가 회수되는 조건이 있는데 다음과 같다.

  • 95번째 백분위수의 CPU 사용률이 20% 미만인 경우
  • 네트워크 사용률이 20% 미만인 경우
  • 메모리 사용률이 20% 미만(A1 형태에만 적용)인 경우

 

이경우를 대비하여 조건에 맞게끔 리소스를 사용하게 하는 스크립트이다.

오라클에게는 미안하지만...

 

bash <(curl -s -L https://gist.githubusercontent.com/Ansen/e45320205faf5786d3282ac880f20bab/raw/onekey-NeverIdle.sh)

apt install screen

chmod 777 NeverIdle

screen -R NeverIdle

/tmp/NeverIdle -c 1h -n 1h30m

 

screen의 세션의 분리 및 재 시작

- 분리 : Ctrl + a + d

- 재연결 : screen -r

[2023-03-09 02:57:15] - Downloading NeverIdle-linux-amd64 to /tmp/NeverIdle ...
[2023-03-09 02:57:19] - invalid memory size: []
[2023-03-09 02:57:19] - AMD doesn't need to test memory !
[2023-03-09 02:57:19] - cpu test interval is empty, set to default value: [2h]
[2023-03-09 02:57:19] - network test interval is empty, set to default value: [4h]
[2023-03-09 02:57:19] - cmd: /tmp/NeverIdle -c 2h  -n 4h
[2023-03-09 02:57:19] - NeverIdle [1093] is running
[2023-03-09 02:57:19] - log file: /tmp/NeverIdle.log
[2023-03-09 02:57:19] - ========================================
[2023-03-09 02:57:19] - run 'pkill NeverIdle' to stop it.
[2023-03-09 02:57:19] - run 'rm -f /tmp/NeverIdle /tmp/NeverIdle.log' to clean it.

 

 

추가) 재부팅 시 자동시작 스크립트 적용

vi neverIdle.sh

#!/bin/bash
sleep 20
screen -dmS NeverIdle /home/ubuntu/NeverIdle/NeverIdle -c 2h -m 2 -n 4h

chmod +x neverIdle.sh

crontab -e
@reboot /home/ubuntu/neverIdle.sh

 

해당 스크립트 제공은

https://github.com/layou233/NeverIdle

 

GitHub - layou233/NeverIdle: 资源定期浪费,可用于 Oracle 甲骨文保活。

资源定期浪费,可用于 Oracle 甲骨文保活。. Contribute to layou233/NeverIdle development by creating an account on GitHub.

github.com

감사합니다.

반응형