Managed PostgreSQL
Okustera Managed PostgreSQL runs upstream PostgreSQL 16 with fully automated high-availability orchestration, self-healing failover, rolling minor upgrades, synchronous streaming replication, and Point-in-Time Recovery (PITR).
Architectural Highlights
- Instantaneous Failover: Automated quorum election and standby promotion complete in under 5 seconds using native PostgreSQL streaming replication.
- Separated Read/Write Endpoints: Dedicated private endpoints route write traffic to the active primary and balance read queries across healthy standbys.
- Continuous S3 WAL Archiving: Every write-ahead log (WAL) segment is continuously streamed to encrypted Okustera S3 object storage for Point-in-Time Recovery (PITR) to any exact timestamp.
- Zero-Downtime Rolling Minor Upgrades: Minor version patches are applied sequentially to standbys before performing a graceful leader switchover.
Provisioning with Terraform
The official Okustera Terraform provider delivers full declarative control over your PostgreSQL instances:
resource "okustera_database_postgresql" "app_database" {
name = "production-crm-db"
namespace = "production"
instances = 3
storage_size = "100Gi"
database_name = "crm"
username = "app_user"
}
output "db_primary_endpoint" {
value = okustera_database_postgresql.app_database.primary_endpoint
}
output "db_connection" {
value = okustera_database_postgresql.app_database.connection_uri
sensitive = true
}
Refer to the Terraform Resource Reference for full argument documentation.
Connecting to PostgreSQL
1. Connection String Format
postgresql://<user>:<password>@<primary-endpoint>:5432/<database_name>?sslmode=require
2. Python (psycopg2 / asyncpg) Example
import os
import asyncpg
import asyncio
async def main():
conn = await asyncpg.connect(
user='app_user',
password=os.environ['DB_PASSWORD'],
database='crm',
host='<primary-endpoint>',
port=5432,
ssl='require'
)
version = await conn.fetchval('SELECT version()')
print("Connected to:", version)
await conn.close()
asyncio.run(main())
Point-in-Time Recovery (PITR)
To restore a database cluster to a specific timestamp in the past without affecting your live production database, launch an isolated PITR clone via the Okustera Cloud Portal (Databases → Backups & PITR → Point-in-Time Recovery) or via the DBaaS REST API:
curl -s -X POST \
-H "Authorization: Bearer ${OKUSTERA_API_TOKEN}" \
-H "Content-Type: application/json" \
-d '{
"target_cluster_name": "crm-db-restored",
"target_time": "2026-09-10 14:30:00"
}' \
https://api.okustera.com/api/v1/dbaas/clusters/postgresql/production/production-crm-db/pitr-restore
For complete details on continuous WAL streaming, RPO/RTO SLAs, and disaster recovery procedures, see the Replication, Backups & Disaster Recovery Guide.