21. Create and Manage AlloyDB Instances: Challenge Lab
2024. 12. 3. 09:09ㆍ클라우드/GCP
Task 1. Create a cluster and instance
gcloud beta alloydb clusters create lab-cluster \ --password=Change3Me \ --network=peering-network \ --region=us-central1 \ --project=qwiklabs-gcp-00-9180b9934581 |
cluster 생성 된 것 확인
gcloud beta alloydb instances create lab-instance \ --instance-type=PRIMARY \ --cpu-count=2 \ --region=us-central1 \ --cluster=lab-cluster \ --project=qwiklabs-gcp-00-9180b9934581 |
인스턴스 생성된 것 확인
Task 2. Create tables in your instance
export ALLOYDB=ALLOYDB_ADDRESS echo $ALLOYDB > alloydbip.txt psql -h $ALLOYDB -U postgres |
CREATE TABLE countries ( country_id char(2) NOT NULL, country_name varchar(40), region_id bigint ) ; ALTER TABLE countries ADD PRIMARY KEY (country_id); |
CREATE TABLE departments ( department_id smallint NOT NULL, department_name varchar(30), manager_id integer, location_id smallint ) ; ALTER TABLE departments ADD PRIMARY KEY (department_id); |
Task 3. Load simple datasets into tables
postgres=> INSERT INTO countries VALUES ('IT', 'Italy', 1), ('JP', 'Japan', 3), ('US', 'United States of America', 2), ('CA', 'Canada', 2), ('CN', 'China', 3), ('IN', 'India', 3), ('AU', 'Australia', 3), ('ZW', 'Zimbabwe', 4), ('SG', 'Singapore', 3); INSERT 0 9 postgres=> postgres=> INSERT INTO departments VALUES (10, 'Administration', 200, 1700), (20, 'Marketing', 201, 1800), (30, 'Purchasing', 114, 1700), (40, 'Human Resources', 203, 2400), (50, 'Shipping', 121, 1500), (60, 'IT', 103, 1400); INSERT 0 6 |
SELECT * FROM regions; |
postgres=> INSERT INTO regions VALUES (1, 'Europe'), (2, 'Americas'), (3, 'Asia'), (4, 'Middle East and Africa'); |
Task 4. Create a Read Pool instance
gcloud beta alloydb instances create lab-instance-rp1 \ --instance-type=READ_POOL \ --cpu-count=2 \ --read-pool-node-count=2 \ --region=us-central1 \ --cluster=lab-cluster \ --project=qwiklabs-gcp-00-9180b9934581 |
Task 5. Create a backup
gcloud beta alloydb backups create lab-backup \ --cluster=lab-cluster \ --region=us-central1 \ --project=qwiklabs-gcp-00-9180b9934581 |
참고 :https://www.cloudskillsboost.google/focuses/50123?parent=catalog
반응형
'클라우드 > GCP' 카테고리의 다른 글
23. dag 작업 결과 slack 알림 (0) | 2024.12.05 |
---|---|
22. Migrate to Cloud SQL for PostgreSQL using Database Migration Service (0) | 2024.12.04 |
20. Accelerating Analytical Queries using the AlloyDB Columnar Engine (0) | 2024.12.02 |
19. Administering an AlloyDB Database (0) | 2024.11.27 |
18. Migrating to AlloyDB from PostgreSQL Using Database Migration Service (0) | 2024.11.26 |