Skip to content

Commit

Permalink
'modified: docs/how-to/h-async/h-async-remove-recover.md,docs/how-to/…
Browse files Browse the repository at this point in the history
…h-async/h-async-set-up.md,docs/how-to/h-connect-your-charm/h-connect-migrate-backup-restore.md,docs/how-to/h-async/h-async-integrate.md,docs/how-to/h-connect-your-charm/h-connect-migrate-pgdump.md,docs/how-to/h-connect-your-charm/h-integrate-with-your-charm.md,docs/index.md' (#609)

Co-authored-by: discourse-gatekeeper-docs-bot <[email protected]>
  • Loading branch information
github-actions[bot] and discourse-gatekeeper-docs-bot authored Aug 8, 2024
1 parent 95a9bc4 commit 1585c59
Show file tree
Hide file tree
Showing 7 changed files with 31 additions and 47 deletions.
17 changes: 6 additions & 11 deletions docs/how-to/h-async/h-async-integrate.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,4 @@
# Integrate with a client application
[note type="caution"]
This is an internal article. **Do not use it in production!**

Contact the [Canonical Data Platform team](https://chat.charmhub.io/charmhub/channels/data-platform) if you are interested in this topic.
[/note]

This guide will show you how to integrate a client application with a cross-regional async setup using an example PostgreSQL K8s deployment with two servers: one in Rome and one in Lisbon.

Expand All @@ -13,13 +8,13 @@ This guide will show you how to integrate a client application with a cross-regi
* Refer to the page [How to set up clusters](/t/13895)

## Summary
* [Configure database endpoints](#heading--configure-endpoints)
* [Internal client](#heading--internal-client)
* [External client](#heading--external-client)
* [Configure database endpoints](#configure-database-endpoints)
* [Internal client](#internal-client)
* [External client](#external-client)

---

<a href="#heading--configure-endpoints"><h2 id="heading--configure-endpoints"> Configure database endpoints </h2></a>
## Configure database endpoints

To make your database available to a client application, you must first offer and consume database endpoints.

Expand All @@ -46,7 +41,7 @@ juju consume rome.db1database
juju consume lisbon.db2database
```

<a href="#heading--internal-client"><h2 id="heading--internal-client"> Internal client </h2></a>
## Internal client

If the client application is another charm, deploy them and connect them with `juju integrate`.

Expand All @@ -62,7 +57,7 @@ juju relate postgresql-test-app:first-database pgbouncer-k8s
juju relate pgbouncer-k8s db1database
```

<a href="#heading--external-client"><h2 id="heading--external-client"> External client </h2></a>
## External client

If the client application is external, they must be integrated via the [`data-integrator` charm](https://charmhub.io/data-integrator).

Expand Down
25 changes: 10 additions & 15 deletions docs/how-to/h-async/h-async-remove-recover.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,4 @@
# Remove or recover a cluster
[note type="caution"]
This is an internal article. **Do not use it in production!**

Contact the [Canonical Data Platform team](https://chat.charmhub.io/charmhub/channels/data-platform) if you are interested in this topic.
[/note]

This guide will cover how to manage clusters (switchover, detach, reuse, remove, recover) using an example PostgreSQL deployment with two servers: one in Rome and one in Lisbon.

Expand All @@ -13,16 +8,16 @@ This guide will cover how to manage clusters (switchover, detach, reuse, remove,
* Refer to the page [How to set up clusters](/t/13895)

## Summary
* [Switchover](#heading--switchover)
* [Detach a cluster](#heading--detach)
* [Reuse a detached cluster](#heading--reuse)
* [Remove a detached cluster](#heading--remove)
* [Recover a cluster](#heading--recover)
* [Switchover](#switchover)
* [Detach a cluster](#detach-a-cluster)
* [Reuse a detached cluster](#reuse-a-detached-cluster)
* [Remove a detached cluster](#remove-a-detached-cluster)
* [Recover a cluster](#recover-a-cluster)

<!-- TODO: Rethink sections, especially "recover" -->
---

<a href="#heading--switchover"><h2 id="heading--switchover"> Switchover </h2></a>
## Switchover

If the primary cluster fails or is removed, it is necessary to appoint a new cluster as primary.

Expand All @@ -32,7 +27,7 @@ To switchover and promote `lisbon` to primary, one would run the command:
juju run -m lisbon db2/leader promote-to-primary
```

<a href="#heading--detach"><h2 id="heading--detach"> Detach a cluster </h2></a>
## Detach a cluster

Clusters in an async replica set can be detached. The detached cluster can then be either removed or reused.

Expand All @@ -44,21 +39,21 @@ juju remove-relation -m lisbon replication-offer db2:replication

The command above will move the `rome` cluster into a detached state (`blocked`) keeping all the data in place.

<a href="#heading--reuse"><h3 id="heading--reuse"> Reuse a detached cluster </h3></a>
### Reuse a detached cluster

The following command creates a new cluster in the replica set from the detached `rome` cluster, keeping its existing data in use:

```shell
juju run -m rome db1/leader promote-to-primary
```
<a href="#heading--remove"><h3 id="heading--remove"> Remove a detached cluster </h3></a>
### Remove a detached cluster

The following command removes the detached `rome` cluster and **destroys its stored data** with the optional `--destroy-storage` flag:

```shell
juju remove-application -m rome db1 --destroy-storage
```
<a href="#heading--recover"><h2 id="heading--recover"> Recover a cluster </h2></a>
## Recover a cluster

**If the integration between clusters was removed** and one side went into a `blocked` state, integrate both clusters again and call the `promote-cluster` action to restore async replication - similar to the "Reuse a detached cluster" step above.

Expand Down
26 changes: 10 additions & 16 deletions docs/how-to/h-async/h-async-set-up.md
Original file line number Diff line number Diff line change
@@ -1,25 +1,19 @@
# Set up clusters for cross-regional async replication

[note type="caution"]
This is an internal article. **Do not use it in production!**

Contact the [Canonical Data Platform team](https://chat.charmhub.io/charmhub/channels/data-platform) if you are interested in this topic.
[/note]

Cross-regional (or multi-server) asynchronous replication focuses on disaster recovery by distributing data across different servers.

This guide will show you the basics of initiating a cross-regional async setup using an example PostgreSQL K8s deployment with two servers: one in Rome and one in Lisbon.

## Summary
* [Deploy](#heading--deploy)
* [Offer](#heading--offer)
* [Consume](#heading--consume)
* [Promote or switchover](#heading--promote-switchover)
* [Scale](#heading--scale)
* [Deploy](#deploy)
* [Offer](#offer)
* [Consume](#consume)
* [Promote or switchover a cluster](#promote-or-switchover-a-cluster)
* [Scale a cluster](#scale-a-cluster)

---

<a href="#heading--deploy"><h2 id="heading--deploy"> Deploy </h2></a>
## Deploy

To deploy two clusters in different servers, create two juju models - one for the `rome` cluster, one for the `lisbon` cluster. In the example below, we use the config flag `profile=testing` to limit memory usage.

Expand All @@ -34,7 +28,7 @@ juju switch lisbon
juju deploy postgresql-k8s db2 --trust --channel=14/edge --config profile=testing --base [email protected]
```

<a href="#heading--offer"><h2 id="heading--offer"> Offer </h2></a>
## Offer

[Offer](https://juju.is/docs/juju/offer) asynchronous replication in one of the clusters.

Expand All @@ -43,7 +37,7 @@ juju switch rome
juju offer db1:replication-offer replication-offer
```

<a href="#heading--consume"><h2 id="heading--consume"> Consume </h2></a>
## Consume

Consume asynchronous replication on planned `Standby` cluster (Lisbon):
```shell
Expand All @@ -52,7 +46,7 @@ juju consume rome.replication-offer
juju integrate replication-offer db2:replication
```

<a href="#heading--promote-switchover"><h2 id="heading--promote-switchover"> Promote or switchover a cluster </h2></a>
## Promote or switchover a cluster

To define the primary cluster, use the `create-replication` action.

Expand All @@ -66,7 +60,7 @@ To switchover and use `lisbon` as the primary instead, run
juju run -m lisbon db2/leader promote-to-primary
```

<a href="#heading--scale"><h2 id="heading--scale"> Scale a cluster </h2></a>
## Scale a cluster

The two clusters work independently, which means that it’s possible to scale each cluster separately. The `-m` flag defines the target of this action, so it can be performed within any active model.

Expand Down
10 changes: 5 additions & 5 deletions docs/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -75,10 +75,10 @@ PostgreSQL is a trademark or registered trademark of PostgreSQL Global Developme
1. [Perform a major rollback](how-to/h-upgrade/h-rollback-major.md)
1. [Perform a minor upgrade](how-to/h-upgrade/h-upgrade-minor.md)
1. [Perform a minor rollback](how-to/h-upgrade/h-rollback-minor.md)
1. [Connect your charm](how-to/h-connect-your-charm)
1. [Integrate a database with your charm](how-to/h-connect-your-charm/h-integrate-with-your-charm.md)
1. [Migrate data via pg_dump](how-to/h-connect-your-charm/h-connect-migrate-pgdump.md)
1. [Migrate data via backup/restore](how-to/h-connect-your-charm/h-connect-migrate-backup-restore.md)
1. [Integrate with your charm](how-to/h-integrate-your-charm)
1. [Integrate a database with your charm](how-to/h-integrate-your-charm/h-integrate-db-with-your-charm.md)
1. [Migrate data via pg_dump](how-to/h-integrate-your-charm/h-integrate-migrate-pgdump.md)
1. [Migrate data via backup/restore](how-to/h-integrate-your-charm/h-integrate-migrate-backup-restore.md)
1. [Cross-regional async replication](how-to/h-async)
1. [Set up clusters](how-to/h-async/h-async-set-up.md)
1. [Integrate with a client app](how-to/h-async/h-async-integrate.md)
Expand All @@ -95,7 +95,7 @@ PostgreSQL is a trademark or registered trademark of PostgreSQL Global Developme
1. [Revision 73](reference/r-releases-group/r-releases-rev73.md)
1. [System requirements](reference/r-system-requirements.md)
1. [Software testing](reference/r-software-testing.md)
1. [Performance and resource allocation](reference/r-performance.md)
1. [Performance and resources](reference/r-performance.md)
1. [Troubleshooting](reference/h-troubleshooting.md)
1. [Plugins/extensions](reference/r-plugins-extensions.md)
1. [Contacts](reference/r-contacts.md)
Expand Down

0 comments on commit 1585c59

Please sign in to comment.