diff --git a/docs/cloud/high-availability/failovers.mdx b/docs/cloud/high-availability/failovers.mdx index b12484297a..9fd3428546 100644 --- a/docs/cloud/high-availability/failovers.mdx +++ b/docs/cloud/high-availability/failovers.mdx @@ -192,7 +192,7 @@ A forced failover when there is a significant replication lag has a higher likel ### Trigger the failover {#manual-failovers} -You can trigger a failover manually using the Temporal Cloud
Web UI or the tcld CLI, depending on your preference and setup. +You can trigger a failover manually using the Temporal Cloud Web UI, the tcld CLI, or the Cloud Ops API, depending on your preference and setup. The following instructions outline the steps for each method: @@ -216,10 +216,57 @@ tcld namespace failover \ --region ``` +The `` must be the name of a region (example: `us-east-1`) where the Namespace has a replica that is ready to be failed over to (replica state is `Activated`). + If using API key authentication with the `--api-key` flag, you must add it directly after the tcld command and before `namespace failover`. + + +You can trigger a failover programmatically using the [Cloud Ops API](/ops). +The API is available via both HTTP and gRPC. + +**Using HTTP** + +Send a POST request to the [`FailoverNamespaceRegion`](https://saas-api.tmprl.cloud/docs/httpapi.html#tag/high-availability/POST/cloud/namespaces/{namespace}/failover-region) endpoint: + +``` +POST https://saas-api.tmprl.cloud/cloud/namespaces//failover-region +``` + +Request body: + +```json +{ + "region": "", + "asyncOperationId": "" +} +``` + +- `region` (required): The [region code](/cloud/regions) of the region to failover to. Must be a region where the Namespace has a replica in `Activated` replica state, indicating the replica is ready to be failed over to. Example: `aws-us-east-1` +- `asyncOperationId` (optional): A user-defined ID for tracking the async operation. If not set, the server will assign one. + +**Using gRPC** + +Use the [`FailoverNamespaceRegion`](https://buf.build/temporalio/cloud-api/docs/main:temporal.api.cloud.cloudservice.v1#temporal.api.cloud.cloudservice.v1.CloudService.FailoverNamespaceRegion) RPC with a [`FailoverNamespaceRegionRequest`](https://buf.build/temporalio/cloud-api/docs/main:temporal.api.cloud.cloudservice.v1#temporal.api.cloud.cloudservice.v1.FailoverNamespaceRegionRequest): + +```protobuf +message FailoverNamespaceRegionRequest { + // The namespace to failover. + string namespace = 1; + // The id of the region to failover to. + // Must be a region that the namespace is currently available in. + string region = 2; + // The id to use for this async operation - optional. + string async_operation_id = 3; +} +``` + +Both methods return a [`FailoverNamespaceRegionResponse`](https://buf.build/temporalio/cloud-api/docs/main:temporal.api.cloud.cloudservice.v1#temporal.api.cloud.cloudservice.v1.FailoverNamespaceRegionResponse) containing an async operation that you can use to track the failover status. + + + Temporal fails over the primary to the replica.