在 Bare Metal 解決方案上使用 Filestore 建立 Oracle 備份
本指南說明如何在適用於 Oracle 備份的 Bare Metal 解決方案中導入 Filestore。
Filestore 是全代管檔案儲存空間,可搭配 Bare Metal 解決方案使用。這項服務可擴充,並提供檔案系統中資料的一致檢視畫面。如要進一步瞭解 Filestore,請參閱 Filestore 總覽。
本指南假設您熟悉 Bare Metal 解決方案網路架構。
部署作業
在本指南中,我們會建立符合下列條件的部署作業:
- 合作夥伴互連網路會將 Bare Metal 解決方案伺服器連結至Google Cloud 專案。
- 合作夥伴互連網路設定可使用兩個 Cloud Router。
- Filestore 執行個體可在與 Bare Metal Solution 伺服器相同的 VPC 網路中使用。
- Bare Metal 解決方案伺服器可使用 NFS 連接埠 (111、2049、2050) 與 Filestore 檔案共用區通訊。
- Bare Metal 解決方案伺服器和 Filestore 執行個體會在 Cloud Router 中宣告預設 IP 範圍 (
0.0.0.0/0
),藉此瞭解彼此的 IP 範圍。
在這個部署範例中,Bare Metal 解決方案伺服器會託管在 Southamerica-east1
地區的 ops-peering-vpc
VPC 網路中。雲端路由器為 ops-peering-sp-router-a1
和 ops-peering-sp-router-a2
。
您可以將上述環境考量因素與自己的網路基礎架構連結,並據此修改部署作業。
在 Bare Metal 解決方案中實作 Filestore
在 Bare Metal 解決方案中實作 Filestore 需要執行下列步驟:
- 建立 Filestore 執行個體。
- 建立防火牆規則。
- 宣告預設路徑。
- 掛接 Filestore 檔案共用區。
- 驗證 Filestore 檔案共用區。
- 變更 NFS 掛接點的擁有權。
- 執行 RMAN 備份。
- 驗證備份。
建立 Filestore 執行個體
在與 Bare Metal 解決方案伺服器相同的網路和區域中建立 Filestore 執行個體。
請注意以下實作方式的考量事項:
- 區域和可用區:選取與裸機解決方案伺服器相同的區域和可用區。在本例中,地區為
southamerica-east1
,區域則為southamerica-east1-a
。 - VPC 網路:選取與裸機解決方案伺服器連線的網路。在這種情況下,請選取
ops-peering-vpc
。 - 已分配的 IP 範圍:如要使用網路中現有的已分配 IP 範圍,請選取「使用已分配的現有 IP 範圍」。否則,請選取「使用系統自動分配的 IP 範圍」,自動建立 IP 範圍和私人服務存取連線。
存取權控管:請執行下列操作:
- 選取「依據 IP 位址或範圍限制存取權」。
- 請輸入包含 Bare Metal 解決方案伺服器的 IP CIDR,讓 Filestore 能夠連線至 Bare Metal 解決方案伺服器。
選取存取層級。
建立防火牆規則
建立防火牆規則,讓 Bare Metal 解決方案伺服器連線至 Filestore 執行個體。
請注意以下實作方式的考量事項:
- 網路:選取虛擬私有雲網路。在這種情況下,請選取
ops-peering-vpc
。 - 優先順序:指定
1000
。 - 方向:選取
ingress
。 - IP 範圍:您可以允許存取網路中的所有 IP 位址,也可以限制存取裸機解決方案環境。
- 通訊協定和通訊埠:請按照下列步驟操作:
- 選取「Specified protocols and ports」。
- 選取「TCP」TCP。
- 輸入以逗號分隔的目標通訊埠清單 (111, 2049, 2050)。
宣告預設路徑
在 Cloud Router 中宣告預設路徑 (0.0.0.0/0
)。
請按照在 BGP 工作階段中為預設 IP 範圍新增自訂廣告中的步驟操作。
合作夥伴互連網路設定會附帶兩部 Cloud Router (在本例中為 ops-peering-sp-router-a1
和 ops-peering-sp-router-a2
)。您可以在任一路由器中宣傳預設路徑。不過,為確保高可用性和容錯性,建議您在兩個 Cloud Router 中宣告預設路徑。
掛接 Filestore 檔案共用區
在 Bare Metal 解決方案伺服器上掛接 Filestore 檔案共用區。
請以根使用者身分執行下列步驟:
在 Bare Metal 解決方案伺服器中,為 Filestore 檔案共用區建立 NFS 掛接點。
mkdir /nfs_backups
執行
mount
指令並指定 Filestore 執行個體 IP 位址和檔案共用區名稱,掛接檔案共用區。mount \ -o hard,vers=3,proto=tcp,timeo=600,retrans=3,rsize=1048576,wsize=1048576,resvport,async \ FILESTORE_IP_ADDRESS:/FILESTORE_FILE_SHARE /NFS_MOUNT_POINT
更改下列內容:
- FILESTORE_IP_ADDRESS:Filestore 執行個體的 IP 位址。
- FILESTORE_FILE_SHARE:Filestore 檔案共用項目的名稱。
- NFS_MOUNT_POINT:您在上一個步驟中建立的 NFS 掛接點名稱。
針對這個部署作業,請執行下列指令:
mount \ -o hard,vers=3,proto=tcp,timeo=600,retrans=3,rsize=1048576,wsize=1048576,resvport,async \ 10.177.199.242:/oracle_backups /nfs_backups
驗證 Filestore 檔案共用
如要驗證 Filestore 檔案共用,請執行下列指令:
df -h | grep FILESTORE_FILE_SHARE
oracle_backup_psoracle 1.0P 0 1.0P 0% /home/oracle/backups
10.177.199.242:/oracle_backups 2.5T 484G 1.9T 21% /nfs_backups
cd /nfs_backups
touch TEST_FILENAME
ls -ltr
total 16
drwx------. 2 root root 16384 Sep 16 03:43 lost+found
-rw-r--r--. 1 root root 0 Sep 16 2020 a
變更 NFS 掛接點的擁有權
變更 NFS 掛接點的擁有權。Filestore 檔案共用區會掛載為 root
。
在這種情況下,您可以使用檔案共用功能進行 Oracle Recovery Manager (RMAN) 備份。因此,您必須將 NFS 掛載點的擁有權變更為 oracle
使用者,並授予讀取和寫入所需的權限。
chown -R oracle:oinstall /nfs_backups
chmod -R 755 /nfs_backups
執行 RMAN 備份
在 Bare Metal 解決方案伺服器中掛載檔案共用後,您就可以使用該共用來執行 RMAN 備份。
執行下列指令:
rman target /
run
{
ALLOCATE CHANNEL c1 DEVICE TYPE disk format '/nfs_backups/%U';
ALLOCATE CHANNEL c2 DEVICE TYPE disk format '/nfs_backups/%U';
ALLOCATE CHANNEL c3 DEVICE TYPE disk format '/nfs_backups/%U';
ALLOCATE CHANNEL c4 DEVICE TYPE disk format '/nfs_backups/%U';
ALLOCATE CHANNEL c5 DEVICE TYPE disk format '/nfs_backups/%U';
ALLOCATE CHANNEL c6 DEVICE TYPE disk format '/nfs_backups/%U';
ALLOCATE CHANNEL c7 DEVICE TYPE disk format '/nfs_backups/%U';
ALLOCATE CHANNEL c8 DEVICE TYPE disk format '/nfs_backups/%U';
Backup section size 50G database;
}2> 3> 4> 5> 6> 7> 8> 9> 10> 11> 12> 13>
using target database control file instead of recovery catalog
allocated channel: c1
Finished backup at 24-SEP-20
Starting Control File and SPFILE Autobackup at 24-SEP-20
piece handle=+DATA/ORCL/AUTOBACKUP/2020_09_24/s_1051968470.603.1051968471 comment=NONE
Finished Control File and SPFILE Autobackup at 24-SEP-20
released channel: c1
released channel: c2
released channel: c3
released channel: c4
released channel: c5
released channel: c6
released channel: c7
released channel: c8
RMAN>
Recovery Manager complete.
驗證備份
驗證 NFS 掛接點目錄中的備份。請執行下列指令:
ls -ltr
total 507458532
drwxr-xr-x. 2 oracle oinstall 16384 Sep 16 03:43 lost+found
-rw-r-----. 1 oracle dba 5267456 Sep 24 13:05 javb7fcs_1_1
-rw-r-----. 1 oracle dba 2506752 Sep 24 13:05 jevb7fcs_1_1
-rw-r-----. 1 oracle dba 3956736 Sep 24 13:05 jdvb7fcs_1_1
-rw-r-----. 1 oracle dba 868564992 Sep 24 13:06 jcvb7fcs_1_1
-rw-r-----. 1 oracle dba 1778835456 Sep 24 13:06 jbvb7fcs_1_1
-rw-r-----. 1 oracle dba 53653921792 Sep 24 13:21 j9vb7fcs_4_1
-rw-r-----. 1 oracle dba 53684600832 Sep 24 13:21 j9vb7fcs_3_1
-rw-r-----. 1 oracle dba 53684584448 Sep 24 13:21 j9vb7fcs_5_1
-rw-r-----. 1 oracle dba 53682978816 Sep 24 13:22 j9vb7fcs_2_1
-rw-r-----. 1 oracle dba 53686919168 Sep 24 13:22 j9vb7fcs_1_1
-rw-r-----. 1 oracle dba 53686902784 Sep 24 13:22 j9vb7fcs_6_1
-rw-r-----. 1 oracle dba 81920 Sep 24 13:22 j9vb7fcs_11_1
-rw-r-----. 1 oracle dba 53687025664 Sep 24 13:22 j9vb7fcs_7_1
-rw-r-----. 1 oracle dba 53685944320 Sep 24 13:22 j9vb7fcs_8_1
-rw-r-----. 1 oracle dba 33838702592 Sep 24 13:28 j9vb7fcs_10_1
-rw-r-----. 1 oracle dba 53685944320 Sep 24 13:32 j9vb7fcs_9_1
您現在可以在 Bare Metal 解決方案伺服器的 Filestore 檔案共用區中建立 Oracle 備份。