Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add: Promote follower to standalone OS service #595

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,66 +1,218 @@
---
title: Set up cross-cluster replication for Aiven for OpenSearch®
limited: true
sidebar_label: Cross-cluster replication
---
Set up cross-cluster replication (CCR) for your Aiven for OpenSearch service to ensure efficient data synchronization across different regions and cloud providers.

import ConsoleLabel from "@site/src/components/ConsoleIcons";
import Tabs from '@theme/Tabs';
import TabItem from '@theme/TabItem';

Set up cross-cluster replication (CCR) for your Aiven for OpenSearch service to synchronize data across regions and cloud providers efficiently.

:::note
Cross cluster replication is not available for the Hobbyist and Startup plans.
:::

## Steps to set up CCR

1. Log in to the [Aiven Console](https://console.aiven.io/), and select
the Aiven for OpenSearch service for which to set up cross-cluster replication.
<Tabs groupId="ccr-setup-method">
<TabItem value="Console" label="Aiven Console" default>

1. Log in to the [Aiven Console](https://console.aiven.io/), and select the
Aiven for OpenSearch service.
1. On the service's <ConsoleLabel name="overview"/> page, scroll to the
**Cross cluster replication** section.
1. Click **Create follower**.

1. On the **Create OpenSearch follower cluster** page:

- Enter a name for the follower service.
- Select the cloud provider, region, and service plan.
- Add additional disk storage if required.

:::note
The follower service must use the same service plan as the leader service
during creation to ensure sufficient memory. You can change the service plan later.
:::

1. Click **Create**.

</TabItem>
<TabItem value="API" label="Aiven API">

To set up cross-cluster replication using the Aiven API, use the service integration
endpoint and specify the `integration_type` as `opensearch_cross_cluster_replication`.
For more information, see
[Create service integration](https://api.aiven.io/doc/#tag/Service_Integrations/operation/ServiceIntegrationCreate).

```bash
curl -X POST https://api.aiven.io/v1/project/<PROJECT_NAME>/integration \
-H "Authorization: Bearer <API_TOKEN>" \
-H "Content-Type: application/json" \
-d '{
"source_service": "<LEADER_SERVICE_NAME>",
"dest_service": "<FOLLOWER_SERVICE_NAME>",
"integration_type": "opensearch_cross_cluster_replication"
}'
```

Parameters:

2. In the service's **Overview** page, scroll to the **Cross cluster
replications** section and click **Create follower**.
- `<PROJECT_NAME>`: Aiven project name.
- `<LEADER_SERVICE_NAME>`: Leader (source) service name.
- `<FOLLOWER_SERVICE_NAME>`: Follower (destination) service name.
- `<API_TOKEN>`: API authentication token.

3. In the **Create OpenSearch follower cluster** page:
</TabItem>
<TabItem value="CLI" label="Aiven CLI">

- Enter a name for the follower cluster.
- Select the desired cloud provider.
- Select the desired cloud region.
- Select the service plan.
To set up cross-cluster replication with the [Aiven CLI](/docs/tools/cli), use the
`avn service integration-create` command and
specify the `integration-type` as `opensearch_cross_cluster_replication`.

:::note
During creation, the follower cluster service must have the same
service plan as the leader cluster service. This ensures the
follower cluster service has as much memory as the leader cluster.
You can change the service plan as required later.
:::
```bash
avn service integration-create \
--project <PROJECT_NAME> \
--source-service <LEADER_SERVICE_NAME> \
--dest-service <FOLLOWER_SERVICE_NAME> \
--integration-type opensearch_cross_cluster_replication

- Add additional disk storage based on your business requirements
```

4. Select **Create**.
Parameters:

- `<PROJECT_NAME>`: Aiven project name.
- `<LEADER_SERVICE_NAME>`: Leader (source) service name.
- `<FOLLOWER_SERVICE_NAME>`: Follower (destination) service name.

</TabItem>
<TabItem value="Terraform" label="Terraform">

To set up cross-cluster replication with Terraform, configure
the [Aiven Provider for Terraform](/docs/tools/terraform) and
set the `integration-type` to `opensearch_cross_cluster_replication` in the
service integration resource. For example:

```hcl
resource "aiven_service_integration" "ccr" {
project = "<PROJECT_NAME>"
integration_type = "opensearch_cross_cluster_replication"
source_service_name = "<LEADER_SERVICE_NAME>"
destination_service_name = "<FOLLOWER_SERVICE_NAME>"
}
```

Parameters:

- `<PROJECT_NAME>`: Aiven project name.
- `<LEADER_SERVICE_NAME>`: Leader (source) service name.
- `<FOLLOWER_SERVICE_NAME>`: Follower (destination) service name.

For detailed information, see the
[Service Integration resource documentation](https://registry.terraform.io/providers/aiven/aiven/latest/docs/resources/service_integration).

</TabItem>
</Tabs>

:::note
To learn about the current limitations with cross cluster replications
To learn about the limitations with cross-cluster replications
for Aiven for OpenSearch, see the
[Limitations](/docs/products/opensearch/concepts/cross-cluster-replication-opensearch#ccr-limitatons) section.
:::

## View follower cluster services
## View follower services

To view the follower services configured for your Aiven for OpenSearch service:

1. Go to the <ConsoleLabel name="overview"/> page of your service.
1. Scroll to the **Cross-cluster replication** section.
1. Click a follower service name to view its details.

The **Leader** and **Follower** chips below the service names identify the service roles.

## Promote a follower service to a standalone service

Promote a follower service to standalone status to enable it to operate independently
without replicating data from a leader service. This is useful for disaster recovery,
where replication needs to stop, and the follower service operates independently.
harshini-rangaswamy marked this conversation as resolved.
Show resolved Hide resolved

:::note
Promoting a follower service to standalone stops replication and deletes the
replication integration.
:::

<Tabs groupId="promote-cluster-method">
<TabItem value="Console" label="Aiven Console" default>

1. Log in to the [Aiven Console](https://console.aiven.io/), and select the
Aiven for OpenSearch service.
1. On the service's <ConsoleLabel name="overview" /> page, scroll to
the **Cross-cluster replica status** section.
1. Click the follower Aiven for OpenSearch service to promote.
1. On the follower service's <ConsoleLabel name="overview" /> page, click
**Promote to standalone** in the **Cross-cluster replica status**.
1. Click **Confirm** to complete the promotion.

The follower service is now a standalone service and can accept writes. You can set up
replication again if needed.

</TabItem>
<TabItem value="API" label="Aiven API">

To promote a follower service to standalone using the Aiven API,
delete the `opensearch_cross_cluster_replication` integration from the service.

```bash
curl -X DELETE https://api.aiven.io/v1/project/<PROJECT_NAME>/integration/<INTEGRATION_ID> \
-H "Authorization: Bearer <API_TOKEN>"
```

Parameters:

- `<PROJECT_NAME>`: Aiven project name.
- `<INTEGRATION_ID>`: ID of the `opensearch_cross_cluster_replication` integration.
- `<API_TOKEN>`: API authentication token.

Removing the integration transitions the follower service to a standalone service.

</TabItem>
<TabItem value="CLI" label="Aiven CLI">

To promote a follower service to standalone using the
[Aiven CLI](/docs/tools/cli), delete the `opensearch_cross_cluster_replication`
integration with the following command:

```bash
avn service integration-delete \
--project <PROJECT_NAME> \
--integration-id <INTEGRATION_ID>
```

Parameters:

- `<PROJECT_NAME>`: Aiven project name.
- `<INTEGRATION_ID>`: ID of the `opensearch_cross_cluster_replication` integration.

Deleting the integration transitions the follower service to a standalone service.

You can view all the follower cluster services configured for your
OpenSearch service either from the **Service integration** section on
the service **Overview** screen or in the **Integrations** tab.
Additionally, the OpenSearch services display **Leader** and
**Follower** tags below the service name to help identify leader cluster
and follower cluster services.
</TabItem>
<TabItem value="Terraform" label="Terraform">

## Setup cross-cluster replication via API
To promote a follower service to standalone using [Terraform](/docs/tools/terraform),
delete the `opensearch_cross_cluster_replication` integration from your configuration.

You can set up the cross cluster replication for Aiven for OpenSearch
service using the service integration endpoint and setting the
`integration-type` to `opensearch_cross_cluster_replication`. For more
information, see [Create new service
integration](https://api.aiven.io/doc/#tag/Service_Integrations).
```hcl
resource "aiven_service_integration" "ccr" {
project = "<PROJECT_NAME>"
integration_type = "opensearch_cross_cluster_replication"
source_service_name = "<LEADER_SERVICE_NAME>"
destination_service_name = "<FOLLOWER_SERVICE_NAME>"
}
```

## Setup cross-cluster replication via Terraform
Run `terraform apply` to apply the changes.
After the changes are applied, the follower service transitions to a standalone service.

You can set up the cross-cluster replication for Aiven for OpenSearch
service via the
[Aiven Terraform Provider](/docs/tools/terraform). Set the `integration-type` to
`opensearch_cross_cluster_replication` in the [Service Integration
resource](https://registry.terraform.io/providers/aiven/aiven/latest/docs/resources/service_integration).
</TabItem>
</Tabs>
Loading
Loading