Skip to content

Change HA configuration for a Service

client.projects.services.setHa(stringserviceID, ServiceSetHaParams { project_id, replica_count, sync_replica_count } params, RequestOptionsoptions?): Service { connection_pooler, created, endpoint, 14 more }
POST/projects/{project_id}/services/{service_id}/setHA

Changes the HA configuration for a specific service. This is an asynchronous operation.

ParametersExpand Collapse
serviceID: string
params: ServiceSetHaParams { project_id, replica_count, sync_replica_count }
project_id: string

Path param: The unique identifier of the project.

replica_count?: number

Body param: Number of high-availability replicas (all replicas are asynchronous by default).

sync_replica_count?: number

Body param: Number of synchronous high-availability replicas.

ReturnsExpand Collapse
Service { connection_pooler, created, endpoint, 14 more }
connection_pooler?: ConnectionPooler { endpoint }
endpoint?: Endpoint { host, port }
host?: string
port?: number
created?: string

Creation timestamp

formatdate-time
endpoint?: Endpoint { host, port }
host?: string
port?: number
forked_from?: ForkedFrom { is_standby, project_id, service_id }
is_standby?: boolean
project_id?: string
service_id?: string
ha_replicas?: HaReplicas { replica_count, sync_replica_count }
replica_count?: number

Number of high-availability replicas (all replicas are asynchronous by default).

sync_replica_count?: number

Number of synchronous high-availability replicas.

initial_password?: string

The initial password for the service.

formatpassword
metadata?: Metadata { environment }

Additional metadata for the service

environment?: string

Environment tag for the service

metrics?: Metrics | null

Resource usage metrics for the service

memory_mb?: number | null

Memory usage in megabytes

milli_cpu?: number | null

CPU usage in millicores

storage_mb?: number | null

Storage usage in megabytes

name?: string

The name of the service.

project_id?: string

The project this service belongs to.

read_replica_sets?: Array<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"
region_code?: string

The cloud region where the service is hosted.

resources?: Array<Resource>

List of resources allocated to the service

id?: string

Resource identifier

spec?: Spec { cpu_millis, memory_gbs, volume_type }

Resource specification

cpu_millis?: number

CPU allocation in millicores

memory_gbs?: number

Memory allocation in gigabytes

volume_type?: string

Type of storage volume

service_id?: string

The unique identifier for the service.

service_type?: "TIMESCALEDB" | "POSTGRES" | "VECTOR"

The type of the service.

One of the following:
"TIMESCALEDB"
"POSTGRES"
"VECTOR"
status?: "QUEUED" | "DELETING" | "CONFIGURING" | 8 more

Current status of the service

One of the following:
"QUEUED"
"DELETING"
"CONFIGURING"
"READY"
"DELETED"
"UNSTABLE"
"PAUSING"
"PAUSED"
"RESUMING"
"UPGRADING"
"OPTIMIZING"
vpcEndpoint?: unknown

VPC endpoint configuration if available

Change HA configuration for a Service

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 service = await client.projects.services.setHa('d1k5vk7hf2', { project_id: 'rp1pz7uyae' });

console.log(service.project_id);
{
  "connection_pooler": {
    "endpoint": {
      "host": "my-service.com",
      "port": 8080
    }
  },
  "created": "2019-12-27T18:11:19.117Z",
  "endpoint": {
    "host": "my-service.com",
    "port": 8080
  },
  "forked_from": {
    "is_standby": false,
    "project_id": "asda1b2c3",
    "service_id": "bbss422fg"
  },
  "ha_replicas": {
    "replica_count": 1,
    "sync_replica_count": 1
  },
  "initial_password": "a-very-secure-initial-password",
  "metadata": {
    "environment": "environment"
  },
  "metrics": {
    "memory_mb": 512,
    "milli_cpu": 250,
    "storage_mb": 1024
  },
  "name": "name",
  "project_id": "project_id",
  "read_replica_sets": [
    {
      "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"
    }
  ],
  "region_code": "us-east-1",
  "resources": [
    {
      "id": "id",
      "spec": {
        "cpu_millis": 0,
        "memory_gbs": 0,
        "volume_type": "volume_type"
      }
    }
  ],
  "service_id": "service_id",
  "service_type": "TIMESCALEDB",
  "status": "QUEUED",
  "vpcEndpoint": {}
}
Returns Examples
{
  "connection_pooler": {
    "endpoint": {
      "host": "my-service.com",
      "port": 8080
    }
  },
  "created": "2019-12-27T18:11:19.117Z",
  "endpoint": {
    "host": "my-service.com",
    "port": 8080
  },
  "forked_from": {
    "is_standby": false,
    "project_id": "asda1b2c3",
    "service_id": "bbss422fg"
  },
  "ha_replicas": {
    "replica_count": 1,
    "sync_replica_count": 1
  },
  "initial_password": "a-very-secure-initial-password",
  "metadata": {
    "environment": "environment"
  },
  "metrics": {
    "memory_mb": 512,
    "milli_cpu": 250,
    "storage_mb": 1024
  },
  "name": "name",
  "project_id": "project_id",
  "read_replica_sets": [
    {
      "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"
    }
  ],
  "region_code": "us-east-1",
  "resources": [
    {
      "id": "id",
      "spec": {
        "cpu_millis": 0,
        "memory_gbs": 0,
        "volume_type": "volume_type"
      }
    }
  ],
  "service_id": "service_id",
  "service_type": "TIMESCALEDB",
  "status": "QUEUED",
  "vpcEndpoint": {}
}