Connection problems
Connection issues can prevent your application or database tools from accessing your RayDB PostgreSQL cluster. This guide helps troubleshoot common connection problems and provides solutions.
Common Causes of Connection Issues
Incorrect Connection String
- Ensure the connection string follows the correct format:
postgres://<user>:<password>@<host>:<port>/<database>?sslmode=require - Solution: Verify the credentials, host, port, and database name in your connection string.
Firewall or Network Restrictions
- If your IP is not whitelisted, connections will be blocked.
- Solution:
- Log in to the RayDB Dashboard.
- Navigate to Allowed IP Ranges under your cluster.
- Add your current IP to the allowed list.
Database Credentials Incorrect
- If authentication fails, verify that your username and password are correct.
- Solution:
- Verify the credentials, host, port, and database name in your connection string.
SSL/TLS Configuration Issues
- If SSL is required but not configured properly, the connection may fail.
- Solution: Ensure your database client supports SSL mode and is configured to use
sslmode=require.
Cluster is Unavailable or Under Maintenance
- Scheduled maintenance or an outage can cause temporary connection failures.
- Solution:
- Go to Database Overview section and check maintenance window.
- Go to Database Metrics section and check Uptime.
- Check the RayDB Status Page for maintenance updates.
- Retry the connection after maintenance is complete.
Troubleshooting Steps
- Check Connection Logs: Navigate to Cluster Logs in the dashboard to identify connection failures.
- Test Connectivity via CLI: Use
psqlto manually test the connection:psql "postgres://user:password@host:port/database?sslmode=require" - Verify Firewall Rules: Ensure your IP is whitelisted and firewall settings are correct.
- Restart Application or Client: Sometimes restarting the database client resolves transient issues.
Best Practices
- Use Connection Pooling: Helps manage and reuse connections efficiently.
- Monitor Connection Limits: Regularly check active connections in the RayDB dashboard.
- Enable Alerts for Connection Failures: Set up notifications for failed login attempts or excessive connection errors.
For more security configurations, see Firewall Configuration.