Skip to content

Commit

Permalink
cli instructions for crdr ops
Browse files Browse the repository at this point in the history
  • Loading branch information
wojcik-dorota committed Dec 2, 2024
1 parent d8b8af2 commit b61f208
Show file tree
Hide file tree
Showing 3 changed files with 93 additions and 10 deletions.
27 changes: 24 additions & 3 deletions docs/products/postgresql/crdr/crdr-failover-to-recovery.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,9 @@ limited: true
keywords: [recovery, primary, outage, failure, failover, CRDR, cross-region disaster recovery]
---

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

At the event of a region outage,
[failover](/docs/products/postgresql/crdr/crdr-overview#failover-to-the-recovery-region)
Expand All @@ -15,7 +17,8 @@ infrastructure, you can also perform a manual failover.
## Prerequisites

- [CRDR setup](/docs/products/postgresql/crdr/enable-crdr) up and running
- Access to the [Aiven Console](https://console.aiven.io/)
- Access to the [Aiven Console](https://console.aiven.io/) or
the [Aiven CLI client installed](/docs/tools/cli)

## Automatic failover

Expand All @@ -26,7 +29,10 @@ region outage.
## Fail over manually

Initiate a [manual failover](/docs/products/postgresql/crdr/crdr-overview#manual-switchover)
in the the [Aiven Console](https://console.aiven.io/):
using a tool of your choice:

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

1. Log in to the the [Aiven Console](https://console.aiven.io/), and go to your primary
Aiven for PostgreSQL service.
Expand All @@ -38,6 +44,21 @@ When the failover process is completed, your primary service is **Failed**, and
recovery service is **Active**, which means the recovery service is in control over your
workloads now.

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

Run [avn byoc update](/docs/tools/cli/service-cli#avn-cli-service-update):

```bash
avn service update PRIMARY_SERVICE_NAME \
--disaster-recovery-role failed
```

Replace `PRIMARY_SERVICE_NAME` with the name of the primary service, for example, `pg-demo`.

</TabItem>
</Tabs>

## Related pages

[Aiven for PostgreSQL® CRDR revert to the primary region](/docs/products/postgresql/crdr/crdr-revert-to-primary)
38 changes: 35 additions & 3 deletions docs/products/postgresql/crdr/crdr-revert-to-primary.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,20 +5,26 @@ limited: true
keywords: [recovery, primary, outage, failure, failover, CRDR, cross-region disaster recovery]
---

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

Shift your workloads back to the primary region, where your service was hosted originally before failing over to the recovery region. Restore your CRDR setup.

## Prerequisites

- [CRDR failover](/docs/products/postgresql/crdr/crdr-failover-to-recovery) completed
- Access to the [Aiven Console](https://console.aiven.io/)
- Access to the [Aiven Console](https://console.aiven.io/) or
the [Aiven CLI client installed](/docs/tools/cli)

## Revert to the primary region

Initiate a
[revert process](/docs/products/postgresql/crdr/crdr-overview#revert-to-the-primary-region)
in the the [Aiven Console](https://console.aiven.io/):
using a tool of your choice:

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

1. Log in to the the [Aiven Console](https://console.aiven.io/), and go to your primary
Aiven for PostgreSQL service.
Expand All @@ -41,6 +47,32 @@ in the the [Aiven Console](https://console.aiven.io/):

1. Click **Done**.

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

1. Restore the primary service by running
[avn byoc update](/docs/tools/cli/service-cli#avn-cli-service-update):

```bash
avn service update PRIMARY_SERVICE_NAME \
--disaster-recovery-role passive
```

Replace `PRIMARY_SERVICE_NAME` with the name of the primary service, for example, `pg-demo`.

1. Promote the primary service as active by running
[avn byoc update](/docs/tools/cli/service-cli#avn-cli-service-update):

```bash
avn service update PRIMARY_SERVICE_NAME \
--disaster-recovery-role active
```

Replace `PRIMARY_SERVICE_NAME` with the name of the primary service, for example, `pg-demo`.

</TabItem>
</Tabs>

## Related pages

[Aiven for PostgreSQL® CRDR failover to the recovery region](/docs/products/postgresql/crdr/crdr-failover-to-recovery)
38 changes: 34 additions & 4 deletions docs/products/postgresql/crdr/enable-crdr.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,9 @@ limited: true
keywords: [recovery, primary, outage, failure, failover]
---

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

Enable the [cross-region disaster recovery (CRDR)](/docs/products/postgresql/crdr/crdr-overview) feature in in Aiven for PostgreSQL® by creating a recovery service, which takes over from a primary service in case of region outage.

Expand All @@ -20,13 +22,16 @@ Enable the [cross-region disaster recovery (CRDR)](/docs/products/postgresql/crd
plan.
:::

- Access to the [Aiven Console](https://console.aiven.io/)
- Access to the [Aiven Console](https://console.aiven.io/) or
the [Aiven CLI client installed](/docs/tools/cli)

## Set up a recovery service

Create a [CRDR setup](/docs/products/postgresql/crdr/crdr-overview#crdr-setup) in the the
[Aiven Console](https://console.aiven.io/):
Create a [CRDR setup](/docs/products/postgresql/crdr/crdr-overview#crdr-setup) using
a tool of your choice:

<Tabs groupId="group1">
<TabItem value="console" label="Aiven Console" default>
1. Log in to the the [Aiven Console](https://console.aiven.io/), and go to your primary
Aiven for PostgreSQL service.
1. Click <ConsoleLabel name="disasterrecovery"/> in the sidebar.
Expand All @@ -39,6 +44,31 @@ Througout the process of creating the recovery service, the recovery service is
**Rebuilding** state. As soon as the recovery service is ready, its status changes to
**Passive**, which means your CRDR setup is up and running.

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

Run [avn byoc create](/docs/tools/cli/service-cli#avn-cli-service-create):

```bash
avn service create RECOVERY_SERVICE_NAME \
--service-type pg \
--plan SERVICE_PLAN \
--cloud CLOUD_REGION \
--disaster-recovery-copy-for PRIMARY_SERVICE_NAME
```

Replace the following:

- `RECOVERY_SERVICE_NAME` with the name of the recovery service, for example,
`pg-demo-recovery`
- `SERVICE_PLAN` with the plan to use for the recovery service, for example, `startup-4`
- `CLOUD_REGION` with the cloud region where to host the recovery service, for example,
`google-europe-west-4`
- `PRIMARY_SERVICE_NAME` with the name of the primary service, for example, `pg-demo`

</TabItem>
</Tabs>

## Related pages

- [Aiven for PostgreSQL® CRDR failover to the recovery region](/docs/products/postgresql/crdr/crdr-failover-to-recovery)
Expand Down

0 comments on commit b61f208

Please sign in to comment.