IBM Cloud Docs
The high-availability read-only replica

The high-availability read-only replica

A high-availability Databases for PostgreSQL read-only replica provides benefits such as improved read scalability, increased availability, reduced read latency, backup and disaster recovery capabilities, and the ability to distribute read traffic efficiently. It contributes to a more robust and responsive database infrastructure for your application.

Provision a high-availability read-only replica

High-availability Databases for PostgreSQL read-only replicas must initially be provisioned in the single-member (non-HA) configuration. To provision a read-only replica, follow the procedure that is outlined in Provisioning a read-only replica.

After your read-replica is provisioned, use the Cloud Databases API to scale up the read replica to two (or more) members.

To scale up your read-replica, use the Scaling groups endpoint of the Cloud Databases API.

The high-availability read-only replica command

To execute the command, you first need the {foundation endpoint} and the {id} for your Cloud Databases instance.

The {foundation endpoint} is the starting point for accessing and interacting with the resources that are exposed by the Cloud Databases API. The foundation endpoint is visible in the UI within your Overview. To use the foundation endpoint, it must first be URL encoded. URL encoding replaces unsafe characters with a % followed by two hexadecimal digits representing the character's ASCII code.

The {id} is your Cloud Resource Name (CRN) and uniquely identifies your Cloud Databases instance. It is visible in the UI within your Overview.

To use your instance's {CRN} and {foundation endpoint} in a command, they must first be URL encoded. URL encoding replaces unsafe characters with a % followed by two hexadecimal digits representing the character's ASCII code.

curl -XPATCH -H 'Authorization: Bearer <>' "{foundation_endpoint}/deployments/{id}/groups/member" -d '{"members": {"allocation_count": 2}}'

Verifying the state of your read-replica

To verify the current state of your read-replica, use the Scaling groups endpoint of the Cloud Databases API.

Use a command like:

curl -XGET -H 'Authorization: Bearer <>' "{foundation_endpoint}/deployments/{id}/groups"