Ritesh
07/07/2025, 11:08 AMMarvin
07/07/2025, 11:08 AMMarvin
07/07/2025, 11:09 AMpg_trgm
extension
- Configure PostgreSQL to accept remote connections by modifying postgresql.conf
and pg_hba.conf
Here's a quick setup for the PostgreSQL database:
sql
CREATE DATABASE prefect;
\c prefect
CREATE EXTENSION pg_trgm;
2. On Machine A (Prefect server):
- Set the database connection URL using:
bash
prefect config set PREFECT_API_DATABASE_CONNECTION_URL="<postgresql+asyncpg://username:password@machine_b_ip:5432/prefect>"
Replace:
- `username`: Your PostgreSQL username
- `password`: Your PostgreSQL password
- `machine_b_ip`: The IP address or hostname of Machine B
- `5432`: The PostgreSQL port (default is 5432)
3. Start the Prefect server:
bash
prefect server start
Important considerations:
- Ensure the PostgreSQL port (default 5432) is accessible from Machine A
- Use strong passwords and consider using SSL for the database connection in production
- The database user needs appropriate permissions to create and modify tables
- For production deployments, consider setting up proper authentication and possibly a reverse proxy
The server should now start up and connect to your remote PostgreSQL database. You can verify the connection by checking the server logs and ensuring there are no connection errors.
For more detailed information about server configuration and deployment options, you can refer to the Prefect server documentation.