This page describes how to run and connect to AlloyDB Omni after you install it on your own machine.
Run AlloyDB Omni
The procedures you use to run AlloyDB Omni depend on whether you're running AlloyDB Omni in a container on a single server.
Start AlloyDB Omni
To start a stopped AlloyDB Omni container, run either the
docker container start
command or the
podman container start
command:
Docker
docker container start CONTAINER_NAME
Replace CONTAINER_NAME
with the name that you assigned
to the AlloyDB Omni container when you installed it.
Podman
podman container start CONTAINER_NAME
Replace CONTAINER_NAME
with the name that you assigned
to the AlloyDB Omni container when you installed it.
Check the status of AlloyDB Omni
To check the status of all of the containers you have running, run either
the docker container ls
command or the podman container ls
command:
Docker
docker container ls
Podman
podman container ls
If your AlloyDB Omni container is running, then its
name will appear in the NAMES
column of the output table. The corresponding
row summarizes the container's state.
If the name of your container doesn't appear in the NAMES
column, then
your AlloyDB Omni is not running.
Stop AlloyDB Omni
To stop a AlloyDB Omni container, run either the
docker container stop
command or the
podman container stop
command:
Docker
docker container stop CONTAINER_NAME
Replace CONTAINER_NAME
with the name that you assigned
to the AlloyDB Omni container when you installed it.
Podman
podman container stop CONTAINER_NAME
Replace CONTAINER_NAME
with the name that you assigned
to the AlloyDB Omni container when you installed it.
Connect to AlloyDB Omni running on a single server
The AlloyDB Omni container includes its own copy of psql
that lets
you open an interactive SQL shell session with its database server.
You can also connect to AlloyDB Omni from outside the container, using the PostgreSQL-compatible software of your choice.
For information about connecting to an AlloyDB Omni database cluster running on a Kubernetes cluster, see Connect to AlloyDB Omni running on Kubernetes.
Connect using the containerized psql
To connect to the AlloyDB Omni database server using its own
containerized copy of psql
, run the following command:
Docker
docker exec -it CONTAINER_NAME psql -U postgres
Replace CONTAINER_NAME
with the name that you assigned
to the AlloyDB Omni container when you installed it.
Podman
podman exec -it CONTAINER_NAME psql -U postgres
Replace CONTAINER_NAME
with the name that you assigned
to the AlloyDB Omni container when you installed it.
This command connects you to the server as the postgres
user role, and displays
a postgres=#
command prompt. You can now run psql
commands and SQL
queries.
To exit psql
, run the \q
command.
Connect using your own applications
Any application that works with PostgreSQL can also work with AlloyDB Omni, with no modification needed.
To connect to the AlloyDB Omni database server, expose networking from the AlloyDB Omni docker container to your host machine by adding --network=host
or -p 5432:5432
to your docker run
or podman run
command when you start AlloyDB Omni.
To select a custom port number, use -p [HOST_PORT]:5432
when you start AlloyDB Omni. Then, use any PostgreSQL-compatible client or code library to connect to port 5432
or the custom port number that you specified.
After connecting to the database server, you can define, query, and modify your databases using DML and SQL queries by using standard PostgreSQL communication protocols.
Because AlloyDB Omni runs within your own environment, you can control how you connect to AlloyDB Omni. This includes allowing or restricting network access to this service according to the needs of your application, just as you would with an ordinary PostgreSQL server.