Charmed MySQL K8s
- By Canonical Data Platform
- Databases
Channel | Revision | Published | Runs on |
---|---|---|---|
8.0/stable | 127 | 22 Mar 2024 | |
8.0/candidate | 127 | 18 Mar 2024 | |
8.0/beta | 132 | 22 Mar 2024 | |
8.0/edge | 137 | 16 Apr 2024 |
juju deploy mysql-k8s --channel 8.0/stable
Deploy Kubernetes operators easily with Juju, the Universal Operator Lifecycle Manager. Need a Kubernetes cluster? Install MicroK8s to create a full CNCF-certified Kubernetes system in under 60 seconds.
Platform:
Deploy Async replication
WARNING: it is an internal article. Do NOT use it in production! Contact Canonical Data Platform team if you are interested in the topic.
Deploy
Deploy two MySQL Clusters, named Rome
and Lisbon
:
juju add-model rome # 1st cluster location: Rome
juju add-model lisbon # 2nd cluster location: Lisbon
juju switch rome
juju deploy mysql-k8s db1 --trust --channel=8.0/edge --config profile=testing --config cluster-name=rome --base ubuntu@22.04
juju switch lisbon
juju deploy mysql-k8s db2 --trust --channel=8.0/edge --config profile=testing --config cluster-name=lisbon --base ubuntu@22.04
Offer
Offer asynchronous replication on the Primary cluster (Rome):
juju switch rome
juju offer db1:async-primary async-primary
(Optional) Offer asynchronous replication on StandBy cluster (Lisbon), for the future:
juju switch lisbon
juju offer db2:async-primary async-primary
Consume
Consume asynchronous replication on planned StandBy
cluster (Lisbon):
juju switch lisbon
juju consume rome.async-primary
juju integrate async-primary db2:async-replica
(Optional) Consume asynchronous replication on the current Primary
(Rome), for the future:
juju switch rome
juju consume lisbon.async-primary
Status
Run the get-cluster-status
action with the cluster-set=True
flag:
juju run -m rome db1/0 get-cluster-status cluster-set=True
Results:
status:
clusters:
lisbon:
clusterrole: replica
clustersetreplicationstatus: ok
globalstatus: ok
rome:
clusterrole: primary
globalstatus: ok
primary: db1-0.db1-endpoints.rome.svc.cluster.local:3306
domainname: cluster-set-bcba09a4d4feb2327fd6f8b0f4ac7a2c
globalprimaryinstance: db1-0.db1-endpoints.rome.svc.cluster.local:3306
primarycluster: rome
status: healthy
statustext: all clusters available.
success: "True"
Scaling
The two clusters works independently, this means that it’s possible to independently scaling in/out each cluster without much hassle, e.g.:
juju scale-application db1 3 -m rome
juju scale-application db2 3 -m lisbon
Note: The scaling is possible before and after the asynchronous replication established/created.