Objective
Install AlloyDB Omni on a Ubuntu VM running in VMware Engine.
https://cloud.google.com/alloydb/docs/omni/install
Prereqs
Setup on Ubuntu VM
Install alloydb-cli
curl https://us-apt.pkg.dev/doc/repo-signing-key.gpg | sudo apt-key add -
sudo apt update
echo "deb https://us-apt.pkg.dev/projects/alloydb-omni alloydb-omni-apt main" | sudo tee -a /etc/apt/sources.list.d/artifact-registry.list
sudo apt update
sudo apt-get install alloydb-cli
Install alloydb with alloydb-cli
1. Verify you meet the prerequisites.
Input
sudo alloydb system-check
Output
Starting system check for AlloyDB Omni on local machine...
Checking for minimum of 2 vCPUs...SUCCESS
└─Detected 4 vCPUs.
Checking for minimum of 2.00GB of RAM...SUCCESS
└─Detected total RAM: 15.61GB.
Checking for Linux kernel...SUCCESS
└─Linux kernel detected.
Checking Linux kernel version is 4.10+...SUCCESS
└─Linux kernel version: 6.2.0-35-generic
Checking Linux distribution is Debian-based or RHEL...SUCCESS
└─Compatible Debian-based distribution detected.
Checking cgroups v2 is enabled...SUCCESS
└─cgroups v2 is enabled.
Checking Docker is installed...SUCCESS
└─Docker installation found.
Checking Docker daemon is running...SUCCESS
└─Docker service is currently active.
Checking Docker server version is 20.10+...SUCCESS
└─Compatible Docker server version: 24.0.6
Checking for conflicting pre-existing users...SUCCESS
└─User postgres exists with expected ID 2345.
System check passed. Your machine meets the requirements to run AlloyDB Omni.
2. Create a data directory
mkdir alloydb
3. Install AlloyDB Server
Input
sudo alloydb database-server install --data-dir=/home/gcveadmin/alloydb
Output
Starting system check for AlloyDB Omni on local machine...
Checking for minimum of 2 vCPUs...SUCCESS
└─Detected 4 vCPUs.
Checking for minimum of 2.00GB of RAM...SUCCESS
└─Detected total RAM: 15.61GB.
Checking for Linux kernel...SUCCESS
└─Linux kernel detected.
Checking Linux kernel version is 4.10+...SUCCESS
└─Linux kernel version: 6.2.0-35-generic
Checking Linux distribution is Debian-based or RHEL...SUCCESS
└─Compatible Debian-based distribution detected.
Checking cgroups v2 is enabled...SUCCESS
└─cgroups v2 is enabled.
Checking Docker is installed...SUCCESS
└─Docker installation found.
Checking Docker daemon is running...SUCCESS
└─Docker service is currently active.
Checking Docker server version is 20.10+...SUCCESS
└─Compatible Docker server version: 24.0.6
Checking for conflicting pre-existing users...SUCCESS
└─User postgres exists with expected ID 2345.
System check passed.
Initializing AlloyDB Omni instance...
Creating postgres user...
Copying installation files...
Creating AlloyDB Omni directories...
Installing systemd services...
Updating data plane configuration file...
AlloyDB Omni has been successfully installed.
Use "alloydb database-server start" to create the data plane containers.
4. Start AlloyDB
Input
$ sudo alloydb database-server start
Output
Starting system check for AlloyDB Omni on local machine...
Checking for minimum of 2 vCPUs...SUCCESS
└─Detected 4 vCPUs.
Checking for minimum of 2.00GB of RAM...SUCCESS
└─Detected total RAM: 15.61GB.
Checking for Linux kernel...SUCCESS
└─Linux kernel detected.
Checking Linux kernel version is 4.10+...SUCCESS
└─Linux kernel version: 6.2.0-35-generic
Checking Linux distribution is Debian-based or RHEL...SUCCESS
└─Compatible Debian-based distribution detected.
Checking cgroups v2 is enabled...SUCCESS
└─cgroups v2 is enabled.
Checking Docker is installed...SUCCESS
└─Docker installation found.
Checking Docker daemon is running...SUCCESS
└─Docker service is currently active.
Checking Docker server version is 20.10+...SUCCESS
└─Compatible Docker server version: 24.0.6
Checking for conflicting pre-existing users...SUCCESS
└─User postgres exists with expected ID 2345.
System check passed. Starting AlloyDB Omni...
Configuring memory kernel parameters...
Configuring data directory...
Cleaning old pgtmp-loop and swap files...
Setting up core-dump directory...
Setting up swap file...
Starting memory cleanup...
Removing old data plane containers...
Writing dynamic PostgreSQL parameters...
Resolving data plane images...
Image found locally: gcr.io/alloydb-omni/pg-service:15.2.1
Image found locally: gcr.io/alloydb-omni/memory-agent:15.2.1
Starting AlloyDB Omni containers...
Reinstalling default extensions in all databases...
AlloyDB Omni database started.
5. Verify the memory-agent and pg-services are up.
Input
docker ps -a
Output
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
f4234a6ddfe6 gcr.io/alloydb-omni/memory-agent:15.2.1 "/cgmon --logtostder…" 28 minutes ago Up 28 minutes memory-agent
79ccdd6b18c9 gcr.io/alloydb-omni/pg-service:15.2.1 "/bin/bash /smurf-sc…" 28 minutes ago Up 28 minutes pg-service
Create a Database
In this example I will be creating a Horizon View Events database.
1. Connect to psql inside of the pg-service container.
Input
docker exec -it pg-service psql -h localhost -U postgres
Output
psql (15.2)
Type "help" for help.
postgres=#
2. Create a database user. We will use vdi in this example.
Input
postgres=# CREATE USER vdi WITH PASSWORD 'PASSWORD';
3. Create a database and assign an owner. We create a DB named ‘gcvevdi’ and assign ‘vdi’ as the owner.
Input
postgres=# CREATE DATABASE gcvevdi WITH OWNER vdi;
4. Verify the database was created with \list or \l
Configure client authentication (pg_hba.conf)
- AlloyDB stores its configuration files in /var/alloydb/config.
- Edit pg_hba_conf in this directory to allow access from client IPs.
- In this example I am allowing access from the 2 Horizon Connection Server IPs.
pg_hba.conf
# This file is read on server startup and when the server receives a
# SIGHUP signal. If you edit the file on a running system, you have to
# SIGHUP the server for the changes to take effect, run "pg_ctl reload",
# or execute "SELECT pg_reload_conf()".
#
# Put your actual configuration here
# ----------------------------------
host all all 10.0.4.7/32 md5
host all all 10.0.4.6/32 md5