Skip to content

Commit

Permalink
add: Redis CCR feature
Browse files Browse the repository at this point in the history
  • Loading branch information
harshini-rangaswamy committed May 28, 2024
1 parent 8776c2c commit fc99471
Show file tree
Hide file tree
Showing 3 changed files with 190 additions and 8 deletions.
51 changes: 51 additions & 0 deletions docs/products/caching/concepts/redis-ccr.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
---
title: Aiven for Redis®* cross-cluster replication
sidebar_label: Redis CCR
pro: true
---

Aiven for Redis®* Cross-Cluster Replication (CCR) feature replicates data from a primary to a replica cluster across various DNS, clouds, or regions, improving data availability and aiding in disaster recovery.

## Features and benefits

- **High availability:** By replicating data across clusters in different locations,
Aiven for Redis CCR ensures that your application remains available even if one
cluster goes down.
- **Disaster recovery:** Automatic promotion of the follower cluster to leader status in
case of the primary/main cluster's failure provides a robust disaster
recovery mechanism.
- **Geographical distribution:** With the ability to work across all clouds and regions,
Aiven for Redis CCR keeps data closer to your users, reducing latency and improving
the user experience.

## How CCR works

Aiven for Redis uses an **active-passive replication model** for its CCR feature,
ensuring high availability and data resilience across deployments.

**Replication process:** The replication process involves two services - the primary and
replica services. The system automatically and asynchronously copies any new data you
add to the primary service to the replica service. The primary service manages all
read and write operations for optimal performance and data consistency under
normal conditions.

**Handling failures:** In case of any failure of the primary service, Aiven provides
automatic failover functionality, which promotes the replica service to become
the new primary, maintaining service continuity.

However, to fully resume normal operations, you must manually update your application’s
connection settings to point to the new primary service.

## Limitations

- This feature requires `[Pro Platform](/docs/platform/concepts/pro-platform)`.
- Aiven for Redis CCR follows an active-passive model, which means that only the data
ingested in the primary service gets replicated.
- Aiven for Redis services only support replication within their own service type.
Cross-service replication to or from Aiven for Dragonfly services is not supported.
- Enabling up CCR for Aiven for Redis is only possible via API/CLI, with console support
planned for future releases.

## Related pages

- [Enable cross-cluster replication for Aiven for Redis](/docs/products/redis/howto/enable-redis-ccr)
129 changes: 129 additions & 0 deletions docs/products/caching/howto/enable-redis-ccr.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,129 @@
---
title: Enable cross-cluster replication in Aiven for Redis®*
sidebar_label: Enable CCR
pro: true
---
[Aiven for Redis cross-cluster replication (CCR)](/docs/products/redis/concepts/redis-ccr) feature enables data replication from a primary to a replica service, ensuring high availability and disaster recovery. Learn how to enable CCR for your Aiven for Redis service, verify data replication, and manage failovers.


## Prerequisites

- This feature requires `[Pro Platform](/docs/platform/concepts/pro-platform)`.
- An Aiven account and API token
- [Aiven CLI tool](https://github.com/aiven/aiven-client)
- Two Aiven for Redis services within your Aiven project: one designated as the *primary*
and the other as the *replica*

## Enable CCR via API

To enable CCR for your Aiven for Redis service via API, follow these steps:

1. **Create the primary service:** Start by creating your primary Aiven for Redis service.
This service acts as the primary (leader) in the replication setup. Use the
following Aiven API call to create the service:

```shell
curl -X POST https://api.aiven.io/v1/project/PROJECT_NAME/service \
-H "Content-Type: application/json" \
-H "Authorization: bearer YOUR_AUTH_TOKEN" \
-d '{
"cloud": "CLOUD_NAME",
"plan": "business-4",
"service_name": "PRIMARY_SERVICE_NAME",
"service_type": "redis",
"project": "PROJECT_NAME"
}'
```

Replace the placeholders with your actual values:

- `PROJECT_NAME`: The name of your project.
- `YOUR_AUTH_TOKEN`: Your API authentication token.
- `CLOUD_NAME`: The name of the cloud you want to use.
- `PRIMARY_SERVICE_NAME`: The name you want to give to your primary service.
- `YOUR_AUTH_TOKEN`: Your API authentication token.

1. **Confirm primary service backups:** Before creating a replica service, verify that
your primary Aiven for Redis service has a backup.
[Configuring backups](/docs/platform/concepts/service_backups#aiven-for-redis)
is essential to ensure data consistency and integrity for replication.

1. **Create the replica service:** Next, create the Aiven for Redis service that acts as
the replica. Specify the primary service as the source for replication using the
following API call:

```shell
curl -X POST https://api.aiven.io/v1/project/PROJECT_NAME/service \
-H "Content-Type: application/json" \
-H "Authorization: bearer YOUR_AUTH_TOKEN" \
-d '{
"cloud": "CLOUD_NAME",
"plan": "startup-4",
"service_name": "REPLICA_SERVICE_NAME",
"service_type": "redis",
"project": "PROJECT_NAME",
"service_integrations": [
{
"integration_type": "read_replica",
"source_service_name": "PRIMARY_SERVICE_NAME"
}
]
}'
```

Replace the placeholders with your actual values:

- `PROJECT_NAME`: The name of your project.
- `YOUR_AUTH_TOKEN`: Your API authentication token.
- `CLOUD_NAME`: The name of the cloud you want to use.
- `REPLICA_SERVICE_NAME`: The name you want to give to your replica service.
- `PRIMARY_SERVICE_NAME`: The name of your primary service.

## Enable CCR via CLI

You can also use the Aiven CLI to enable CCR for your Aiven for Redis service.

1. **Create the primary service**: Execute the command below to create the primary
(leader) Aiven for Redis service:

```bash
avn service create <replica-service-name> --project <project-name> -t redis --plan startup-4 --cloud <cloud-name> \
--service-integration source_service=<main-service-name>,integration_type=read_replica
```

Replace the placeholders with your actual values:

- `PRIMARY_SERVICE_NAME`: The name of your primary service.
- `PROJECT_NAME`: The name of your project.
- `CLOUD_NAME`: The name of the cloud you want to use.

1. **Confirm primary service backups:** Before creating a replica service, verify that
your primary Aiven for Redis service has a backup.
[Configuring backups](/docs/platform/concepts/service_backups#aiven-for-redis) is
essential to ensure data consistency and integrity for replication.

1. **Create the replica service:** Use the following CLI command to create the replica
service with the correct replication settings:

```bash
avn service create REPLICA_SERVICE_NAME --project PROJECT_NAME -t redis --plan startup-4 --cloud CLOUD_NAME \
--service-integration source_service=PRIMARY_SERVICE_NAME,integration_type=read_replica
```

Replace the placeholders with your actual values:

- `REPLICA_SERVICE_NAME`: The name you want to give to your replica service.
- `PROJECT_NAME`: The name of your project.
- `CLOUD_NAME`: The name of the cloud you want to use.
- `PRIMARY_SERVICE_NAME`: The name of your primary service.

## Verify data replication

After setting up the replica, ensure that data entered into the primary Aiven for Redis
service is successfully replicated to the replica service.

## Manage failover

If the primary service fails, Aiven automatically promotes the replica service to the
new primary. Update your application's connection details to connect to this new primary
service to maintain smooth operations.
18 changes: 10 additions & 8 deletions sidebars.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2076,10 +2076,11 @@ const sidebars: SidebarsConfig = {
slug: 'products/caching/concepts',
},
items: [
'products/caching/concepts/high-availability-redis',
'products/caching/concepts/lua-scripts-caching',
'products/caching/concepts/memory-usage',
'products/caching/concepts/restricted-redis-commands',
'products/redis/concepts/high-availability-redis',
'products/redis/concepts/lua-scripts-redis',
'products/redis/concepts/memory-usage',
'products/redis/concepts/restricted-redis-commands',
'products/redis/concepts/redis-ccr',
],
},
{
Expand Down Expand Up @@ -2124,10 +2125,11 @@ const sidebars: SidebarsConfig = {
'products/caching/howto/migrate-redis-aiven-via-console',
],
},
'products/caching/howto/estimate-max-number-of-connections',
'products/caching/howto/manage-ssl-connectivity',
'products/caching/howto/warning-overcommit_memory',
'products/caching/howto/benchmark-performance',
'products/redis/howto/estimate-max-number-of-connections',
'products/redis/howto/manage-ssl-connectivity',
'products/redis/howto/warning-overcommit_memory',
'products/redis/howto/benchmark-performance',
'products/redis/howto/enable-redis-ccr',
],
},
{
Expand Down

0 comments on commit fc99471

Please sign in to comment.