PostgreSQL Command Line Syntax
You can connect to ScaleGrid PostgreSQL deployment using a shell terminal using the command line syntax.
Click the copy button next to the command line syntax box to copy the connection command. Please note that you will be prompted to enter the password that you can find in the Credentials area.
Here is an example of a connection string for a replica set without SSL or pgBouncer enabled.
psql -W -U sgpostgres -p 5432 -h SG-pgReplicaSet-199-pgsql-master.devservers.scalegrid.io -d postgres
Connecting to your PostgreSQL deployment in SSL mode
If you would like to verify the server CA certificate, you will need the SSL CA certificate file.
Downloading the CA certificate file
It is available on the Overview tab of your Cluster Details page under the SSL Certificate section as shown below:
Here's an example of a command line syntax for connecting to the master server of a master-standby set with SSL:
psql -W -U sgpostgres -p 6432 -h SG-NewPostgreCluster-5-pgsql-master.devservers.scalegrid.io -d "dbname=postgres sslmode=verify-ca sslrootcert=<Path to ca.pem file>"
The SSL CA certificate file pointed to in the sslrootcert argument above is the aforementioned SSL CA certificate file.
Updated almost 5 years ago