DigitalOcean-public.v2-new_Databases
Create a Read-only Replica
To create a read-only replica for a PostgreSQL or MySQL database cluster, send a POST request to /v2/databases/$DATABASE_ID/replicas specifying the name it should be given, the size of the node to be used, and the region where it will be located.
Note: Read-only replicas are not supported for Caching or Valkey clusters.
The response will be a JSON object with a key called replica. The value of this will be an object that contains the standard attributes associated with a database replica. The initial value of the read-only replica's status attribute will be forking. When the replica is ready to receive traffic, this will transition to active.
post/v2/databases/{database_cluster_uuid}/replicas
Path parameters
database_cluster_uuidstring uuid required
A unique identifier for a database cluster.
Request body
Example request
{
"id": "9cc10173-e9ea-4176-9dbc-a4cee4c4ff30",
"name": "read-nyc3-01",
"region": "nyc3",
"size": "db-s-2vcpu-4gb",
"status": "creating",
"tags": [
"production"
],
"created_at": "2019-01-11T18:37:36Z",
"private_network_uuid": "9423cbad-9211-442f-820b-ef6915e99b5f",
"connection": {
"uri": "postgres://doadmin:wv78n3zpz42xezdk@backend-do-user-19081923-0.db.ondigitalocean.com:25060/defaultdb?sslmode=require",
"database": "defaultdb",
"host": "backend-do-user-19081923-0.db.ondigitalocean.com",
"port": 25060,
"user": "doadmin",
"password": "wv78n3zpz42xezdk",
"ssl": true
},
"private_connection": {
"uri": "postgres://doadmin:wv78n3zpz42xezdk@backend-do-user-19081923-0.db.ondigitalocean.com:25060/defaultdb?sslmode=require",
"database": "defaultdb",
"host": "backend-do-user-19081923-0.db.ondigitalocean.com",
"port": 25060,
"user": "doadmin",
"password": "wv78n3zpz42xezdk",
"ssl": true
},
"storage_size_mib": 61440
}Response
A JSON object with a key of replica.
Example response
{
"replica": {
"id": "9cc10173-e9ea-4176-9dbc-a4cee4c4ff30",
"name": "read-nyc3-01",
"region": "nyc3",
"size": "db-s-2vcpu-4gb",
"status": "creating",
"tags": [
"production"
],
"created_at": "2019-01-11T18:37:36Z",
"private_network_uuid": "9423cbad-9211-442f-820b-ef6915e99b5f",
"connection": {
"uri": "postgres://doadmin:wv78n3zpz42xezdk@backend-do-user-19081923-0.db.ondigitalocean.com:25060/defaultdb?sslmode=require",
"database": "defaultdb",
"host": "backend-do-user-19081923-0.db.ondigitalocean.com",
"port": 25060,
"user": "doadmin",
"password": "wv78n3zpz42xezdk",
"ssl": true
},
"private_connection": {
"uri": "postgres://doadmin:wv78n3zpz42xezdk@backend-do-user-19081923-0.db.ondigitalocean.com:25060/defaultdb?sslmode=require",
"database": "defaultdb",
"host": "backend-do-user-19081923-0.db.ondigitalocean.com",
"port": 25060,
"user": "doadmin",
"password": "wv78n3zpz42xezdk",
"ssl": true
},
"storage_size_mib": 61440
}
}