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

feat: Point in time recovery (PITR) for BTAR #688

Open
wants to merge 6 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
12 changes: 5 additions & 7 deletions docs/platform/concepts/backup-to-another-region.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
---
title: About backup to another region for Aiven services
title: Backup to another region for Aiven services
limited: true
sidebar_label: About backup to another region
sidebar_label: Backup to another region
---

import RelatedPages from "@site/src/components/non-swizzled/RelatedPages";
Expand All @@ -13,8 +13,6 @@ This feature is in [limited availability](/docs/platform/concepts/beta_services)
Contact your account team to enable it.
:::

## About BTAR

Backup to another region (BTAR) is a disaster recovery feature that allows backup
files to be copied from the service's primary backup region to an additional (secondary)
region. BTAR can bolster data resilience and helps improve data protection against
Expand Down Expand Up @@ -79,10 +77,10 @@ flowchart LR
- BTAR is supported for Aiven for MySQL®, Aiven for PostgreSQL®, and Aiven for OpenSearch®.
- The cloud provider for your additional backup region must match the cloud provider for
your service and the primary backup.
<!-- - To
- To
[restore your service from an additional backup](/docs/platform/howto/btar/manage-backup-to-another-region)
using point-in-time recovery (PITR), set up the time to no later than the time of the
latest backup.-->
using point-in-time recovery (PITR), set up the time to no earlier than the time of
taking the oldest replicated base backup.
- Secondary backup can only be restored in the region where it was stored.
- Secondary backup is generated only after a primary backup is complete, and there might
be a data replication lag between the primary region and the secondary region.
Expand Down
27 changes: 15 additions & 12 deletions docs/platform/howto/btar/disable-backup-to-another-region.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,19 @@ limited: true
---

import ConsoleLabel from "@site/src/components/non-swizzled/ConsoleIcons";
import RelatedPages from "@site/src/components/non-swizzled/RelatedPages"
import RelatedPages from "@site/src/components/non-swizzled/RelatedPages";
import Tabs from '@theme/Tabs';
import TabItem from '@theme/TabItem';

Delete an [additional service backup](/docs/platform/concepts/backup-to-another-region) [created](/docs/platform/howto/btar/enable-backup-to-another-region) in a region different from your primary backup region.

You can delete a cross-region backup using the Aiven [console](#delete-btar-console),
[CLI](#delete-btar-cli), or [API](#delete-btar-api).

## Delete backup via console {#delete-btar-console}
You can delete a cross-region backup using the [Aiven Console](/docs/tools/aiven-console),
[API](/docs/tools/api), or [CLI](/docs/tools/cli). When you delete
the additional cross-region backup, you still have the default backup located in the
primary (service-hosting) region.

<Tabs groupId="group1">
<TabItem value="gui" label="Aiven Console" default>
1. Log in to the [Aiven Console](https://console.aiven.io/).
1. From the **Services** view, select an Aiven service on which you'd like to disable BTAR.
1. On your service's page, select **Backups** from the sidebar.
Expand All @@ -22,9 +26,8 @@ You can delete a cross-region backup using the Aiven [console](#delete-btar-cons

Your additional service backup is no longer visible on your service's **Backups** page in
the **Secondary backup location** column.

## Delete backup with CLI {#delete-btar-cli}

</TabItem>
<TabItem value="cli" label="Aiven CLI">
To remove secondary backups for your service, use the
[avn service update](/docs/tools/cli/service-cli) command to remove all target regions names
from the `additional_backup_regions` array.
Expand All @@ -34,8 +37,8 @@ avn service update your-sevice-name \
-c additional_backup_regions=\[\]
```

## Delete backup with API {#delete-btar-api}

</TabItem>
<TabItem value="api" label="Aiven API">
To remove secondary backups for your service, update the service configuration. Use the
[ServiceUpdate](https://api.aiven.io/doc/#tag/Service/operation/ServiceUpdate) endpoint
to remove all target regions names from the `additional_backup_regions` array.
Expand All @@ -53,8 +56,8 @@ curl --request PUT
}'
```

The additional cross-region backup has been deleted. You still have the default backup
located in the primary (service-hosting) region.
</TabItem>
</Tabs>

<RelatedPages/>

Expand Down
152 changes: 84 additions & 68 deletions docs/platform/howto/btar/enable-backup-to-another-region.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,24 @@ sidebar_label: Add cross-region backup
limited: true
---

import ConsoleLabel from "@site/src/components/non-swizzled/ConsoleIcons"
import RelatedPages from "@site/src/components/non-swizzled/RelatedPages"
import CreateService from "@site/static/includes/create-service-console.md";
import ConsoleLabel from "@site/src/components/non-swizzled/ConsoleIcons";
import RelatedPages from "@site/src/components/non-swizzled/RelatedPages";
import Tabs from '@theme/Tabs';
import TabItem from '@theme/TabItem';

Enable [the backup to another region (BTAR) feature](/docs/platform/concepts/backup-to-another-region) and create an additional cross-region service backup on top of a regular backup stored in the region where your service is hosted.

:::important
BTAR is supported for Aiven for MySQL®, Aiven for PostgreSQL®, and Aiven for OpenSearch®.
:::

To add an additional service backup for your service, you can use the Aiven
[Console](#enable-btar-console), [CLI](#enable-btar-cli), or [API](#enable-btar-api).
To add an additional service backup for your service, you can use the Aiven Console, CLI,
or API. You can enable BTAR for

- [New Aiven service](/docs/platform/howto/btar/enable-backup-to-another-region#add-a-cross-region-backup-to-a-new-service)
or
- [Existing Aiven service](/docs/platform/howto/btar/enable-backup-to-another-region#add-a-cross-region-backup-to-an-existing-service)

## Prerequisites

Expand All @@ -24,20 +31,23 @@ To add an additional service backup for your service, you can use the Aiven
- Depending on your preferred tool to manage BTAR with, make sure you can access or use:

- [Aiven Console](https://console.aiven.io/)
- [Aiven CLI client](/docs/tools/cli)
- [cURL](https://curl.se/download.html) CLI tool
- [Aiven CLI](/docs/tools/cli)
- [Aiven API](/docs/tools/api)

## Back up to another region via console {#enable-btar-console}
## Add a cross-region backup to an existing service

1. Log in to the [Aiven Console](https://console.aiven.io/).
1. From the <ConsoleLabel name="serviceusers"/> view, select an Aiven service on
which you'd like to enable BTAR.
1. On your service's page, click <ConsoleLabel name="backups"/> from the sidebar.
<Tabs groupId="group1">
<TabItem value="gui" label="Aiven Console" default>
1. Log in to the [Aiven Console](https://console.aiven.io/) and go to your project page.
1. From <ConsoleLabel name="Services"/>, select an Aiven service on which you'd like to
enable BTAR.
1. On your service's page, click <ConsoleLabel name="backups"/> in the sidebar.
1. On the **Backups** page, click <ConsoleLabel name="actions"/> >
**Secondary backup location**.
1. In the **Secondary backup location** window, use the **Secondary location** menu to
**Add secondary backup location**.
1. In the **Add secondary backup location** window, toggle the
**Secondary backup location enabled** switch and use the **Backup location** menu to
choose a region for your additional backup.
1. Click **Enable** to confirm your selection.
1. Click **Save** to confirm your selection.

:::tip
For names of the cloud regions supported in Aiven, see column *Cloud* in
Expand All @@ -46,21 +56,68 @@ To add an additional service backup for your service, you can use the Aiven

Your new additional backup is now visible on your service's **Backups** page in the
**Secondary backup location** column.
</TabItem>
<TabItem value="cli" label="Aiven CLI">
Use the [avn service update](/docs/tools/cli/service-cli) command to configure your
service so that it supports BTAR. Include `additional_backup_regions` as a parameter to
the command and set its value to the name of desired cloud region.

## Back up to another region with CLI {#enable-btar-cli}
```bash
avn service update name_of_existing_service \
-c additional_backup_regions=[\"name_of_cloud_region\"]
```
</TabItem>
<TabItem value="api" label="Aiven API">
Use the [ServiceUpdate](https://api.aiven.io/doc/#tag/Service/operation/ServiceUpdate) API
to configure your existing service so that it supports BTAR. When constructing the API
request, add the `user_config` object to the request body and nest the
`additional_backup_regions` field inside. Set the value of the
`additional_backup_regions` parameter to the name of desired cloud region.

Using the [Aiven CLI client](/docs/tools/cli), you can enable BTAR for
```bash
curl --request PUT \
--url https://api.aiven.io/v1/project/YOUR_PROJECT_NAME/service/YOUR_SERVICE_NAME \
--header 'Authorization: Bearer YOUR_BEARER_TOKEN' \
--header 'content-type: application/json' \
--data
'{
"user_config": {
"additional_backup_regions": ["cloud-region-name"]
}
}'
```

- [New Aiven service](#new-service-cli) or
- [Existing Aiven service](#existing-service-cli)
</TabItem>
</Tabs>

:::note[additional_backup_regions]
To enable BTAR on an Aiven service, add the `additional_backup_regions`
parameter to relevant commands.
:::
## Add a cross-region backup to a new service

<Tabs groupId="group1">
<TabItem value="gui" label="Aiven Console" default>

#### Step 1: Create a service

### Create a service with BTAR via CLI {#new-service-cli}
<CreateService/>

#### Step 2: Add a backup for the new service

1. On your service's page, click <ConsoleLabel name="backups"/> in the sidebar.
1. On the **Backups** page, click <ConsoleLabel name="actions"/> >
**Add secondary backup location**.
1. In the **Add secondary backup location** window, toggle the
**Secondary backup location enabled** switch and use the **Backup location** menu to
choose a region for your additional backup.
1. Click **Save** to confirm your selection.

:::tip
For names of the cloud regions supported in Aiven, see column *Cloud* in
[List of available cloud regions](/docs/platform/reference/list_of_clouds).
:::

Your new additional backup is now visible on your service's **Backups** page in the
**Secondary backup location** column.
</TabItem>
<TabItem value="cli" label="Aiven CLI">
Use the [avn service create](/docs/tools/cli/service-cli) command to create a
service. Include `additional_backup_regions` as a parameter to the command and set its
value to the name of the desired cloud region.
Expand All @@ -74,31 +131,8 @@ avn service create \
new_service_name
```

### Enable BTAR on an existing service via CLI {#existing-service-cli}

Use the [avn service update](/docs/tools/cli/service-cli) command to configure your
service so that it supports BTAR. Include `additional_backup_regions` as a parameter to
the command and set its value to the name of desired cloud region.

```bash
avn service update name_of_existing_service \
-c additional_backup_regions=[\"name_of_cloud_region\"]
```

## Back up to another region with API {#enable-btar-api}

Using [Aiven APIs](/docs/tools/api), you can enable BTAR for:

- [New Aiven service](#new-service-api) or
- [Existing Aiven service](#existing-service-api)

:::note[additional_backup_regions]
To enable BTAR on an Aiven service, include the `additional_backup_regions`
parameter in relevant calls.
:::

### Create a service with BTAR via API {#new-service-api}

</TabItem>
<TabItem value="api" label="Aiven API">
Use the [ServiceCreate](https://api.aiven.io/doc/#tag/Service/operation/ServiceCreate) API
to create a service with BTAR enabled. When constructing the API request, add the
`user_config` object to the request body and nest the `additional_backup_regions`
Expand All @@ -121,26 +155,8 @@ curl --request POST \
}'
```

### Enable BTAR on an existing service via API {#existing-service-api}

Use the [ServiceUpdate](https://api.aiven.io/doc/#tag/Service/operation/ServiceUpdate) API
to configure your existing service so that it supports BTAR. When constructing the API
request, add the `user_config` object to the request body and nest the
`additional_backup_regions` field inside. Set the value of the
`additional_backup_regions` parameter to the name of desired cloud region.

```bash
curl --request PUT \
--url https://api.aiven.io/v1/project/YOUR_PROJECT_NAME/service/YOUR_SERVICE_NAME \
--header 'Authorization: Bearer YOUR_BEARER_TOKEN' \
--header 'content-type: application/json' \
--data
'{
"user_config": {
"additional_backup_regions": ["cloud-region-name"]
}
}'
```
</TabItem>
</Tabs>

<RelatedPages/>

Expand Down
Loading