- Create Cluster
- Cluster ID : lab-cluster
- Password : Change3Me
- Network : peering-network
- Instance ID : lab-instance
- Machine Type : 2 vCPU, 16 GB
- Copy IP Address = 10.51.0.2
-
Navigation menu > Compute Engine > VM Instances
-
Connect SSH to the instance
alloydb-instance
-
Set environment variables
export ALLOYDB=ALLOYDB_ADDRESS
-
Simpan ke AlloyDB
echo $ALLOYDB > alloydbip.txt
-
Buka AlloyDB
psql -h $ALLOYDB -U postgres
-
Create table
CREATE TABLE regions ( region_id bigint NOT NULL, region_name varchar(25) ) ; ALTER TABLE regions ADD PRIMARY KEY (region_id); 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);
-
Insert Data
INSERT INTO regions VALUES (1, 'Europe' ), (2, 'Americas'), (3, 'Asia'), (4, 'Middle East and Africa'); 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 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);
- Add Read Pool, Fill
- Read pool instance ID : lab-instance-rp1
- Node count : 2
- Machine Type : 2 vCPU, 16 GB
Databases > AlloyDB for PostgreSQL > Backups
- Backup ID =
lab-backup