Any client application that works with PostgreSQL can also work with AlloyDB Omni, with no modification needed.
To connect to your database cluster, use any PostgreSQL-compatible client, such as psql, that's installed on a client machine.
Before you begin
- Install AlloyDB Omni using the RPM orchestrator.
- Create an AlloyDB Omni cluster.
Make sure that you have the following connection information:
- Host: the IP address of the database node. You can find the IP addresses of your nodes by getting the cluster status. If the HA is enabled for your cluster, follow the steps in Verify read-only endpoints to find the IP addresses of your endpoints.
- Port:
5432 - Username:
postgresor the administrative user you configured. - Password: the password for the administrative user that you configured when creating the cluster.
Connect to a database node using psql
To connect to your database node, run the psql command from a client machine that has network access to the database node.
Run the following command:
psql -h NODE_IP_ADDRESS -p 5432 -U postgresReplace
NODE_IP_ADDRESSwith the IP address of the database node.When you're prompted, enter the password for the
postgresuser.
Connect through a connection pooler
If you configured PgBouncer, you can connect to the cluster through the connection pooler. For more information, see Verify the connection pooler.
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 in 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.