顯示具有 Cloud 標籤的文章。 顯示所有文章
顯示具有 Cloud 標籤的文章。 顯示所有文章

3月 11, 2025

Google Cloud 災難復原

最後處理方式:手動重建 instance

前幾天突然想到 GCP 上跑的機台很舊了(Debian9, 2018),嘗試升級 Debian 10 後就炸了!無法遠端連線(SSH)而且資料庫主程式損毀無法動啟,幸好有留下資料庫檔(.frm/.ibd)。

1. 先到「GCP Compute Engine / 磁碟」複製一份原本的磁碟檔,避免破壞既有資料

2. 建立新的執行個體,主系統選 Debian12 並且額外連接現有磁碟(上述複製碟)

3. 開機掛載分割區,安裝與置換 MariaDB 資料夾
# 新機台安裝資料庫系統並嘗試匯出資料
# apt-get install mariadb-server
# lsblk
# mount /dev/sdb1 /mnt/rescue
# /etc/init.d/mariadb stop
# mv /var/lib/mysql /var/lib/_mysql
# cp -R /mnt/rescue/var/lib/mysql /var/lib/ -R
# chown -R mysql:mysql mysql 
# /etc/init.d/mariadb start
#
# 匯出資料庫檔案
# mysqldump -u db_user -p --default-character-set=utf8 mydb > mydb_backup.sql
4. 維持使用 Debian9 系統 --
「Compute Engine / 映像檔」顯示已淘汰的映像檔,可選擇過期映像檔(debian-9-stretch-v20220621)並建立執行個體

5. 最初掛載 Debian12 到原本 instance 時顯示錯誤訊息 UEFI setting must be the same for the instance and the boot disk. 所以最後只能停留在舊的 Debian9 映像檔;使用 GCP 好處就是 instance 與 disk 是分開的,可以隨意配接取出資料。

1月 03, 2024

在 Oracle Cloud 上安裝 Alpine Linux

1. 建立一個以 Ubuntu 為作業系統的虛擬機(當作空殼)

2. 到 Alpine Linux 官網下載 VIRTUAL 版本的映像檔。例如 alpine-virt-3.19.0-x86_64.iso

3. 刷入映像檔

# sudo dd if=alpine-virt-3.19.0-x86_64.iso of=/dev/sda

4. 重新開機

5. 使用 Oracle Cloud 主控台連線(console)操作,進行安裝前準備

# mkdir /media/setup
# cp -a /media/sda/* /media/setup
# mkdir /lib/setup
# cp -a /.modloop/* /lib/setup
# /etc/init.d/modloop stop
# umount /dev/sda
# mv /media/setup/* /media/sda/
# mv /lib/setup/* /.modloop/
6. 循原本方式進行系統安裝(setup-alpine),網路介面直接用 eth0(dhcp)。安裝後驚人的空間使用(僅150MB)

1月 01, 2024

在 Oracle Cloud 建立首個虛擬主機

Oracle Cloud 資安要求嚴謹,首次註冊即強制要求啟動雙因子驗證。每次登入除了帳號密碼外,皆需搭配特定手機軟體(Oracle Mobile Authenticator)方能進入主控台。

主控台最基礎操作就從建立虛擬機(VM compute instance)開始,節點會以用戶的家鄉區(Home Region)作為預設值。基本上 Always Free 方案能選的項目不多,處理器部份固定是 E2.micro 然後作業系統有 Oracle Linux,Ubuntu, CentOS 等。

12月 27, 2023

Oracle 雲端免費資源(Cloud Always Free)

Oracle Cloud 相較於 Google Cloud Platform(GCP) 除了同樣提供免費運算資源外,機房區域多了東京可以選擇,對於亞太區傳輸延遲顯得更有優勢。另外 Oracle Cloud 登入強制啟用 2FA(Oracle Mobile Authenticator) 認證!

The Home Region(家鄉區)
When you sign up for Oracle Cloud Infrastructure, Oracle creates a tenancy for you in one region. This is your home region. Your home region is where your IAM resources are defined. Your home region contains your account information and identity resources.It is not changeable after your tenancy is provisioned. (區域列表)
Always Free Resources
All Oracle Cloud Infrastructure accounts (whether free or paid) have a set of resources that are free of charge in the home region of the tenancy, for the life of the account. These resources display the Always Free label in the Console (for Ampere A1 Compute shapes, see Compute). (圖例)
Compute(免費運算節點只能在家鄉區建立!)
All tenancies get a set of Always Free resources in the Compute service for creating compute virtual machine (VM) instances. You must create the Always Free compute instances in your home region.
  • Micro instances (AMD processor): All tenancies get up to two Always Free VM instances using the VM.Standard.E2.1.Micro shape, which has an AMD processor.(節點規格, 流量計價)
  • Ampere A1 Compute instances (Arm processor): All tenancies get the first 3,000 OCPU hours and 18,000 GB hours per month for free for VM instances using the VM.Standard.A1.Flex shape, which has an Arm processor.
Idle Compute Instances(閒置的節點會被收回)
Idle Always Free compute instances may be reclaimed by Oracle. Oracle will deem virtual machine and bare metal compute instances as idle if, during a 7-day period, the following are true:
  • CPU utilization for the 95th percentile is less than 20%
  • Network utilization is less than 20%
  • Memory utilization is less than 20% (applies to A1 shapes only)