oracle cloud instance 살리기

잘 동작하던 오라클 클라우드 인스턴스가 어느날 갑자기 부팅되지 않아서 상당히 난감했었는데, 아래 방법을 통해서 살릴 수 있었다.

Instances -> [dead instance] -> Boot volume -> [dead boot volume] -> Boot Volume Backups -> Create Boot Volume Backup

create new instance and new boot volume

Instances -> [new instance] -> Attached block volumes -> Attach block volume -> Select volume -> select [backup boot volume]

새로운 instance 의 shell 로 접속해서 sudo fdisk -l 하면 /dev/sdb1에 backup boot volume이 보임

mkdir /media/olddisk
sudo mount /dev/sdb1 /media/olddisk

/media/olddisk로 접속해서 데이터 살리기

sudo umount /media/olddisk

Instances -> [new instance] -> Attached block volumes -> detatch [backup boot volume]

참고. mysql 살리기

cp /media/olddisk/usr/sbin/mysqld /usr/sbin/
cp /media/olddisk/usr/bin/mysql* /usr/bin/
cp -r /media/olddisk/var/lib/mysql /var/lib/
cp -r mysql-files /var/lib/
cp -r mysql-keyring /var/lib/
cp -r mysql-upgrade /var/lib/
sudo apt install mysql-server

How to use localtunnel in PM2

$ vi pm2-lt.yaml
apps:
  - name : 'localtunnel'
    script: 'lt'
    args: '-p <port> -s <subdomain>'
    instances: '1'
    autorestart: true
    max_restarts: 10
    max_memory_restart: '500M'
    watch : false
    error_file: 'err-prod.log'
    out_file: 'out-prod.log'
    log_file: 'combined-prod.log'
// replace <port>, <subdomain> as you want
$ pm2 start pm2-lt.yaml
$ pm2 save