Connecting to a database
The internal and external addresses of Lexoya managed databases and how to connect to them.
Two addresses, one database
Every managed database on Lexoya has two addresses. The internal one is for services running in your account; the external one is for connecting from your own machine or a database client. Most of the time the internal address is all you need.
Internal connection
Services in the same account reach the database without opening a public port. Five values are involved, all listed in the database settings:
| Value | Example |
|---|---|
| Host | a1b2c3d4e5 |
| Port | 5432 |
| User | postgres |
| Database | app |
| Password | generated when the database is created |
The host is the database ID, not its public address. Entering the
.lexoyacloud.ir address in your service configuration will not connect.A PostgreSQL connection string looks like this:
postgresql://postgres:PASSWORD@a1b2c3d4e5:5432/appIf your client does not take a connection string, enter the host and port separately and fill in the user and password in their own fields.
Connecting from outside
To connect from your own machine or a desktop client, expose the database from the panel. Lexoya then gives you a public address of the form
id.lexoyacloud.ir and a dedicated port above 30000.Exposing opens a TCP port to the internet. Close it when you are done.
Default ports
| Engine | Port |
|---|---|
| PostgreSQL | 5432 |
| Redis | 6379 |
| Kafka | 9092 |
Kafka has its own host, of the form
id-kafka-bootstrap. For other engines, check the exact port in that database's settings.