Skip to content

Create a Read Replica Set

client.projects.services.replicaSets.replicaSets(stringserviceID, ReplicaSetReplicaSetsParams { project_id, cpu_millis, memory_gbs, 2 more } params, RequestOptionsoptions?): ReadReplicaSet { id, connection_pooler, cpu_millis, 6 more }
POST/projects/{project_id}/services/{service_id}/replicaSets

Creates a new read replica set for a service. This is an asynchronous operation.

ParametersExpand Collapse
serviceID: string
params: ReplicaSetReplicaSetsParams { project_id, cpu_millis, memory_gbs, 2 more }
project_id: string

Path param: The unique identifier of the project.

cpu_millis: number

Body param: The initial CPU allocation in milli-cores.

memory_gbs: number

Body param: The initial memory allocation in gigabytes.

name: string

Body param: A human-readable name for the read replica.

nodes: number

Body param: Number of nodes to create in the replica set.

ReturnsExpand Collapse
ReadReplicaSet { id, connection_pooler, cpu_millis, 6 more }
id?: string
connection_pooler?: ConnectionPooler { endpoint }
endpoint?: Endpoint { host, port }
host?: string
port?: number
cpu_millis?: number

CPU allocation in milli-cores.

endpoint?: Endpoint { host, port }
host?: string
port?: number
memory_gbs?: number

Memory allocation in gigabytes.

metadata?: Metadata { environment }

Additional metadata for the read replica set

environment?: string

Environment tag for the read replica set

name?: string
nodes?: number

Number of nodes in the replica set.

status?: "creating" | "active" | "resizing" | 2 more
One of the following:
"creating"
"active"
"resizing"
"deleting"
"error"

Create a Read Replica Set

import TigerCloud from 'tiger-cloud';

const client = new TigerCloud({
  apiKey: process.env['TIGER_CLOUD_API_KEY'], // This is the default and can be omitted
});

const readReplicaSet = await client.projects.services.replicaSets.replicaSets('d1k5vk7hf2', {
  project_id: 'rp1pz7uyae',
  cpu_millis: 250,
  memory_gbs: 1,
  name: 'my-reporting-replica',
  nodes: 2,
});

console.log(readReplicaSet.id);
{
  "id": "alb8jicdpr",
  "connection_pooler": {
    "endpoint": {
      "host": "my-service.com",
      "port": 8080
    }
  },
  "cpu_millis": 250,
  "endpoint": {
    "host": "my-service.com",
    "port": 8080
  },
  "memory_gbs": 1,
  "metadata": {
    "environment": "environment"
  },
  "name": "reporting-replica-1",
  "nodes": 2,
  "status": "active"
}
Returns Examples
{
  "id": "alb8jicdpr",
  "connection_pooler": {
    "endpoint": {
      "host": "my-service.com",
      "port": 8080
    }
  },
  "cpu_millis": 250,
  "endpoint": {
    "host": "my-service.com",
    "port": 8080
  },
  "memory_gbs": 1,
  "metadata": {
    "environment": "environment"
  },
  "name": "reporting-replica-1",
  "nodes": 2,
  "status": "active"
}