This page describes how to run and connect to AlloyDB Omni after you install it on your own machine.
Before you begin
Install AlloyDB Omni on your system.
Run AlloyDB Omni
Use the information in the following sections to start, check the status, and stop AlloyDB Omni.
Optional: Update SELinux policies
If SELinux is enabled on your system and you modify certain Grand Unified
Configuration (GUC) parameters in the postgresql.conf file, you must update
your SELinux policies before starting the AlloyDB Omni service.
Updating these policies prevents resource access denials that can make the
database server unavailable or disrupt operations such as backups.
Running the semanage and restorecon commands requires the
policycoreutils-python-utils package.
The following table lists the GUC parameters that require SELinux policy updates when you change them from their default values:
| GUC parameter | Resource type | Impact if SELinux policy isn't updated | Resolution |
|---|---|---|---|
port |
Port | The database server fails to start and becomes unavailable. | Assign the postgresql_port_t label to the custom TCP port. |
external_pid_file |
File | The database server remains available, but SELinux denies access to create the external PID file outside /var/run/postgresql/. |
Assign the postgresql_db_t label to the custom PID file directory. |
unix_socket_directories |
File | The database server fails to create the socket file and becomes unavailable. | Assign the postgresql_db_t label to the custom Unix socket directory. |
log_directory |
File | The database server fails to write logs and becomes unavailable. | Assign the postgresql_db_t label to the custom log directory. |
archive_command |
File | The database server remains available, but SELinux denies write access to the target directory, which can disrupt write-ahead log (WAL) archiving and backups. | Assign the postgresql_db_t label to the custom archive directory. |
Update the SELinux policy for a custom port
If you change the port parameter in the postgresql.conf file, run the
following commands to allow AlloyDB Omni to bind to the custom
TCP port:
Add the
postgresql_port_tlabel to the custom port:sudo /usr/sbin/semanage port -a -t postgresql_port_t -p tcp PORT_NUMBERReplace
PORT_NUMBERwith the custom TCP port number—for example,5433.Confirm that the port policy is updated:
sudo /usr/sbin/semanage port -l | grep postgresql_port_t
Update the SELinux policy for a custom directory
If you change the external_pid_file, unix_socket_directories,
log_directory, or archive_command parameter in the postgresql.conf file to
use a custom directory, run the following commands to apply the
postgresql_db_t context to that directory:
sudo /usr/sbin/semanage fcontext -a -t postgresql_db_t "DIRECTORY_PATH(/.*)?"
sudo /sbin/restorecon -R -F DIRECTORY_PATHReplace DIRECTORY_PATH with the full path to the custom PID
file directory, Unix socket directory, log directory, or WAL archive directory.
Start AlloyDB Omni
sudo systemctl start alloydbomni18Optional: Enable automatic service restart
To enable automatic restart of the AlloyDB Omni service, do the following:
Add the following configuration to the
/etc/systemd/system/alloydbomni18.service.d/override.conffile.[Service] Restart=on-failureReload the
systemdmanager configuration and restart thealloydbomni18service for the changes to take effect.sudo systemctl daemon-reloadsudo systemctl restart alloydbomni18
Check the status of AlloyDB Omni
sudo systemctl status alloydbomni18Stop AlloyDB Omni
sudo systemctl stop alloydbomni18Connect to AlloyDB Omni
The AlloyDB Omni RPM package also includes the psql client that lets you open an interactive SQL shell session with the database server.
You can also connect to AlloyDB Omni using the PostgreSQL-compatible software of your choice.
Connect using bundled psql
/usr/lib/postgresql/18/bin/psql -h localhost -U postgresThis 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 client application that works with PostgreSQL can also work with AlloyDB Omni, with no modification needed.
Use any PostgreSQL-compatible client or code library to connect to AlloyDB Omni.
After you connect to the database server, you can define, query, and modify your databases by sending DML and SQL queries through standard PostgreSQL communication protocols.
Because AlloyDB Omni runs within your own environment, you can control how you connect to AlloyDB Omni. You can allow or restrict network access to AlloyDB Omni according to the needs of your application, just as you would with an ordinary PostgreSQL server.
What's next