1. General Connection Settings
Connection Parameters
The connection details for your database are available in the Connect panel of the Relyt console. You can copy a ready-to-use connection string for common clients or copy individual parameters.
Connection Pooling
Every Relyt compute has server-side connection pooling enabled. To use it, connect to the hostname with the-pooler
suffix.
- Powered by PgBouncer
- Supports up to 10,000 concurrent client connections
- Configured with
pool_mode=transaction
(see feature details)
TLS/SSL Security
Relyt requires TLS for all connections. Connections that do not use SSL/TLS are rejected. The minimum acceptable setting issslmode=require
. For stronger protection against man-in-the-middle attacks, prefer sslmode=verify-ca
or sslmode=verify-full
. When using verify-ca
or verify-full
, ensure the appropriate CA root is available on the host or provide sslrootcert
explicitly.
sslmode | Verification and Behavior | |
---|---|---|
require | Minimum required | TLS required; no CA/hostname verification |
verify-ca | Recommended | TLS required; verifies CA; provide sslrootcert if needed |
verify-full | Recommended | TLS required; verifies CA and hostname; provide sslrootcert if needed |
2. PSQL Connection
psql is the official command-line client tool provided by PostgreSQL and is the most direct way to connect to Relyt.3. Python Connection
Python is one of the most commonly used languages in data analysis and backend development. Through the psycopg2 driver, you can easily connect to and operate Relyt databases in Python applications. The following introduces two common connection methods: connection pooling and direct connection.Install Dependencies
Before getting started, you need to install the PostgreSQL Python driver.psycopg2-binary
is a pre-compiled binary version that is more convenient to install and suitable for most use cases.
Connection Pool Method
Connection pooling is the recommended connection method for production environments, especially suitable for high-concurrency web applications. Connection pooling can reuse database connections, avoiding performance overhead from frequently establishing and disconnecting connections, while also controlling the maximum number of connections to prevent too many database connections.Direct Connection Method
The direct connection method is suitable for simple scripts and one-time operations. This approach has more intuitive code and is suitable for learning and debugging.4. Java Connection
Java is the mainstream language for enterprise application development. You can easily connect to Relyt databases through the PostgreSQL JDBC driver. JDBC (Java Database Connectivity) is Java’s standard database connection API, providing a unified database access interface.Requirement: PostgreSQL jar package version must be at least 42.2.6
URL Parameter Method
This is the most common JDBC connection method, where all connection parameters are included in the connection URL. This method is suitable for applications with relatively fixed configurations.Properties Method
Using a Properties object to configure connection parameters provides greater flexibility, especially suitable for scenarios that require dynamic configuration of connection parameters, such as reading connection information from configuration files.Configure Application Name
Setting a meaningful name for your application is a good practice that helps database administrators identify and monitor different client connections. Add the ApplicationName parameter to the connection string:Note: After configuration, administrators can view which client a session belongs to through
pg_stat_activity
. This is very useful for troubleshooting and performance monitoring. Reference Documentation: https://jdbc.postgresql.org/documentation/use/5. GUI Client Applications
For users who are not familiar with command-line operations, or for scenarios that require complex data browsing and management, graphical database management tools provide a more intuitive operating interface. These tools typically provide data table browsing, SQL query editors, data import/export, database structure management, and other functions. To connect to Relyt through GUI applications, you generally need to provide the following information:- hostname
- port
- username
- password
- database
pgAdmin4
pgAdmin is the officially recommended web interface management tool for PostgreSQL, which is powerful and completely free. It provides complete database management functions, including database object management, SQL query execution, performance monitoring, backup and recovery, etc.
DBeaver
DBeaver is a universal database management tool that supports multiple database types. It has a modern user interface and provides powerful SQL editors, data visualization tools, and a rich plugin ecosystem. For users who need to manage multiple types of databases, DBeaver is a great choice.
6. Common Issues
During usage, you may encounter some connection issues. The following are the most common problems and their solutions:Endpoint ID is not specified
This error typically occurs when using older versions of PostgreSQL client libraries. The root cause of the problem is that the client’s TLS implementation does not support Server Name Indication (SNI) technology, while Relyt’s cloud service relies on SNI to correctly route connections to the corresponding database instances. When the client TLS does not support Server Name Indication (SNI), the connection may show the following error:ERROR: Endpoint ID is not specified. Either please upgrade the postgres client library (libpq) for SNI support or pass the endpoint ID (first part of the domain name) as a parameter: ‘?options=project%3D’.Solutions: Upgrade your PostgreSQL client: Install psql (libpq) >= 14 for full SNI support