Google वीपीएन के ज़रिए AlloyDB को Oracle से कनेक्ट करें

1. परिचय

कभी-कभी, वर्कलोड को कई वजहों से Oracle डेटाबेस से AlloyDB में ट्रांसफ़र नहीं किया जा सकता है. ऐसे मामलों में, अगर हमें रिपोर्टिंग या आगे की प्रोसेसिंग के लिए AlloyDB में डेटा उपलब्ध कराना है, तो हम Oracle FDW (Foreine Data Wrapper) का फ़ायदा उठा सकते हैं. Oracle FDW, रिमोट Oracle डेटाबेस से डेटा क्वेरी करने की सुविधा देता है और रिमोट डेटा को व्यू के ज़रिए प्रस्तुत करता है. इससे ऐसा लगता है कि यह AlloyDB के अंदर मौजूद है.

इस कोडलैब में, आप अपने AlloyDB के डेटाबेस को वीपीएन सेवा का इस्तेमाल करके किसी अलग नेटवर्क में डिप्लॉय किए गए Oracle डेटाबेस से जोड़ने के लिए Oracle FDW का इस्तेमाल करने का तरीका जानेंगे.

f920b8427b6fccb3.png

ऊपर दिए गए डायग्राम में, बाईं ओर AlloyDB क्लस्टर और GCE इंस्टेंस instance-1 को दिखाया गया है. यह डिफ़ॉल्ट नेटवर्क के साथ एक VPC में और GCE इंस्टेंस ora-xe-01, $PROJECT_ID-vpc-02 वाले किसी दूसरे VPC में डिप्लॉय किया गया है. पहला और दूसरा VPC, क्लाउड वीपीएन का इस्तेमाल करके, तय रूट के साथ कनेक्ट किए गए हैं. इससे Oracle और AlloyDB के इंस्टेंस एक-दूसरे से कनेक्ट हो पाते हैं.

VPN AlloyDB से Oracle पर VPN पर AlloyDB से लेकर Oracle

आपको Oracle FDW एक्सटेंशन के बारे में ज़्यादा जानकारी यहां मिल सकती है.

ज़रूरी शर्तें

  • Google Cloud, Console की बुनियादी जानकारी
  • कमांड-लाइन इंटरफ़ेस और Google शेल में इस्तेमाल होने वाले बुनियादी हुनर
  • PostgreSQL और Oracle डेटाबेस के बारे में बुनियादी जानकारी

आपको इनके बारे में जानकारी मिलेगी

  • AlloyDB Cluster डिप्लॉय करने का तरीका
  • AlloyDB से कैसे कनेक्ट करें
  • सैंपल Oracle डेटाबेस को कॉन्फ़िगर और डिप्लॉय करने का तरीका
  • दो VPC नेटवर्क के बीच वीपीएन सेट अप करने का तरीका
  • Oracle FDW एक्सटेंशन को कॉन्फ़िगर करने का तरीका

आपको इन चीज़ों की ज़रूरत होगी

  • Google Cloud खाता और Google Cloud प्रोजेक्ट
  • Chrome जैसा कोई वेब ब्राउज़र

2. सेटअप और ज़रूरी शर्तें

अपने हिसाब से एनवायरमेंट सेटअप करना

  1. Google Cloud Console में साइन इन करें और नया प्रोजेक्ट बनाएं या किसी मौजूदा प्रोजेक्ट का फिर से इस्तेमाल करें. अगर आपके पास पहले से Gmail या Google Workspace खाता नहीं है, तो आपको नया खाता बनाना होगा.

fbef9caa1602edd0.png

a99b7ace416376c4.png

5e3ff691252acf41.png

  • प्रोजेक्ट का नाम, इस प्रोजेक्ट में हिस्सा लेने वाले लोगों का डिसप्ले नेम होता है. यह एक वर्ण स्ट्रिंग है, जिसका इस्तेमाल Google API नहीं करता. इसे कभी भी अपडेट किया जा सकता है.
  • प्रोजेक्ट आईडी, Google Cloud के सभी प्रोजेक्ट के लिए यूनीक होता है. साथ ही, इसे बदला नहीं जा सकता. इसे सेट करने के बाद बदला नहीं जा सकता. Cloud Console, एक यूनीक स्ट्रिंग अपने-आप जनरेट करता है; आम तौर पर, आपको उसके होने की कोई परवाह नहीं होती. ज़्यादातर कोडलैब में, आपको अपना प्रोजेक्ट आईडी बताना होगा. आम तौर पर, इसकी पहचान PROJECT_ID के रूप में की जाती है. अगर आपको जनरेट किया गया आईडी पसंद नहीं है, तो किसी भी क्रम में एक और आईडी जनरेट किया जा सकता है. दूसरा तरीका यह है कि आप खुद भी आज़माकर देखें कि वह उपलब्ध है या नहीं. इस चरण के बाद, इसे बदला नहीं जा सकता. साथ ही, यह प्रोजेक्ट के खत्म होने तक बना रहता है.
  • आपकी जानकारी के लिए, प्रोजेक्ट नंबर नाम की एक तीसरी वैल्यू दी गई है. इसका इस्तेमाल कुछ एपीआई करते हैं. दस्तावेज़ में इन तीनों वैल्यू के बारे में ज़्यादा जानें.
  1. इसके बाद, आपको क्लाउड संसाधनों/एपीआई का इस्तेमाल करने के लिए, Cloud Console में बिलिंग चालू करनी होगी. इस कोडलैब का इस्तेमाल करने पर, आपको ज़्यादा पैसे नहीं चुकाने होंगे. इस ट्यूटोरियल के अलावा, बिलिंग से बचने के लिए संसाधनों को बंद करें. इसके लिए, अपने बनाए गए संसाधनों को मिटाएं या प्रोजेक्ट को मिटाएं. Google Cloud के नए उपयोगकर्ता, 300 डॉलर के मुफ़्त ट्रायल वाले प्रोग्राम में हिस्सा ले सकते हैं.

Cloud Shell शुरू करना

Google Cloud को आपके लैपटॉप से, कहीं से भी ऑपरेट किया जा सकता है. हालांकि, इस कोडलैब में Google Cloud Shell का इस्तेमाल किया जा रहा है. यह क्लाउड में चलने वाला कमांड लाइन एनवायरमेंट है.

Google Cloud Console में जाकर, सबसे ऊपर दाईं ओर मौजूद टूलबार पर क्लाउड शेल आइकॉन पर क्लिक करें:

55efc1aaa7a4d3ad.png

प्रावधान करने और एनवायरमेंट से कनेक्ट होने में कुछ ही समय लगेगा. उसके पूरा हो जाने पर, आपको कुछ ऐसा दिखाई देगा:

7ffe5cbb04455448.png

इस वर्चुअल मशीन में ऐसे सभी डेवलपमेंट टूल मौजूद हैं जिनकी आपको ज़रूरत पड़ेगी. यह पांच जीबी की स्थायी होम डायरेक्ट्री उपलब्ध कराता है और Google Cloud पर चलता है. यह नेटवर्क की परफ़ॉर्मेंस और पुष्टि करने की प्रक्रिया को बेहतर बनाता है. इस कोडलैब (कोड बनाना सीखना) में आपका सारा काम ब्राउज़र में किया जा सकता है. आपको कुछ भी इंस्टॉल करने की ज़रूरत नहीं है.

3. शुरू करने से पहले

एपीआई चालू करें

आउटपुट:

Cloud Shell में, पक्का करें कि आपका प्रोजेक्ट आईडी सेट अप हो:

gcloud config set project [YOUR-PROJECT-ID]
PROJECT_ID=$(gcloud config get-value project)

सभी ज़रूरी सेवाएं चालू करना:

gcloud services enable alloydb.googleapis.com \
                       compute.googleapis.com \
                       cloudresourcemanager.googleapis.com \
                       servicenetworking.googleapis.com \
                       vpcaccess.googleapis.com

अनुमानित आउटपुट

student@cloudshell:~ (gleb-test-short-004)$ gcloud services enable alloydb.googleapis.com \
                       compute.googleapis.com \
                       cloudresourcemanager.googleapis.com \
                       servicenetworking.googleapis.com \
                       vpcaccess.googleapis.com 
Operation "operations/acf.p2-404051529011-664c71ad-cb2b-4ab4-86c1-1f3157d70ba1" finished successfully.

अपने डिफ़ॉल्ट क्षेत्र को us-central1 या अपने लिए बेहतर विकल्प के तौर पर कॉन्फ़िगर करें. इस लैब में, हम us-central1 इलाके का इस्तेमाल करेंगे.

gcloud config set compute/region us-central1

4. AlloyDB क्लस्टर डिप्लॉय करें

AlloyDB क्लस्टर बनाने से पहले, हमें अपने VPC में एक निजी आईपी रेंज तय करनी होगी, ताकि आगे आने वाले AlloyDB के इंस्टेंस का इस्तेमाल किया जा सके. इसके बाद ही हम क्लस्टर और इंस्टेंस बना पाएंगे.

निजी आईपी रेंज बनाना

हमें AlloyDB के लिए अपने VPC में, निजी सेवा ऐक्सेस का कॉन्फ़िगरेशन कॉन्फ़िगर करना होगा. यहां यह माना जा रहा है कि हमारे पास "डिफ़ॉल्ट" प्रोजेक्ट में VPC नेटवर्क और इसका इस्तेमाल सभी कार्रवाइयों के लिए किया जाएगा.

निजी आईपी रेंज बनाएं:

gcloud compute addresses create psa-range \
    --global \
    --purpose=VPC_PEERING \
    --prefix-length=16 \
    --description="VPC private service access" \
    --network=default

तय की गई आईपी रेंज का इस्तेमाल करके निजी कनेक्शन बनाएं:

gcloud services vpc-peerings connect \
    --service=servicenetworking.googleapis.com \
    --ranges=psa-range \
    --network=default

कंसोल का अनुमानित आउटपुट:

student@cloudshell:~ (test-project-402417)$ gcloud compute addresses create psa-range \
    --global \
    --purpose=VPC_PEERING \
    --prefix-length=16 \
    --description="VPC private service access" \
    --network=default
Created [https://www.googleapis.com/compute/v1/projects/test-project-402417/global/addresses/psa-range].

student@cloudshell:~ (test-project-402417)$ gcloud services vpc-peerings connect \
    --service=servicenetworking.googleapis.com \
    --ranges=psa-range \
    --network=default
Operation "operations/pssn.p24-4470404856-595e209f-19b7-4669-8a71-cbd45de8ba66" finished successfully.

student@cloudshell:~ (test-project-402417)$

AllyDB क्लस्टर बनाएं

डिफ़ॉल्ट क्षेत्र में AlloyDB क्लस्टर बनाएं:

export PGPASSWORD=`openssl rand -hex 12`
export REGION=us-central1
export ADBCLUSTER=alloydb-aip-01
gcloud alloydb clusters create $ADBCLUSTER \
    --password=$PGPASSWORD \
    --network=default \
    --region=$REGION

कंसोल का अनुमानित आउटपुट:

student@cloudshell:~ (test-project-402417)$ export PGPASSWORD=`openssl rand -base64 12`
export REGION=us-central1
export ADBCLUSTER=alloydb-aip-01
gcloud alloydb clusters create $ADBCLUSTER \
    --password=$PGPASSWORD \
    --network=default \
    --region=$REGION
Operation ID: operation-1697655441138-6080235852277-9e7f04f5-2012fce4
Creating cluster...done.                                                                                                                                                                                                                                                           

आने वाले समय में इस्तेमाल करने के लिए, PostgreSQL पासवर्ड को नोट करें:

echo $PGPASSWORD

कंसोल का अनुमानित आउटपुट:

student@cloudshell:~ (test-project-402417)$ echo $PGPASSWORD
bbefbfde7601985b0dee5723

AlloyDB प्राइमरी इंस्टेंस बनाना

हमारे क्लस्टर के लिए AlloyDB का एक प्राथमिक इंस्टेंस बनाएं:

export REGION=us-central1
gcloud alloydb instances create $ADBCLUSTER-pr \
    --instance-type=PRIMARY \
    --cpu-count=2 \
    --region=$REGION \
    --cluster=$ADBCLUSTER

कंसोल का अनुमानित आउटपुट:

student@cloudshell:~ (test-project-402417)$ gcloud alloydb instances create $ADBCLUSTER-pr \
    --instance-type=PRIMARY \
    --cpu-count=2 \
    --region=$REGION \
    --availability-type ZONAL \
    --cluster=$ADBCLUSTER
Operation ID: operation-1697659203545-6080315c6e8ee-391805db-25852721
Creating instance...done.                                                                                                                                                                                                                                                     

5. AlloyDB से कनेक्ट करें

AlloyDB के साथ काम करने और डेटाबेस बनाने जैसे कमांड चलाने के लिए, एक्सटेंशन और अन्य को चालू करने के लिए हमें डेवलपमेंट एनवायरमेंट की ज़रूरत होती है. यह PostgreSQL के साथ काम करने वाला कोई भी स्टैंडर्ड टूल हो सकता है. इस मामले में, हम linux बॉक्स पर इंस्टॉल किए गए PostgreSQL के लिए स्टैंडर्ड क्लाइंट का इस्तेमाल करेंगे.

AlloyDB को सिर्फ़ निजी कनेक्शन का इस्तेमाल करके डिप्लॉय किया जाता है. इसलिए, हमें डेटाबेस के साथ काम करने के लिए ऐसी वीएम इंस्टॉल करनी होगी जिसमें PostgreSQL क्लाइंट हो.

GCE वीएम डिप्लॉय करना

उसी क्षेत्र में GCE वीएम बनाएं और VPC को AlloyDB क्लस्टर की तरह बनाएं.

Cloud Shell में ये काम करें:

export ZONE=us-central1-a
gcloud compute instances create instance-1 \
    --zone=$ZONE \
    --scopes=https://www.googleapis.com/auth/cloud-platform

कंसोल का अनुमानित आउटपुट:

student@cloudshell:~ (test-project-402417)$ export ZONE=us-central1-a
student@cloudshell:~ (test-project-402417)$ gcloud compute instances create instance-1 \
    --zone=$ZONE \
    --scopes=https://www.googleapis.com/auth/cloud-platform
Created [https://www.googleapis.com/compute/v1/projects/test-project-402417/zones/us-central1-a/instances/instance-1].
NAME: instance-1
ZONE: us-central1-a
MACHINE_TYPE: n1-standard-1
PREEMPTIBLE: 
INTERNAL_IP: 10.128.0.2
EXTERNAL_IP: 34.71.192.233
STATUS: RUNNING

Postgres इंस्टॉल करें क्लाइंट

डिप्लॉय की गई वीएम पर PostgreSQL क्लाइंट सॉफ़्टवेयर इंस्टॉल करें

वर्चुअल मशीन (वीएम) से कनेक्ट करें:

gcloud compute ssh instance-1 --zone=us-central1-a

कंसोल का अनुमानित आउटपुट:

student@cloudshell:~ (test-project-402417)$ gcloud compute ssh instance-1 --zone=us-central1-a
Updating project ssh metadata...working..Updated [https://www.googleapis.com/compute/v1/projects/test-project-402417].                                                                                                                                                         
Updating project ssh metadata...done.                                                                                                                                                                                                                                              
Waiting for SSH key to propagate.
Warning: Permanently added 'compute.5110295539541121102' (ECDSA) to the list of known hosts.
Linux instance-1 5.10.0-26-cloud-amd64 #1 SMP Debian 5.10.197-1 (2023-09-29) x86_64

The programs included with the Debian GNU/Linux system are free software;
the exact distribution terms for each program are described in the
individual files in /usr/share/doc/*/copyright.

Debian GNU/Linux comes with ABSOLUTELY NO WARRANTY, to the extent
permitted by applicable law.
student@instance-1:~$ 

वर्चुअल मशीन (वीएम) के अंदर चल रहे सॉफ़्टवेयर का कमांड इंस्टॉल करें:

sudo apt-get update
sudo apt-get install --yes postgresql-client

कंसोल का अनुमानित आउटपुट:

student@instance-1:~$ sudo apt-get update
sudo apt-get install --yes postgresql-client
Get:1 https://packages.cloud.google.com/apt google-compute-engine-bullseye-stable InRelease [5146 B]
Get:2 https://packages.cloud.google.com/apt cloud-sdk-bullseye InRelease [6406 B]   
Hit:3 https://deb.debian.org/debian bullseye InRelease  
Get:4 https://deb.debian.org/debian-security bullseye-security InRelease [48.4 kB]
Get:5 https://packages.cloud.google.com/apt google-compute-engine-bullseye-stable/main amd64 Packages [1930 B]
Get:6 https://deb.debian.org/debian bullseye-updates InRelease [44.1 kB]
Get:7 https://deb.debian.org/debian bullseye-backports InRelease [49.0 kB]
...redacted...
update-alternatives: using /usr/share/postgresql/13/man/man1/psql.1.gz to provide /usr/share/man/man1/psql.1.gz (psql.1.gz) in auto mode
Setting up postgresql-client (13+225) ...
Processing triggers for man-db (2.9.4-2) ...
Processing triggers for libc-bin (2.31-13+deb11u7) ...

इंस्टेंस से कनेक्ट करना

psql का इस्तेमाल करके, वीएम से मुख्य इंस्टेंस से कनेक्ट करें.

आपके इंस्टेंस-1 वीएम के लिए, उसी Cloud Shell टैब में खुले एसएसएच सेशन के साथ.

GCE (जीसीई) वीएम से AlloyDB से कनेक्ट करने के लिए, बताए गए AlloyDB पासवर्ड (PGपासवर्ड) की वैल्यू और AlloyDB क्लस्टर आईडी का इस्तेमाल करें:

export PGPASSWORD=<Noted password>
ADBCLUSTER=<your AlloyDB cluster name>
REGION=us-central1
INSTANCE_IP=$(gcloud alloydb instances describe $ADBCLUSTER-pr --cluster=$ADBCLUSTER --region=$REGION --format="value(ipAddress)")
export INSTANCE_IP=<AlloyDB Instance IP>
psql "host=$INSTANCE_IP user=postgres sslmode=require"

कंसोल का अनुमानित आउटपुट:

student@instance-1:~$ export PGPASSWORD=CQhOi5OygD4ps6ty
student@instance-1:~$ ADBCLUSTER=alloydb-aip-01
student@instance-1:~$ REGION=us-central1
student@instance-1:~$ INSTANCE_IP=$(gcloud alloydb instances describe $ADBCLUSTER-pr --cluster=$ADBCLUSTER --region=$REGION --format="value(ipAddress)")
gleb@instance-1:~$ psql "host=$INSTANCE_IP user=postgres sslmode=require"
psql (13.13 (Debian 13.13-0+deb11u1), server 14.7)
WARNING: psql major version 13, server major version 14.
         Some psql features might not work.
SSL connection (protocol: TLSv1.3, cipher: TLS_AES_256_GCM_SHA384, bits: 256, compression: off)
Type "help" for help.

postgres=> 

6. एक नमूना Oracle डेटाबेस बनाएं

हमारे सैंपल Oracle डेटाबेस को एक अलग VPC में डिप्लॉय किया जाएगा, ताकि यह बताया जा सके कि उसे परिसर में या AlloyDB क्लस्टर के VPC से अलग की गई किसी दूसरी जगह पर डिप्लॉय किया जाए.

दूसरा VPC बनाना

क्लाउड शेल के खुले टैब या Google Cloud SDK टूल वाले कमांड लाइन टर्मिनल का इस्तेमाल करके, ये काम किए जा सकते हैं:

PROJECT_ID=$(gcloud config get-value project)
REGION=us-central1
gcloud compute networks create $PROJECT_ID-vpc-02 --project=$PROJECT_ID --description=Custom\ VPC\ for\ $PROJECT_ID\ project --subnet-mode=custom --mtu=1460 --bgp-routing-mode=regional
gcloud compute networks subnets create $PROJECT_ID-vpc-02-$REGION --project=$PROJECT_ID --range=10.110.0.0/24 --stack-type=IPV4_ONLY --network=$PROJECT_ID-vpc-02 --region=$REGION

कंसोल का अनुमानित आउटपुट:

student@cloudshell:~ PROJECT_ID=$(gcloud config get-value project)
REGION=us-central1
gcloud compute networks create $PROJECT_ID-vpc-02 --project=$PROJECT_ID --description=Custom\ VPC\ for\ $PROJECT_ID\ project --subnet-mode=custom --mtu=1460 --bgp-routing-mode=regional
gcloud compute networks subnets create $PROJECT_ID-vpc-02-$REGION --project=$PROJECT_ID --range=10.110.0.0/24 --stack-type=IPV4_ONLY --network=$PROJECT_ID-vpc-02 --region=$REGION
Your active configuration is: [cloudshell-3726]
Created [https://www.googleapis.com/compute/v1/projects/test-project-402417/global/networks/test-project-402417-vpc-02].
NAME: test-project-402417-vpc-02
SUBNET_MODE: CUSTOM
BGP_ROUTING_MODE: REGIONAL
IPV4_RANGE: 
GATEWAY_IPV4: 

Instances on this network will not be reachable until firewall rules
are created. As an example, you can allow all internal traffic between
instances as well as SSH, RDP, and ICMP by running:

$ gcloud compute firewall-rules create <FIREWALL_NAME> --network test-project-402417-vpc-02 --allow tcp,udp,icmp --source-ranges <IP_RANGE>
$ gcloud compute firewall-rules create <FIREWALL_NAME> --network test-project-402417-vpc-02 --allow tcp:22,tcp:3389,icmp

Created [https://www.googleapis.com/compute/v1/projects/test-project-402417/regions/us-central1/subnetworks/test-project-402417-vpc-02-us-central1].
NAME: test-project-402417-vpc-02-us-central1
REGION: us-central1
NETWORK: test-project-402417-vpc-02
RANGE: 10.110.0.0/24
STACK_TYPE: IPV4_ONLY
IPV6_ACCESS_TYPE: 

बुनियादी गड़बड़ी की जानकारी और एसएसएच कनेक्शन के लिए, दूसरे VPC में फ़ायरवॉल के कम से कम नियम कॉन्फ़िगर करें.

gcloud compute firewall-rules create $PROJECT_ID-vpc-02-allow-icmp --project=$PROJECT_ID --network=$PROJECT_ID-vpc-02 --description=Allows\ ICMP\ connections\ from\ any\ source\ to\ any\ instance\ on\ the\ network. --direction=INGRESS --priority=65534 --source-ranges=0.0.0.0/0 --action=ALLOW --rules=icmp
gcloud compute firewall-rules create $PROJECT_ID-vpc-02-allow-ssh --project=$PROJECT_ID --network=$PROJECT_ID-vpc-02 --description=Allows\ TCP\ connections\ from\ any\ source\ to\ any\ instance\ on\ the\ network\ using\ port\ 22. --direction=INGRESS --priority=65534 --source-ranges=0.0.0.0/0 --action=ALLOW --rules=tcp:22

कंसोल का अनुमानित आउटपुट:

student@cloudshell:~ gcloud compute firewall-rules create $PROJECT_ID-vpc-02-allow-icmp --project=$PROJECT_ID --network=$PROJECT_ID-vpc-02 --description=Allows\ ICMP\ connections\ from\ any\ source\ to\ any\ instance\ on\ the\ network. --direction=INGRESS --priority=65534 --source-ranges=0.0.0.0/0 --action=ALLOW --rules=icmp
gcloud compute firewall-rules create $PROJECT_ID-vpc-02-allow-ssh --project=$PROJECT_ID --network=$PROJECT_ID-vpc-02 --description=Allows\ TCP\ connections\ from\ any\ source\ to\ any\ instance\ on\ the\ network\ using\ port\ 22. --direction=INGRESS --priority=65534 --source-ranges=0.0.0.0/0 --action=ALLOW --rules=tcp:22
Creating firewall...working..Created [https://www.googleapis.com/compute/v1/projects/test-project-402417/global/firewalls/test-project-402417-vpc-02-allow-icmp].                                                                                         
Creating firewall...done.                                                                                                                                                                                                                     
NAME: test-project-402417-vpc-02-allow-icmp
NETWORK: test-project-402417-vpc-02
DIRECTION: INGRESS
PRIORITY: 65534
ALLOW: icmp
DENY: 
DISABLED: False
Creating firewall...working..Created [https://www.googleapis.com/compute/v1/projects/test-project-402417/global/firewalls/test-project-402417-vpc-02-allow-ssh].                                                                                          
Creating firewall...done.                                                                                                                                                                                                                     
NAME: test-project-402417-vpc-02-allow-ssh
NETWORK: test-project-402417-vpc-02
DIRECTION: INGRESS
PRIORITY: 65534
ALLOW: tcp:22
DENY: 
DISABLED: False

इंटरनल सबनेट के बीच डेटाबेस पोर्ट को कनेक्ट करने की अनुमति देने के लिए, डिफ़ॉल्ट और दूसरे VPC में फ़ायरवॉल के नियम कॉन्फ़िगर करें.

ALLOYDB_NET_IP_RANGES=$(gcloud compute networks subnets list --network=default --filter="region:us-central1" --format="value(ipCidrRange)"),$(gcloud compute addresses list --filter="name:psa-range AND network:default" --format="value(address_range())")
gcloud compute firewall-rules create default-allow-postgres --project=$PROJECT_ID --network=default --description=Allows\ Postgres\ connections\ from\ local\ networks\ to\ postgres\ instance\ on\ the\ network\ using\ port\ 5432. --direction=INGRESS --priority=65534 --source-ranges=10.110.0.0/24 --action=ALLOW --rules=tcp:5432
gcloud compute firewall-rules create $PROJECT_ID-vpc-02-allow-oracle --project=$PROJECT_ID --network=$PROJECT_ID-vpc-02 --description=Allows\ Oracle\ connections\ from\ local\ networks\ to\ Oracle\ instance\ on\ the\ network\ using\ port\ 1521. --direction=INGRESS --priority=65534 --source-ranges=$ALLOYDB_NET_IP_RANGES --action=ALLOW --rules=tcp:1521

कंसोल का अनुमानित आउटपुट:

student@cloudshell:~ ALLOYDB_NET_IP_RANGES=$(gcloud compute networks subnets list --network=default --filter="region:us-central1" --format="value(ipCidrRange)"),$(gcloud compute addresses list --filter="name:psa-range AND network:default" --format="value(address_range())")
gcloud compute firewall-rules create default-allow-postgres --project=$PROJECT_ID --network=default --description=Allows\ Postgres\ connections\ from\ local\ networks\ to\ postgres\ instance\ on\ the\ network\ using\ port\ 5432. --direction=INGRESS --priority=65534 --source-ranges=10.110.0.0/24 --action=ALLOW --rules=tcp:5432
gcloud compute firewall-rules create $PROJECT_ID-vpc-02-allow-oracle --project=$PROJECT_ID --network=$PROJECT_ID-vpc-02 --description=Allows\ Oracle\ connections\ from\ local\ networks\ to\ Oracle\ instance\ on\ the\ network\ using\ port\ 1521. --direction=INGRESS --priority=65534 --source-ranges=$ALLOYDB_NET_IP_RANGES --action=ALLOW --rules=tcp:1521
Creating firewall...working..Created [https://www.googleapis.com/compute/v1/projects/test-project-402417/global/firewalls/default-allow-postgres].                                                                                                  
Creating firewall...done.                                                                                                                                                                                                                     
NAME: default-allow-postgres
NETWORK: default
DIRECTION: INGRESS
PRIORITY: 65534
ALLOW: tcp:5432
DENY: 
DISABLED: False
Creating firewall...working..Created [https://www.googleapis.com/compute/v1/projects/test-project-402417/global/firewalls/test-project-402417-vpc-02-allow-oracle].                                                                                       
Creating firewall...done.                                                                                                                                                                                                                     
NAME: test-project-402417-vpc-02-allow-oracle
NETWORK: test-project-402417-vpc-02
DIRECTION: INGRESS
PRIORITY: 65534
ALLOW: tcp:1521
DENY: 
DISABLED: False

दूसरे VPC में GCE (जीसीई) वीएम डिप्लॉय करें

हमारे नमूना Oracle एनवायरमेंट के लिए, दूसरे VPC सबनेट का इस्तेमाल करके GCE वीएम को डिप्लॉय करना. इस कंप्यूट इंस्टेंस का इस्तेमाल हमारे टेस्ट Oracle एनवायरमेंट के तौर पर किया जाएगा. Oracle XE डेटाबेस बाइनरी यहां इंस्टॉल की जाएंगी और इंस्टेंस का इस्तेमाल सर्वर के रूप में और Oracle के खास टास्क के लिए क्लाइंट के तौर पर किया जाएगा.

वीएम बनाने के लिए, उसी क्लाउड शेल या टर्मिनल का इस्तेमाल करके कमांड चलाएं:

SERVER_NAME=ora-xe-01
PROJECT_ID=$(gcloud config get-value project)
REGION=us-central1
ZONE=us-central1-a
MACHINE_TYPE=e2-standard-2
SUBNET=$PROJECT_ID-vpc-02-$REGION
DISK_SIZE=50
gcloud compute instances create $SERVER_NAME --project=$PROJECT_ID --zone=$ZONE --machine-type=$MACHINE_TYPE --network-interface=subnet=$SUBNET --create-disk=auto-delete=yes,boot=yes,size=$DISK_SIZE,image=projects/debian-cloud/global/images/$(gcloud compute images list --filter="family=debian-11 AND family!=debian-11-arm64" \
    --format="value(name)"),type=pd-ssd

कंसोल का अनुमानित आउटपुट:

student@cloudshell:~ SERVER_NAME=ora-xe-01
PROJECT_ID=$(gcloud config get-value project)
REGION=us-central1
ZONE=us-central1-a
MACHINE_TYPE=e2-standard-2
SUBNET=$PROJECT_ID-vpc-02-$REGION
DISK_SIZE=50
gcloud compute instances create $SERVER_NAME --project=$PROJECT_ID --zone=$ZONE --machine-type=$MACHINE_TYPE --network-interface=subnet=$SUBNET --create-disk=auto-delete=yes,boot=yes,size=$DISK_SIZE,image=projects/debian-cloud/global/images/$(gcloud compute images list --filter="family=debian-11 AND family!=debian-11-arm64" \
    --format="value(name)"),type=pd-ssd
Your active configuration is: [cloudshell-3726]
Created [https://www.googleapis.com/compute/v1/projects/test-project-402417/zones/us-central1-a/instances/ora-xe-01].
WARNING: Some requests generated warnings:
 - Disk size: '50 GB' is larger than image size: '10 GB'. You might need to resize the root repartition manually if the operating system does not support automatic resizing. See https://cloud.google.com/compute/docs/disks/add-persistent-disk#resize_pd for details.

NAME: ora-xe-01
ZONE: us-central1-a
MACHINE_TYPE: e2-standard-2
PREEMPTIBLE: 
INTERNAL_IP: 10.110.0.2
EXTERNAL_IP: 34.121.117.216
STATUS: RUNNING

Oracle XE बनाएं

परीक्षणों के लिए Oracle Express Edition (XE) का उपयोग किया जाएगा. कृपया ध्यान रखें कि Oracle XE कंटेनर के इस्तेमाल पर, Oracle XE नियम और शर्तें लाइसेंस की शर्तें लागू होती हैं.

एसएसएच का इस्तेमाल करके, बनाई गई वीएम से कनेक्ट करें:

gcloud compute ssh $SERVER_NAME --zone=$ZONE

एसएसएच सेशन में, Oracle XE के डॉकर टाइप के डिप्लॉयमेंट के लिए ज़रूरी पैकेज डिप्लॉय करें. Oracle दस्तावेज़ में आप अन्य परिनियोजन विकल्पों के बारे में पढ़ सकते हैं.

sudo apt-get update
sudo apt-get -y install ca-certificates curl gnupg lsb-release
sudo mkdir -m 0755 -p /etc/apt/keyrings
curl -fsSL https://download.docker.com/linux/debian/gpg | sudo gpg --dearmor -o /etc/apt/keyrings/docker.gpg
echo "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.gpg] https://download.docker.com/linux/debian $(lsb_release -cs) stable" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null
sudo apt-get update
sudo apt-get -y install docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin
sudo usermod -aG docker $USER

कंसोल का अनुमानित आउटपुट (छिपाने के लिए बदलाव किया गया):

student@ora-xe-01:~$ sudo apt-get update
sudo apt-get -y install ca-certificates curl gnupg lsb-release
sudo mkdir -m 0755 -p /etc/apt/keyrings
curl -fsSL https://download.docker.com/linux/debian/gpg | sudo gpg --dearmor -o /etc/apt/keyrings/docker.gpg
echo "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.gpg] https://download.docker.com/linux/debian $(lsb_release -cs) stable" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null
sudo apt-get update
sudo apt-get -y install docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin
sudo usermod -aG docker $USER
Get:1 https://packages.cloud.google.com/apt google-compute-engine-bullseye-stable InRelease [5146 B]
Get:2 https://packages.cloud.google.com/apt cloud-sdk-bullseye InRelease [6406 B] 
...
Setting up git (1:2.30.2-1+deb11u2) ...
Processing triggers for man-db (2.9.4-2) ...
Processing triggers for libc-bin (2.31-13+deb11u7) ...
student@ora-xe-01:~$ 

वीएम से फिर से कनेक्ट करने के लिए, लॉग आउट करके फिर से कनेक्ट करें.

exit
gcloud compute ssh $SERVER_NAME --zone=$ZONE

कंसोल का अनुमानित आउटपुट:

student@ora-xe-01:~$ exit
logout
Connection to 34.132.87.73 closed.
student@cloudshell:~ (test-project-002-410214)$ gcloud compute ssh $SERVER_NAME --zone=$ZONE
Linux ora-xe-01 5.10.0-26-cloud-amd64 #1 SMP Debian 5.10.197-1 (2023-09-29) x86_64

The programs included with the Debian GNU/Linux system are free software;
the exact distribution terms for each program are described in the
individual files in /usr/share/doc/*/copyright.

Debian GNU/Linux comes with ABSOLUTELY NO WARRANTY, to the extent
permitted by applicable law.
Last login: Thu Jan  4 14:51:25 2024 from 34.73.112.191
student@ora-xe-01:~$

नए SSH सेशन में ora-xe-01 को एक्ज़ीक्यूट करें:

ORACLE_PWD=`openssl rand -hex 12`
echo $ORACLE_PWD
docker run -d --name oracle-xe -p 1521:1521 -e ORACLE_PWD=$ORACLE_PWD container-registry.oracle.com/database/express:21.3.0-xe

कंसोल का अनुमानित आउटपुट:

student@ora-xe-01:~$ ORACLE_PWD=`openssl rand -hex 12`
echo $ORACLE_PWD
docker run -d --name oracle-xe -p 1521:1521 -e ORACLE_PWD=$ORACLE_PWD container-registry.oracle.com/database/express:21.3.0-xe

e36e191b6c298ce6e02a614c
Unable to find image 'container-registry.oracle.com/database/express:21.3.0-xe' locally
21.3.0-xe: Pulling from database/express
2318ff572021: Pull complete 
c6250726c822: Pull complete 
33ac5ea7f7dd: Pull complete 
753e0fae7e64: Pull complete 
Digest: sha256:dcf137aab02d5644aaf9299aae736e4429f9bfdf860676ff398a1458ab8d23f2
Status: Downloaded newer image for container-registry.oracle.com/database/express:21.3.0-xe
9f74e2d37bf49b01785338495e02d79c55c92e4ddd409eddcf45e754fd9044d9

अपनी ORACLE_PWD वैल्यू को रिकॉर्ड करें, ताकि इसे बाद में यूज़र सिस्टम के तौर पर डेटाबेस से कनेक्ट करने के लिए इस्तेमाल किया जा सके और sys.

सैंपल स्कीमा इंस्टॉल करना

स्टैंडर्ड HR सैंपल स्कीमा का इस्तेमाल करके, इंस्टॉल किए गए डेटाबेस में सैंपल डेटासेट बनाएं.

एक ही एसएसएच सेशन में:

git clone https://github.com/oracle-samples/db-sample-schemas.git
curl -O https://download.oracle.com/otn_software/java/sqldeveloper/sqlcl-latest.zip
sudo apt-get install -y unzip openjdk-17-jdk
unzip sqlcl-latest.zip
echo 'export PATH=$HOME/sqlcl/bin:$PATH' >>.bashrc 
exec $SHELL

कंसोल का अनुमानित आउटपुट:

student@ora-xe-01:~$ git clone https://github.com/oracle-samples/db-sample-schemas.git
curl -O https://download.oracle.com/otn_software/java/sqldeveloper/sqlcl-latest.zip
sudo apt-get install -y unzip openjdk-17-jdk
unzip sqlcl-latest.zip
echo 'export PATH=$HOME/sqlcl/bin:$PATH' >>.bashrc 
exec $SHELL
Cloning into 'db-sample-schemas'...
remote: Enumerating objects: 624, done.
remote: Counting objects: 100% (104/104), done.
...
  inflating: sqlcl/lib/sshd-contrib.jar  
  inflating: sqlcl/lib/sshd-putty.jar  
  inflating: sqlcl/lib/dbtools-sqlcl-distribution.jar  
student@ora-xe-01:~$

एक ही एसएसएच सेशन में:

ORACLE_PWD=<your noted password from the previous step>
cd db-sample-schemas/human_resources/
sql system/$ORACLE_PWD@localhost/XEPDB1 @hr_install.sql

HR स्कीमा के लिए एक पासवर्ड डालें (कोई भी मज़बूत पासवर्ड काफ़ी होगा) और प्रॉम्प्ट में सुझाए गए डिफ़ॉल्ट टेबलस्पेस को स्वीकार करें.

कंसोल का अनुमानित आउटपुट:

student@ora-xe-01:~$ ORACLE_PWD=e36e191b6c298ce6e02a614c
student@ora-xe-01:~$ cd db-sample-schemas/human_resources/
sql system/$ORACLE_PWD@localhost/XEPDB1 @hr_install.sql


SQLcl: Release 23.3 Production on Wed Jan 03 14:38:14 2024

Copyright (c) 1982, 2024, Oracle.  All rights reserved.

Last Successful login time: Wed Jan 03 2024 14:38:17 +00:00

Connected to:
Oracle Database 21c Express Edition Release 21.0.0.0.0 - Production
Version 21.3.0.0.0


Thank you for installing the Oracle Human Resources Sample Schema.
This installation script will automatically exit your database session
at the end of the installation or if any error is encountered.
The entire installation will be logged into the 'hr_install.log' log file.

Enter a password for the user HR: ************************


Enter a tablespace for HR [USERS]: 
Do you want to overwrite the schema, if it already exists? [YES|no]: 
******  Creating REGIONS table ....

Table REGIONS created.
... 
Table             provided    actual 
______________ ___________ _________ 
regions                  5         5 
countries               25        25 
departments             27        27 
locations               23        23 
employees              107       107 
jobs                    19        19 
job_history             10        10 

Thank you!                                                  
___________________________________________________________ 
The installation of the sample schema is now finished.      
Please check the installation verification output above.    
                                                            
You will now be disconnected from the database.             
                                                            
Thank you for using Oracle Database!                        
                                                            
Disconnected from Oracle Database 21c Express Edition Release 21.0.0.0.0 - Production
Version 21.3.0.0.0

Oracle FDW के लिए उपयोगकर्ता बनाएं

आसानी के लिए, हम एक उपयोगकर्ता POSTGRES बनाएंगे - जो डिफ़ॉल्ट PostgreSQL उपयोगकर्ता के जैसा ही होगा.

Oracle डेटाबेस से उपयोगकर्ता SYS के रूप में कनेक्ट करें:

sql sys/$ORACLE_PWD@localhost/XEPDB1 as sysdba

SQL सत्र में जब उपयोगकर्ता SYS निष्पादित करता है (उपयोगकर्ता के लिए POSTGRES_ORA_PWD को अपने पासवर्ड से बदलें):

create user postgres identified by POSTGRES_ORA_PWD;

साथ ही, उपयोगकर्ता को ज़रूरी अधिकार दें:

grant connect, select any table to postgres;
grant select on v_$SQL_PLAN to postgres;
grant select on v_$SQL to postgres;

कंसोल का अनुमानित आउटपुट:

student@ora-xe-01:~/db-sample-schemas/human_resources$ sql sys/$ORACLE_PWD@localhost/XEPDB1 as sysdba


SQLcl: Release 23.3 Production on Wed Jan 03 14:42:37 2024

Copyright (c) 1982, 2024, Oracle.  All rights reserved.

Connected to:
Oracle Database 21c Express Edition Release 21.0.0.0.0 - Production
Version 21.3.0.0.0

SQL> create user postgres identified by VeryStrongPassword0011##;

User POSTGRES created.

SQL> grant connect, select any table to postgres;

Grant succeeded.

SQL> grant select on v_$SQL_PLAN to postgres;

Grant succeeded.

SQL> grant select on v_$SQL to postgres;

Grant succeeded.

SQL> 

7. VPC के बीच वीपीएन बनाएं

हर VPC में डिप्लॉय किए गए संसाधन, उस नेटवर्क के सिर्फ़ अंदरूनी आईपी पते देख सकते हैं. साथ ही, यह किसी दूसरे VPC में मौजूद किसी इंटरनल संसाधन से कनेक्ट नहीं कर सकते. Google Cloud VPN, दो VPC के बीच एक ब्रिज बनाता है. इससे, Oracle डेटाबेस के साथ हमारे वीएम को AlloyDB के इंस्टेंस से कनेक्ट करने और कनेक्ट करने की अनुमति मिलती है. वीपीएन कनेक्शन में कई कॉम्पोनेंट शामिल होते हैं. जैसे, Cloud राऊटर, गेटवे, वीपीएन टनल, और BGP सेशन. यहां हम दो VPC के बीच, ज़्यादा उपलब्ध वीपीएन के लिए ज़रूरी सभी कॉम्पोनेंट बनाने और उन्हें कॉन्फ़िगर करने के बारे में जानेंगे. Google Cloud VPN के बारे में ज़्यादा जानने के लिए, दस्तावेज़ पढ़ें.

रूटर और गेटवे बनाना

दोनों VPC में, क्लाउड राऊटर और वीपीएन गेटवे बनाएं.

Cloud शेल या Cloud SDK वाले टर्मिनल में ये काम करें:

PROJECT_ID=$(gcloud config get-value project)
REGION=us-central1
gcloud compute routers create $PROJECT_ID-vpc-01-router --project=$PROJECT_ID --region=$REGION --network=default --asn=64520 --advertisement-mode=custom --set-advertisement-groups=all_subnets
gcloud compute routers create $PROJECT_ID-vpc-02-router --project=$PROJECT_ID --region=$REGION --network=$PROJECT_ID-vpc-02 --asn=64521 --advertisement-mode=custom --set-advertisement-groups=all_subnets

कंसोल का अनुमानित आउटपुट:

student@cloudshell:~ (test-project-402417)$ PROJECT_ID=$(gcloud config get-value project)
REGION=us-central1
gcloud compute routers create $PROJECT_ID-vpc-01-router --project=$PROJECT_ID --region=$REGION --network=default --asn=64520 --advertisement-mode=custom --set-advertisement-groups=all_subnets
gcloud compute routers create $PROJECT_ID-vpc-02-router --project=$PROJECT_ID --region=$REGION --network=$PROJECT_ID-vpc-02 --asn=64521 --advertisement-mode=custom --set-advertisement-groups=all_subnets
Your active configuration is: [cloudshell-18870]
Creating router [test-project-402417-vpc-01-router]...done.                                                                                                                                                                                         
NAME: test-project-402417-vpc-01-router
REGION: us-central1
NETWORK: default
Creating router [test-project-402417-vpc-02-router]...done.                                                                                                                                                                                         
NAME: test-project-402417-vpc-02-router
REGION: us-central1
NETWORK: test-project-402417-vpc-02

दोनों VPC में वीपीएन गेटवे बनाएं:

PROJECT_ID=$(gcloud config get-value project)
gcloud compute vpn-gateways create $PROJECT_ID-vpc-01-vpn-gtw --project=$PROJECT_ID --region=$REGION --network=default
gcloud compute vpn-gateways create $PROJECT_ID-vpc-02-vpn-gtw --project=$PROJECT_ID --region=$REGION --network=$PROJECT_ID-vpc-02

कंसोल का अनुमानित आउटपुट:

student@cloudshell:~ (test-project-402417)$ gcloud compute vpn-gateways create $PROJECT_ID-vpc-01-vpn-gtw --project=$PROJECT_ID --region=$REGION --network=default
gcloud compute vpn-gateways create $PROJECT_ID-vpc-02-vpn-gtw --project=$PROJECT_ID --region=$REGION --network=$PROJECT_ID-vpc-02
Creating VPN Gateway...done.                                                                                                                                                                                                                  
NAME: test-project-402417-vpc-01-vpn-gtw
INTERFACE0: 35.242.106.28
INTERFACE1: 35.220.86.122
INTERFACE0_IPV6: 
INTERFACE1_IPV6: 
NETWORK: default
REGION: us-central1
Creating VPN Gateway...done.                                                                                                                                                                                                                  
NAME: test-project-402417-vpc-02-vpn-gtw
INTERFACE0: 35.242.116.197
INTERFACE1: 35.220.68.53
INTERFACE0_IPV6: 
INTERFACE1_IPV6: 
NETWORK: test-project-402417-vpc-02
REGION: us-central1
student@cloudshell:~ (test-project-402417)$ 

वीपीएन टनल बनाना

हम हर VPC के लिए, वीपीएन टनल के जोड़े के साथ एक एचए कॉन्फ़िगरेशन बनाएंगे.

Cloud शेल या SDK टूल वाले टर्मिनल में, ये काम किए जा सकते हैं:

PROJECT_ID=$(gcloud config get-value project)
SHARED_SECRET=`openssl rand -base64 24`
gcloud compute vpn-tunnels create $PROJECT_ID-vpc-01-vpn-tunnel-01 --shared-secret=$SHARED_SECRET  --peer-gcp-gateway=$PROJECT_ID-vpc-02-vpn-gtw --ike-version=2 --router=$PROJECT_ID-vpc-01-router --vpn-gateway=$PROJECT_ID-vpc-01-vpn-gtw --project=$PROJECT_ID --region=$REGION --interface=0
gcloud compute vpn-tunnels create $PROJECT_ID-vpc-01-vpn-tunnel-02 --shared-secret=$SHARED_SECRET  --peer-gcp-gateway=$PROJECT_ID-vpc-02-vpn-gtw --ike-version=2 --router=$PROJECT_ID-vpc-01-router --vpn-gateway=$PROJECT_ID-vpc-01-vpn-gtw --project=$PROJECT_ID --region=$REGION --interface=1
gcloud compute vpn-tunnels create $PROJECT_ID-vpc-02-vpn-tunnel-01 --shared-secret=$SHARED_SECRET  --peer-gcp-gateway=$PROJECT_ID-vpc-01-vpn-gtw --ike-version=2 --router=$PROJECT_ID-vpc-02-router --vpn-gateway=$PROJECT_ID-vpc-02-vpn-gtw --project=$PROJECT_ID --region=$REGION --interface=0
gcloud compute vpn-tunnels create $PROJECT_ID-vpc-02-vpn-tunnel-02 --shared-secret=$SHARED_SECRET  --peer-gcp-gateway=$PROJECT_ID-vpc-01-vpn-gtw --ike-version=2 --router=$PROJECT_ID-vpc-02-router --vpn-gateway=$PROJECT_ID-vpc-02-vpn-gtw --project=$PROJECT_ID --region=$REGION --interface=1

कंसोल का अनुमानित आउटपुट:

student@cloudshell:~ (test-project-402417)$ SHARED_SECRET=`openssl rand -base64 24`
gcloud compute vpn-tunnels create $PROJECT_ID-vpc-01-vpn-tunnel-01 --shared-secret=$SHARED_SECRET  --peer-gcp-gateway=$PROJECT_ID-vpc-02-vpn-gtw --ike-version=2 --router=$PROJECT_ID-vpc-01-router --vpn-gateway=$PROJECT_ID-vpc-01-vpn-gtw --project=$PROJECT_ID --region=$REGION --interface=0
gcloud compute vpn-tunnels create $PROJECT_ID-vpc-01-vpn-tunnel-02 --shared-secret=$SHARED_SECRET  --peer-gcp-gateway=$PROJECT_ID-vpc-02-vpn-gtw --ike-version=2 --router=$PROJECT_ID-vpc-01-router --vpn-gateway=$PROJECT_ID-vpc-01-vpn-gtw --project=$PROJECT_ID --region=$REGION --interface=1
gcloud compute vpn-tunnels create $PROJECT_ID-vpc-02-vpn-tunnel-01 --shared-secret=$SHARED_SECRET  --peer-gcp-gateway=$PROJECT_ID-vpc-01-vpn-gtw --ike-version=2 --router=$PROJECT_ID-vpc-02-router --vpn-gateway=$PROJECT_ID-vpc-02-vpn-gtw --project=$PROJECT_ID --region=$REGION --interface=0
gcloud compute vpn-tunnels create $PROJECT_ID-vpc-02-vpn-tunnel-02 --shared-secret=$SHARED_SECRET  --peer-gcp-gateway=$PROJECT_ID-vpc-01-vpn-gtw --ike-version=2 --router=$PROJECT_ID-vpc-02-router --vpn-gateway=$PROJECT_ID-vpc-02-vpn-gtw --project=$PROJECT_ID --region=$REGION --interface=1
Creating VPN tunnel...done.                                                                                                                                                                                                                   
NAME: test-project-402417-vpc-01-vpn-tunnel-01
REGION: us-central1
GATEWAY: test-project-402417-vpc-01-vpn-gtw
VPN_INTERFACE: 0
PEER_ADDRESS: 35.242.116.197
Creating VPN tunnel...done.                                                                                                                                                                                                                   
NAME: test-project-402417-vpc-01-vpn-tunnel-02
REGION: us-central1
GATEWAY: test-project-402417-vpc-01-vpn-gtw
VPN_INTERFACE: 1
PEER_ADDRESS: 35.220.68.53
Creating VPN tunnel...done.                                                                                                                                                                                                                   
NAME: test-project-402417-vpc-02-vpn-tunnel-01
REGION: us-central1
GATEWAY: test-project-402417-vpc-02-vpn-gtw
VPN_INTERFACE: 0
PEER_ADDRESS: 35.242.106.28
Creating VPN tunnel...done.                                                                                                                                                                                                                   
NAME: test-project-402417-vpc-02-vpn-tunnel-02
REGION: us-central1
GATEWAY: test-project-402417-vpc-02-vpn-gtw
VPN_INTERFACE: 1
PEER_ADDRESS: 35.220.86.122

बीजीपी सेशन बनाना

बॉर्डर गेटवे प्रोटोकॉल (बीजीपी) सेशन, VPC के बीच उपलब्ध रूट की जानकारी का लेन-देन करके डाइनैमिक रूटिंग की अनुमति देते हैं.

पहले (डिफ़ॉल्ट) नेटवर्क पर, BGP पीयर की पहली जोड़ी बनाएं. मिलते-जुलते ऐप्लिकेशन के आईपी पतों का इस्तेमाल, दूसरे VPC में बनाए गए BGP के लिए किया जाएगा.

Cloud शेल या SDK टूल वाले टर्मिनल में, ये काम किए जा सकते हैं:

PROJECT_ID=$(gcloud config get-value project)
gcloud compute routers add-interface $PROJECT_ID-vpc-01-router --interface-name=$PROJECT_ID-vpc-01-router-bgp-if-0 --vpn-tunnel=$PROJECT_ID-vpc-01-vpn-tunnel-01 --region=$REGION
gcloud compute routers add-bgp-peer $PROJECT_ID-vpc-01-router --peer-name=$PROJECT_ID-vpc-01-vpn-tunnel-01-bgp --interface=$PROJECT_ID-vpc-01-router-bgp-if-0 --peer-asn=64521 --region=$REGION
gcloud compute routers add-interface $PROJECT_ID-vpc-01-router --interface-name=$PROJECT_ID-vpc-01-router-bgp-if-1 --vpn-tunnel=$PROJECT_ID-vpc-01-vpn-tunnel-02 --region=$REGION
gcloud compute routers add-bgp-peer $PROJECT_ID-vpc-01-router --peer-name=$PROJECT_ID-vpc-01-vpn-tunnel-02-bgp --interface=$PROJECT_ID-vpc-01-router-bgp-if-1 --peer-asn=64521 --region=$REGION

कंसोल का अनुमानित आउटपुट:

student@cloudshell:~ (test-project-402417)$ gcloud compute routers add-interface $PROJECT_ID-vpc-01-router --interface-name=$PROJECT_ID-vpc-01-router-bgp-if-0 --vpn-tunnel=$PROJECT_ID-vpc-01-vpn-tunnel-01 --region=$REGION
gcloud compute routers add-bgp-peer $PROJECT_ID-vpc-01-router --peer-name=$PROJECT_ID-vpc-01-vpn-tunnel-01-bgp --interface=$PROJECT_ID-vpc-01-router-bgp-if-0 --peer-asn=64521 --region=$REGION
gcloud compute routers add-interface $PROJECT_ID-vpc-01-router --interface-name=$PROJECT_ID-vpc-01-router-bgp-if-1 --vpn-tunnel=$PROJECT_ID-vpc-01-vpn-tunnel-02 --region=$REGION
gcloud compute routers add-bgp-peer $PROJECT_ID-vpc-01-router --peer-name=$PROJECT_ID-vpc-01-vpn-tunnel-02-bgp --interface=$PROJECT_ID-vpc-01-router-bgp-if-1 --peer-asn=64521 --region=$REGION
Updated [https://www.googleapis.com/compute/v1/projects/test-project-402417/regions/us-central1/routers/test-project-402417-vpc-01-router].
Creating peer [test-project-402417-vpc-01-vpn-tunnel-01-bgp] in router [test-project-402417-vpc-01-router]...done.                                                                                                                                        
Updated [https://www.googleapis.com/compute/v1/projects/test-project-402417/regions/us-central1/routers/test-project-402417-vpc-01-router].
Creating peer [test-project-402417-vpc-01-vpn-tunnel-02-bgp] in router [test-project-402417-vpc-01-router]...done.                                                                                                                                        
student@cloudshell:~ (test-project-402417)$

दूसरे VPC में BGP जोड़ें:

REGION=us-central1
PROJECT_ID=$(gcloud config get-value project)
gcloud compute routers add-interface $PROJECT_ID-vpc-02-router --interface-name=$PROJECT_ID-vpc-02-router-bgp-if-0 --vpn-tunnel=$PROJECT_ID-vpc-02-vpn-tunnel-01 --ip-address=$(gcloud compute routers describe $PROJECT_ID-vpc-01-router --format="value(bgpPeers[0].peerIpAddress)" --region=$REGION) --mask-length=30 --region=$REGION 
gcloud compute routers add-bgp-peer $PROJECT_ID-vpc-02-router --peer-name=$PROJECT_ID-vpc-02-vpn-tunnel-01-bgp --interface=$PROJECT_ID-vpc-01-router-bgp-if-0 --peer-ip-address=$(gcloud compute routers describe $PROJECT_ID-vpc-01-router --format="value(bgpPeers[0].ipAddress)" --region=$REGION) --peer-asn=64520 --region=$REGION
gcloud compute routers add-interface $PROJECT_ID-vpc-02-router --interface-name=$PROJECT_ID-vpc-02-router-bgp-if-1 --vpn-tunnel=$PROJECT_ID-vpc-02-vpn-tunnel-02 --ip-address=$(gcloud compute routers describe $PROJECT_ID-vpc-01-router --format="value(bgpPeers[1].peerIpAddress)" --region=$REGION) --mask-length=30 --region=$REGION
gcloud compute routers add-bgp-peer $PROJECT_ID-vpc-02-router --peer-name=$PROJECT_ID-vpc-02-vpn-tunnel-02-bgp --interface=$PROJECT_ID-vpc-01-router-bgp-if-1 --peer-ip-address=$(gcloud compute routers describe $PROJECT_ID-vpc-01-router --format="value(bgpPeers[1].ipAddress)" --region=$REGION) --peer-asn=64520 --region=$REGION

कंसोल का अनुमानित आउटपुट:

student@cloudshell:~ (test-project-402417)$ REGION=us-central1
PROJECT_ID=$(gcloud config get-value project)
gcloud compute routers add-interface $PROJECT_ID-vpc-02-router --interface-name=$PROJECT_ID-vpc-02-router-bgp-if-0 --vpn-tunnel=$PROJECT_ID-vpc-02-vpn-tunnel-01 --ip-address=$(gcloud compute routers describe $PROJECT_ID-vpc-01-router --format="value(bgpPeers[0].peerIpAddress)" --region=$REGION) --mask-length=30 --region=$REGION 
gcloud compute routers add-bgp-peer $PROJECT_ID-vpc-02-router --peer-name=$PROJECT_ID-vpc-02-vpn-tunnel-01-bgp --interface=$PROJECT_ID-vpc-01-router-bgp-if-0 --peer-ip-address=$(gcloud compute routers describe $PROJECT_ID-vpc-01-router --format="value(bgpPeers[0].ipAddress)" --region=$REGION) --peer-asn=64520 --region=$REGION
gcloud compute routers add-interface $PROJECT_ID-vpc-02-router --interface-name=$PROJECT_ID-vpc-02-router-bgp-if-1 --vpn-tunnel=$PROJECT_ID-vpc-02-vpn-tunnel-02 --ip-address=$(gcloud compute routers describe $PROJECT_ID-vpc-01-router --format="value(bgpPeers[1].peerIpAddress)" --region=$REGION) --mask-length=30 --region=$REGION
gcloud compute routers add-bgp-peer $PROJECT_ID-vpc-02-router --peer-name=$PROJECT_ID-vpc-02-vpn-tunnel-02-bgp --interface=$PROJECT_ID-vpc-01-router-bgp-if-1 --peer-ip-address=$(gcloud compute routers describe $PROJECT_ID-vpc-01-router --format="value(bgpPeers[1].ipAddress)" --region=$REGION) --peer-asn=64520 --region=$REGION
Your active configuration is: [cloudshell-18870]
Updated [https://www.googleapis.com/compute/v1/projects/test-project-402417/regions/us-central1/routers/test-project-402417-vpc-02-router].
Creating peer [test-project-402417-vpc-02-vpn-tunnel-01-bgp] in router [test-project-402417-vpc-02-router]...done.                                                                                                                                        
Updated [https://www.googleapis.com/compute/v1/projects/test-project-402417/regions/us-central1/routers/test-project-402417-vpc-02-router].
Creating peer [test-project-402417-vpc-02-vpn-tunnel-02-bgp] in router [test-project-402417-vpc-02-router]...done.

बीजीपी में कस्टम रूट जोड़ना

अब हमें BGP को अपनी सेवा के लिए, निजी आईपी रेंज का विज्ञापन देना है

Cloud Shell में:

PROJECT_ID=$(gcloud config get-value project)
gcloud compute routers update $PROJECT_ID-vpc-01-router --add-advertisement-ranges=$(gcloud compute addresses list --filter="name:psa-range AND network:default" --format="value(address_range())") --region=$REGION
gcloud compute networks peerings update servicenetworking-googleapis-com --network=default --import-custom-routes --export-custom-routes

कंसोल का अनुमानित आउटपुट (छिपाने के लिए बदलाव किया गया):

PROJECT_ID=$(gcloud config get-value project)
gcloud compute routers update $PROJECT_ID-vpc-01-router --add-advertisement-ranges=$(gcloud compute addresses list --filter="name:psa-range AND network:default" --format="value(address_range())") --region=$REGION
gcloud compute networks peerings update servicenetworking-googleapis-com --network=default --import-custom-routes --export-custom-routes
...

8. AlloyDB में Oracle FDW कॉन्फ़िगर करें

अब हम जांच के लिए डेटाबेस बना सकते हैं और Oracle FDW एक्सटेंशन को कॉन्फ़िगर कर सकते हैं. हम दूसरे चरण में बनाए गए इंस्टेंस-1 वीएम और AlloyDB क्लस्टर के लिए बताए गए पासवर्ड का इस्तेमाल करेंगे.

डेटाबेस बनाएं

इंस्टेंस-1 GCE (जीसीई) वीएम से कनेक्ट करें:

ZONE=us-central1-a
gcloud compute ssh instance-1 --zone=$ZONE  

एसएसएच सेशन में, इसे एक्ज़ीक्यूट करें:

export PGPASSWORD=<Noted password>
REGION=us-central1
ADBCLUSTER=alloydb-aip-01
INSTANCE_IP=$(gcloud alloydb instances describe $ADBCLUSTER-pr --cluster=$ADBCLUSTER --region=$REGION --format="value(ipAddress)")
psql "host=$INSTANCE_IP user=postgres" -c "CREATE DATABASE quickstart_db"

कंसोल का अनुमानित आउटपुट:

student@instance-1:~$ export PGPASSWORD=6dd7fKHnMId8RM97
student@instance-1:~$ REGION=us-central1
ADBCLUSTER=alloydb-aip-01
INSTANCE_IP=$(gcloud alloydb instances describe $ADBCLUSTER-pr --cluster=$ADBCLUSTER --region=$REGION --format="value(ipAddress)")
psql "host=$INSTANCE_IP user=postgres" -c "CREATE DATABASE quickstart_db"
CREATE DATABASE
student@instance-1:~$  

Oracle FDW एक्सटेंशन कॉन्फ़िगर करें

नए बनाए गए डेटाबेस में Oracle FDW एक्सटेंशन को चालू करें.

एक ही एसएसएच सेशन में, इसे लागू करें:

psql -h $INSTANCE_IP -U postgres -d quickstart_db -c "create extension if not exists oracle_fdw cascade"

कंसोल का अनुमानित आउटपुट:

student@instance-1:~$ psql "host=$INSTANCE_IP user=postgres dbname=quickstart_db" -c "create extension if not exists oracle_fdw cascade"
CREATE EXTENSION
student@instance-1:~$ 

Oracle FDW कॉन्फ़िगर करें

हम Oracle डेटाबेस में HR सैंपल स्कीमा के साथ काम करने के लिए Oracle FDW को कॉन्फ़िगर करने वाले उसी एसएसएच सेशन में काम करते रहेंगे.

दूसरे VPC में, हमारे Oracle XE VM के लिए इंटरनल आईपी पते का इस्तेमाल करके FDW सर्वर कॉन्फ़िगरेशन बनाएं.

इंस्टेंस-1 से उसी एसएसएच सेशन में इसे एक्ज़ीक्यूट करें:

ORACLE_SERVER_IP=$(gcloud compute instances list --filter="name=(ora-xe-01)" --format="value(networkInterfaces[0].networkIP)")
psql -h $INSTANCE_IP -U postgres -d quickstart_db -c "create server ora_xe foreign data wrapper oracle_fdw options (dbserver '$ORACLE_SERVER_IP:1521/xepdb1')"

कंसोल का अनुमानित आउटपुट:

student@instance-1:~$ ORACLE_SERVER_IP=$(gcloud compute instances list --filter="name=(ora-xe-01)" --format="value(networkInterfaces[0].networkIP)")
psql -h $INSTANCE_IP -U postgres -d quickstart_db -c "create server ora_xe foreign data wrapper oracle_fdw options (dbserver '$ORACLE_SERVER_IP:1521/xepdb1')"
CREATE SERVER 

पोस्टग्रेज़ उपयोगकर्ता को बनाए गए सर्वर का इस्तेमाल करने की मंज़ूरी दें.

psql -h $INSTANCE_IP -U postgres -d quickstart_db -c "grant usage on foreign server ora_xe to postgres"

कंसोल का अनुमानित आउटपुट:

student@instance-1:~$ psql -h $INSTANCE_IP -U postgres -d quickstart_db -c "grant usage on foreign server ora_xe to postgres"
GRANT

Oracle डेटाबेस में उपयोगकर्ता के लिए सेट किए गए पासवर्ड का इस्तेमाल करके PostgreSQL में उपयोगकर्ता और Oracle डेटाबेस उपयोगकर्ता के बीच मैपिंग बनाएं. हमारे द्वारा पहले बनाए गए Oracle उपयोगकर्ता POSTGRES के लिए नोट किए गए पासवर्ड का उपयोग करें (POSTGRES_ORA_PWD).

POSTGRES_ORA_PWD=<your password for the oracle user postgres>
psql -h $INSTANCE_IP -U postgres -d quickstart_db -c "CREATE USER MAPPING FOR postgres SERVER ora_xe OPTIONS ( USER 'postgres', PASSWORD '$POSTGRES_ORA_PWD')"

कंसोल का अनुमानित आउटपुट:

student@instance-1:~$ POSTGRES_ORA_PWD=VeryStrongPassword0011##
student@instance-1:~$ psql -h $INSTANCE_IP -U postgres -d quickstart_db -c "CREATE USER MAPPING FOR postgres SERVER ora_xe OPTIONS ( USER 'postgres', PASSWORD '$POSTGRES_ORA_PWD')"
CREATE USER MAPPING

9. एचआर स्कीमा के साथ Oracle FDW का इस्तेमाल करना

अब हम Oracle डेटाबेस में डेटा के साथ अपने Oracle FDW का इस्तेमाल कर सकते हैं.

Oracle HR स्कीमा की परिभाषाएं इंपोर्ट करें

हम AlloyDB के साथ काम करने के लिए psql का इस्तेमाल करके अपने Postgres क्लाइंट वीएम पर काम करना जारी रखेंगे.

वीएम एसएसएच सेशन में, ये काम करें:

psql -h $INSTANCE_IP -U postgres -d quickstart_db -c "create schema ora_exe_hr";
psql -h $INSTANCE_IP -U postgres -d quickstart_db -c "import foreign schema \"HR\" from server ora_xe into ora_exe_hr";

अनुमानित आउटपुट (छिपाने के लिए बदलाव किया गया):

student@instance-1:~$ psql -h $INSTANCE_IP -U postgres -d quickstart_db -c "create schema ora_exe_hr";
psql -h $INSTANCE_IP -U postgres -d quickstart_db -c "import foreign schema \"HR\" from server ora_xe into ora_exe_hr";
CREATE SCHEMA
IMPORT FOREIGN SCHEMA
student@instance-1:~$ 

Oracle FDW की जांच करना

आइए, एक सैंपल एसक्यूएल स्टेटमेंट चलाएं.

डेटाबेस से कनेक्ट करें. वीएम एसएसएच सेशन में, ये काम करें:

psql -h $INSTANCE_IP -U postgres -d quickstart_db

PSQL सेशन में, कोई चुनें स्टेटमेंट चलाएं.

select * from ora_exe_hr.countries limit 5;

अनुमानित आउटपुट:

student@instance-1:~$ psql -h $INSTANCE_IP -U postgres -d quickstart_db
psql (13.13 (Debian 13.13-0+deb11u1), server 14.7)
WARNING: psql major version 13, server major version 14.
         Some psql features might not work.
SSL connection (protocol: TLSv1.3, cipher: TLS_AES_256_GCM_SHA384, bits: 256, compression: off)
Type "help" for help.

quickstart_db=> select * from ora_exe_hr.countries limit 5;
 country_id | country_name | region_id 
------------+--------------+-----------
 AR         | Argentina    |        20
 AU         | Australia    |        40
 BE         | Belgium      |        10
 BR         | Brazil       |        20
 CA         | Canada       |        20
(5 rows)

quickstart_db=>

यह नतीजे दिखाता है और इसका मतलब है कि हमारा कॉन्फ़िगरेशन ठीक से काम कर रहा है.

आपके पास बाकी टेबल के साथ एक्सपेरिमेंट करने का विकल्प है.

10. पर्यावरण साफ़ करें

अब सभी टास्क पूरे होने के बाद, हम अपने आस-पास की जगह को साफ़ कर सकते हैं. इसके अलावा, ग़ैर-ज़रूरी बिलिंग को रोकने के लिए कॉम्पोनेंट को खराब किया जा सकता है.

लैब में काम पूरा करने के बाद, AlloyDB के इंस्टेंस और क्लस्टर खत्म करें

AlloyDB क्लस्टर और सभी इंस्टेंस मिटाना

क्लस्टर को विकल्प बल के साथ नष्ट कर दिया जाता है. इससे क्लस्टर से जुड़े सभी इंस्टेंस भी मिट जाते हैं.

अगर आपके डिसकनेक्ट हो गए हैं और पिछली सभी सेटिंग खो गई हैं, तो क्लाउड शेल में प्रोजेक्ट और एनवायरमेंट वैरिएबल तय करें:

gcloud config set project <your project id>
export REGION=us-central1
export ADBCLUSTER=alloydb-aip-01
export PROJECT_ID=$(gcloud config get-value project)

क्लस्टर मिटाएं:

gcloud alloydb clusters delete $ADBCLUSTER --region=$REGION --force

कंसोल का अनुमानित आउटपुट:

student@cloudshell:~ (test-project-001-402417)$ gcloud alloydb clusters delete $ADBCLUSTER --region=$REGION --force
All of the cluster data will be lost when the cluster is deleted.

Do you want to continue (Y/n)?  Y

Operation ID: operation-1697820178429-6082890a0b570-4a72f7e4-4c5df36f
Deleting cluster...done.   

AlloyDB के बैकअप मिटाना

क्लस्टर के लिए सभी AlloyDB के बैकअप मिटाएं:

for i in $(gcloud alloydb backups list --filter="CLUSTER_NAME: projects/$PROJECT_ID/locations/$REGION/clusters/$ADBCLUSTER" --format="value(name)" --sort-by=~createTime) ; do gcloud alloydb backups delete $(basename $i) --region $REGION --quiet; done

कंसोल का अनुमानित आउटपुट:

student@cloudshell:~ (test-project-001-402417)$ for i in $(gcloud alloydb backups list --filter="CLUSTER_NAME: projects/$PROJECT_ID/locations/$REGION/clusters/$ADBCLUSTER" --format="value(name)" --sort-by=~createTime) ; do gcloud alloydb backups delete $(basename $i) --region $REGION --quiet; done
Operation ID: operation-1697826266108-60829fb7b5258-7f99dc0b-99f3c35f
Deleting backup...done.                                                                                                                                                                                                                                                            

अब हम अपनी वर्चुअल मशीन (वीएम) को बंद कर सकते हैं

GCE (जीसीई) वीएम मिटाना

Cloud Shell में ये काम करें:

export GCEVM=instance-1
export ZONE=us-central1-a
gcloud compute instances delete $GCEVM \
    --zone=$ZONE \
    --quiet

कंसोल का अनुमानित आउटपुट:

student@cloudshell:~ (test-project-001-402417)$ export GCEVM=instance-1
export ZONE=us-central1-a
gcloud compute instances delete $GCEVM \
    --zone=$ZONE \
    --quiet
Deleted 

Oracle XE की मदद से वीएम मिटाना

Cloud Shell में ये काम करें:

SERVER_NAME=ora-xe-01
ZONE=us-central1-a
gcloud compute instances delete $SERVER_NAME \
    --zone=$ZONE \
    --quiet

कंसोल का अनुमानित आउटपुट:

student@cloudshell:~ (test-project-402417)$ SERVER_NAME=ora-xe-01
ZONE=us-central1-a
gcloud compute instances delete $SERVER_NAME \
    --zone=$ZONE \
    --quiet
Deleted [https://www.googleapis.com/compute/v1/projects/test-project-402417/zones/us-central1-a/instances/ora-xe-01].
student@cloudshell:~ (test-project-402417)$

वीपीएन मिटाना

Cloud Shell में ये काम करें:

REGION=us-central1
PROJECT_ID=$(gcloud config get-value project)
gcloud compute vpn-tunnels delete $PROJECT_ID-vpc-01-vpn-tunnel-01 --region=$REGION --quiet
gcloud compute vpn-tunnels delete $PROJECT_ID-vpc-01-vpn-tunnel-02 --region=$REGION --quiet
gcloud compute vpn-tunnels delete $PROJECT_ID-vpc-02-vpn-tunnel-01 --region=$REGION --quiet
gcloud compute vpn-tunnels delete $PROJECT_ID-vpc-02-vpn-tunnel-02 --region=$REGION --quiet
gcloud compute routers delete $PROJECT_ID-vpc-02-router --region=$REGION --quiet
gcloud compute routers delete $PROJECT_ID-vpc-01-router --region=$REGION --quiet
gcloud compute vpn-gateways delete $PROJECT_ID-vpc-01-vpn-gtw --region=$REGION --quiet
gcloud compute vpn-gateways delete $PROJECT_ID-vpc-02-vpn-gtw --region=$REGION --quiet

कंसोल का अनुमानित आउटपुट:

student@cloudshell:~ (test-project-402417)$ REGION=us-central1
PROJECT_ID=$(gcloud config get-value project)
gcloud compute vpn-tunnels delete $PROJECT_ID-vpc-01-vpn-tunnel-01 --region=$REGION --quiet
gcloud compute vpn-tunnels delete $PROJECT_ID-vpc-01-vpn-tunnel-02 --region=$REGION --quiet
gcloud compute vpn-tunnels delete $PROJECT_ID-vpc-02-vpn-tunnel-01 --region=$REGION --quiet
gcloud compute vpn-tunnels delete $PROJECT_ID-vpc-02-vpn-tunnel-02 --region=$REGION --quiet
gcloud compute routers delete $PROJECT_ID-vpc-02-router --region=$REGION --quiet
gcloud compute routers delete $PROJECT_ID-vpc-01-router --region=$REGION --quiet
gcloud compute vpn-gateways delete $PROJECT_ID-vpc-01-vpn-gtw --region=$REGION --quiet
gcloud compute vpn-gateways delete $PROJECT_ID-vpc-02-vpn-gtw --region=$REGION --quiet
Your active configuration is: [cloudshell-18870]
Deleting VPN tunnel...done.                                                                                                                                                                                                                   
Deleting VPN tunnel...done.                                                                                                                                                                                                                   
Deleting VPN tunnel...done.                                                                                                                                                                                                                   
Deleting VPN tunnel...done.                                                                                                                                                                                                                   
Deleted [https://www.googleapis.com/compute/v1/projects/test-project-402417/regions/us-central1/routers/test-project-402417-vpc-02-router].
Deleted [https://www.googleapis.com/compute/v1/projects/test-project-402417/regions/us-central1/routers/test-project-402417-vpc-01-router].
Deleting VPN Gateway...done.                                                                                                                                                                                                                  
Deleting VPN Gateway...done.
student@cloudshell:~ (test-project-402417)$ 

दूसरा VPC मिटाना

Cloud Shell में ये काम करें:

REGION=us-central1
PROJECT_ID=$(gcloud config get-value project)
gcloud compute firewall-rules delete $PROJECT_ID-vpc-02-allow-icmp --quiet
gcloud compute firewall-rules delete $PROJECT_ID-vpc-02-allow-ssh --quiet
gcloud compute firewall-rules delete default-allow-postgres --quiet
gcloud compute firewall-rules delete $PROJECT_ID-vpc-02-allow-oracle --quiet
gcloud compute networks subnets delete $PROJECT_ID-vpc-02-$REGION --region=$REGION --quiet
gcloud compute networks delete $PROJECT_ID-vpc-02 --quiet

कंसोल का अनुमानित आउटपुट:

student@cloudshell:~ (test-project-402417)$ gcloud compute firewall-rules delete $PROJECT_ID-vpc-02-allow-icmp --quiet
gcloud compute firewall-rules delete $PROJECT_ID-vpc-02-allow-ssh --quiet
gcloud compute firewall-rules delete default-allow-postgres --quiet
gcloud compute firewall-rules delete $PROJECT_ID-vpc-02-allow-oracle --quiet
gcloud compute networks subnets delete $PROJECT_ID-vpc-02-$REGION --region=$REGION --quiet
gcloud compute networks delete $PROJECT_ID-vpc-02 --quiet
Deleted [https://www.googleapis.com/compute/v1/projects/test-project-402417/global/firewalls/test-project-402417-vpc-02-allow-icmp].
Deleted [https://www.googleapis.com/compute/v1/projects/test-project-402417/global/firewalls/test-project-402417-vpc-02-allow-ssh].
Deleted [https://www.googleapis.com/compute/v1/projects/test-project-402417/global/firewalls/default-allow-postgres].
Deleted [https://www.googleapis.com/compute/v1/projects/test-project-402417/global/firewalls/test-project-402417-vpc-02-allow-oracle].
gcloud compute networks subnets delete $PROJECT_ID-vpc-02-$REGION --region=$REGION --quiet
gcloud compute networks delete $PROJECT_ID-vpc-02 --quiet

11. बधाई हो

कोडलैब पूरा करने के लिए बधाई.

इसमें हमने इन विषयों के बारे में बताया

  • AlloyDB Cluster डिप्लॉय करने का तरीका
  • AlloyDB से कैसे कनेक्ट करें
  • सैंपल Oracle डेटाबेस को कॉन्फ़िगर और डिप्लॉय करने का तरीका
  • दो VPC नेटवर्क के बीच वीपीएन सेट अप करने का तरीका
  • Oracle FDW एक्सटेंशन को कॉन्फ़िगर करने का तरीका

12. सर्वे

आउटपुट:

इस ट्यूटोरियल का इस्तेमाल कैसे किया जाएगा?

सिर्फ़ इसे पढ़ें इसे पढ़ें और कसरतों को पूरा करें