Skip to content

Commit 7db5a31

Browse files
github-actions[bot]upload-charms-docs-bot
andauthored
[discourse-gatekeeper] Migrate charm docs (#450)
* 'modified: docs/reference/r-releases-group/r-releases.md // new: docs/reference/r-releases-group/r-releases-rev232.md' * 'modified: docs/reference/r-releases-group/r-releases-rev232.md,docs/reference/r-releases-group/r-releases.md // removed: docs/reference/r-releases-group/r-releases-rev203.md' * 'modified: docs/reference/r-releases-group/r-releases.md // new: docs/reference/r-releases-group/r-releases-rev234.md' * 'new: docs/how-to/h-async/h-async-clients.md,docs/how-to/h-async/h-async-deployment.md,docs/how-to/h-async/h-async-fence.md,docs/how-to/h-async/h-async-failover.md,docs/how-to/h-async/h-async-recovery.md,docs/how-to/h-async/h-async-removal.md' * 'modified: docs/how-to/h-setup/h-deploy-maas.md' --------- Co-authored-by: upload-charms-docs-bot <[email protected]>
1 parent 19633f3 commit 7db5a31

File tree

11 files changed

+442
-53
lines changed

11 files changed

+442
-53
lines changed
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
# Clients for Async replication
2+
> **WARNING**: it is an '8.0/candidate' article. Do NOT use it in production!<br/>Contact [Canonical Data Platform team](/t/11867) if you are interested in the topic.
3+
4+
## Pre-requisits
5+
Make sure both `Rome` and `Lisbon` Clusters are deployed using the [Async Deployment manual](/t/14169)!
6+
7+
## Offer and consume DB endpoints
8+
```shell
9+
juju switch rome
10+
juju offer db1:database db1-database
11+
12+
juju switch lisbon
13+
juju offer db2:database db2-database
14+
15+
juju add-model app ; juju switch app
16+
juju consume rome.db1-database
17+
juju consume lisbon.db2-database
18+
```
19+
20+
## Internal Juju app/clients
21+
```shell
22+
juju switch app
23+
24+
juju deploy mysql-test-app
25+
juju deploy mysql-router --channel dpe/edge
26+
27+
juju relate mysql-test-app mysql-router
28+
juju relate mysql-router db1-database
29+
```
30+
31+
## External Juju clients
32+
```shell
33+
juju switch app
34+
35+
juju deploy data-integrator --config database-name=mydatabase
36+
juju deploy mysql-router mysql-router-external --channel dpe/edge
37+
38+
juju relate data-integrator mysql-router-external
39+
juju relate mysql-router-external db1-database
40+
41+
juju run data-integrator/leader get-credentials
42+
```
Lines changed: 86 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,86 @@
1+
# Deploy Async replication
2+
> **WARNING**: it is an '8.0/candidate' article. Do NOT use it in production!<br/>Contact [Canonical Data Platform team](/t/11867) if you are interested in the topic.
3+
4+
## Deploy
5+
6+
Deploy two MySQL Clusters, named `Rome` and `Lisbon`:
7+
```shell
8+
juju add-model rome # 1st cluster location: Rome
9+
juju add-model lisbon # 2nd cluster location: Lisbon
10+
11+
juju switch rome
12+
juju deploy mysql-k8s db1 --channel=8.0/candidate --config profile=testing --config cluster-name=rome --base [email protected]
13+
14+
juju switch lisbon
15+
juju deploy mysql-k8s db2 --channel=8.0/candidate --config profile=testing --config cluster-name=lisbon --base [email protected]
16+
```
17+
18+
[note type="caution"]
19+
**Note**: remove profile configuration for production deployments. Check [Profiles](/t/11973) for documentation.
20+
[/note]
21+
22+
## Offer
23+
24+
Offer asynchronous replication on the Primary cluster (Rome):
25+
```shell
26+
juju switch rome
27+
juju offer db1:async-primary async-primary
28+
```
29+
30+
(Optional) Offer asynchronous replication on StandBy cluster (Lisbon), for the future:
31+
```shell
32+
juju switch lisbon
33+
juju offer db2:async-primary async-primary
34+
```
35+
36+
## Consume
37+
38+
Consume asynchronous replication on planned `StandBy` cluster (Lisbon):
39+
```shell
40+
juju switch lisbon
41+
juju consume rome.async-primary
42+
juju integrate async-primary db2:async-replica
43+
```
44+
45+
(Optional) Consume asynchronous replication on the current `Primary` (Rome), for the future:
46+
```shell
47+
juju switch rome
48+
juju consume lisbon.async-primary
49+
```
50+
51+
## Status
52+
53+
Run the `get-cluster-status` action with the `cluster-set=True`flag:
54+
```shell
55+
juju run -m rome db1/0 get-cluster-status cluster-set=True
56+
```
57+
Results:
58+
```shell
59+
status:
60+
clusters:
61+
lisbon:
62+
clusterrole: replica
63+
clustersetreplicationstatus: ok
64+
globalstatus: ok
65+
rome:
66+
clusterrole: primary
67+
globalstatus: ok
68+
primary: 10.82.12.22:3306
69+
domainname: cluster-set-bcba09a4d4feb2327fd6f8b0f4ac7a2c
70+
globalprimaryinstance: 10.82.12.22:3306
71+
primarycluster: rome
72+
status: healthy
73+
statustext: all clusters available.
74+
success: "True"
75+
```
76+
77+
## Scaling
78+
The two clusters works independently, this means that it's possible to independently scaling in/out each cluster without much hassle, e.g.:
79+
```shell
80+
juju add-unit db1 -n 2 -m rome
81+
82+
juju add-unit db2 -n 2 -m lisbon
83+
```
84+
[note type="caution"]
85+
**Note**: The scaling is possible before and after the asynchronous replication established/created.
86+
[/note]
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
# Switchover / Failover of Async replication
2+
> **WARNING**: it is an '8.0/candidate' article. Do NOT use it in production!<br/>Contact [Canonical Data Platform team](/t/11867) if you are interested in the topic.
3+
4+
## Pre-requisits
5+
Make sure both `Rome` and `Lisbon` Clusters are deployed using the [Async Deployment manual](/t/14169)!
6+
7+
## Switchover (safe)
8+
Assuming `Rome` is currently `Primary` and you want to promote `Lisbon` to be new primary<br/>(`Rome` will be converted to `StandBy` member):
9+
```shell
10+
juju run -m lisbon db2/leader promote-standby-cluster cluster-set-name=<cluster-set-119185404c15ba547eb5f0750a5c34b5>
11+
```
12+
where `cluster-set-name` is a mandatory option to avoid human mistakes.
13+
14+
The cluster-set-name [can be set on deployment](https://charmhub.io/mysql/configure) and retrieved using:
15+
```
16+
juju run -m rome db1/0 get-cluster-status cluster-set=true
17+
18+
...
19+
domainname: cluster-set-bcba09a4d4feb2327fd6f8b0f4ac7a2c
20+
...
21+
```
22+
23+
## Failover (forced)
24+
25+
[note type="caution"]
26+
**Warning**: this is a **dangerous** operation which can cause the split-brain situation. It should be executed if Primary cluster is no longer exist (lost) ONLY! Otherwise please use safe switchover procedure above! Also consider [to fence the write traffic](/t/14173) BEFORE forcing emergency failover.
27+
[/note]
28+
29+
Assuming `Rome` was a `Primary` (before we lost the cluster `Rome`) and you want to promote `Lisbon` to be the new primary:
30+
```shell
31+
juju run -m lisbon db2/leader promote-standby-cluster cluster-set-name=<cluster-set-bcba09a4d4feb2327fd6f8b0f4ac7a2c> force=True
32+
```
33+
It's required to provide the `cluster-set-name` option as a foolproof method.
34+
35+
> **Warning**: The `force` will cause the old primary to be invalidated, make sure you have [fenced writes](/t/14173) there (fencing will reject all writes to the ClusterSet during the emergency failover)!

docs/how-to/h-async/h-async-fence.md

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
# Fencing Async replication
2+
> **WARNING**: it is an '8.0/candidate' article. Do NOT use it in production!<br/>Contact [Canonical Data Platform team](/t/11867) if you are interested in the topic.
3+
4+
## Pre-requisits
5+
Make sure both `Rome` and `Lisbon` Clusters are deployed using the [Async Deployment manual](/t/14169)!
6+
7+
## Fencing
8+
9+
In case of [emergency failover](/t/14171), and there is a risk of the transaction sets differing between parts of the ClusterSet. To avoid a split brain scenario, where more than one cluster is set as `primary`, it's important to fence all write traffic from the failed primary cluster. For doing so there's an action `fence-writes`:
10+
```
11+
juju run -m rome db1/leader fence-writes cluster-set-name=<my-cluster-set>
12+
```
13+
where `cluster-set-name` is a mandatory option to avoid human mistakes (see below).
14+
15+
> **Note**: The action `fence-writes` can be run against any of the Primary Cluster units.
16+
17+
## Unfencing
18+
19+
Case the old primary is reestablished and/or have all transactions reconciled, one can resume write traffic to it, by using the `unfence-writes` action, e.g.:
20+
```
21+
juju run -m rome db1/leader unfence-writes cluster-set-name=<my-cluster-set>
22+
```
23+
where `cluster-set-name` is a mandatory option to avoid human mistakes (see below).
24+
25+
## ClusterSet name:
26+
The `cluster-set-name` [can be set on deployment](https://charmhub.io/mysql/configure) and retrieved using:
27+
```
28+
juju run db1/0 get-cluster-status cluster-set=true
29+
30+
...
31+
domainname: cluster-set-bcba09a4d4feb2327fd6f8b0f4ac7a2c
32+
...
33+
```
34+
35+
## Extra
36+
You can find more details about fencing in official [MySQL ClusterSet documentation](https://dev.mysql.com/doc/mysql-shell/8.0/en/innodb-cluster-fencing.html).
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
# Recovery of Async replication
2+
> **WARNING**: it is an '8.0/candidate' article. Do NOT use it in production!<br/>Contact [Canonical Data Platform team](/t/11867) if you are interested in the topic.
3+
4+
## Pre-requisits
5+
Make sure both `Rome` and `Lisbon` Clusters are deployed using the [Async Deployment manual](/t/14169)!
6+
7+
## Recovery detached cluster
8+
9+
If relation between clusters was removed and one side went into detached/blocked state: simply relate async replication back to restore ClusterSet.
10+
11+
## Recovery lost cluster
12+
13+
If a Cluster has been lost and the ClusterSet need new member: deploy new db application and init async replication. The data will be copied automatically and the new Cluster will join ClusterSet.
14+
15+
## Recovery invalidated cluster
16+
17+
A cluster in the cluster-set gets invalidated when async replication auto-recovery fails on a disconnection event or when a failover is run against another cluster-set member while this cluster is unreachable. If the invalidated cluster connections is restored, it's status will be displayed in juju status as:
18+
19+
```
20+
App Version Status Scale Charm Channel Rev Address Exposed Message
21+
db2 8.0.36-0ubuntu0.22.04.1 active 3 mysql 8.0/edge 234 10.152.183.241 no
22+
23+
Unit Workload Agent Address Ports Message
24+
db2/0 active idle 10.1.124.208
25+
db2/1* active idle 10.1.124.203 Primary (standby, invalidated)
26+
db2/2 active idle 10.1.124.200
27+
```
28+
29+
Which indicates that connectivity is possible, but replication channel is stopped.
30+
To restore replication operation, run:
31+
32+
```shell
33+
juju run db2/leader rejoin-cluster cluster-name=rome
34+
```
35+
36+
Being `rome` the name of the invalidated cluster.
Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
# Removal of Async replication
2+
> **WARNING**: it is an '8.0/candidate' article. Do NOT use it in production!<br/>Contact [Canonical Data Platform team](/t/11867) if you are interested in the topic.
3+
4+
## Pre-requisits
5+
6+
Make sure both `Rome` and `Lisbon` Clusters are deployed using the [Async Deployment manual](/t/14169)!
7+
8+
## Detach Cluster from ClusterSet
9+
10+
> **Note**: It is important to [switchover](/t/14171) the `Primary` Cluster before detaching it from ClusterSet!
11+
12+
Assuming the `Lisbon` is a current `Primary` and we want to detach `Rome` (for removal or reuse):
13+
14+
```shell
15+
16+
juju remove-relation async-primary db2:async-replica
17+
18+
```
19+
20+
The command above will move cluster `Rome` into the detached state `blocked` keeping all the data in place.
21+
22+
All units in `Rome` will be in a standalone (non-clusterized) read-only state.
23+
24+
From this points, there are three options, as described in the following sections.
25+
26+
## Rejoin detached cluster into previous ClusterSet
27+
28+
At this stage, the detached/blocked cluster `Rome` can re-join the previous ClusterSet by restoring async integration/relation:
29+
30+
```shell
31+
32+
juju switch rome
33+
34+
juju integrate async-primary db1:async-replica
35+
36+
```
37+
38+
## Removing detached cluster
39+
40+
Remove no-longer necessary Cluster `Rome` (and destroy storage if Rome data is no longer necessary):
41+
42+
```shell
43+
44+
juju remove-application db1 # --destroy-storage
45+
46+
```
47+
48+
## New ClusterSet from detached Cluster
49+
50+
Convert `Rome` to the new Cluster/ClusterSet keeping the current data in use:
51+
52+
```shell
53+
54+
juju run -m rome db1/leader recreate-cluster
55+
56+
```

docs/how-to/h-setup/h-deploy-maas.md

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -120,15 +120,23 @@ juju bootstrap --constraints tags=juju maas-cloud maas-controller
120120

121121
# Deploy Charmed MySQL on MAAS
122122
```shell
123-
juju add-model mysql
124-
juju deploy mysql --channel 8.0/stable
123+
juju add-model mysql maas-cloud
124+
juju deploy mysql --channel 8.0/candidate # MAAS supported since charm revision 234+
125125
```
126-
<!--
127126
Sample `juju status` output:
128127
```shell
129-
TODO
128+
Model Controller Cloud/Region Version SLA Timestamp
129+
mysql maas-controller maas-cloud/default 3.1.8 unsupported 12:57:06+02:00
130+
131+
App Version Status Scale Charm Channel Rev Exposed Message
132+
mysql 8.0.36-0ubun... active 1 mysql 8.0/candidate 234 no
133+
134+
Unit Workload Agent Machine Public address Ports Message
135+
mysql/1* active idle 1 10.10.10.7 3306,33060/tcp Primary
136+
137+
Machine State Address Inst id Base AZ Message
138+
1 started 10.10.10.7 pumped-racer [email protected] default Deployed
130139
```
131-
-->
132140

133141
# Test your Charmed MySQL deployment
134142

docs/reference/r-releases-group/r-releases-rev203.md

Lines changed: 0 additions & 47 deletions
This file was deleted.

0 commit comments

Comments
 (0)