Charmed MySQL

  • By Canonical Data Platform
  • Cloud
Channel Revision Published Runs on
8.0/stable 240 20 Jun 2024
Ubuntu 22.04
8.0/candidate 240 17 Jun 2024
Ubuntu 22.04
8.0/beta 240 17 Jun 2024
Ubuntu 22.04
8.0/edge 255 Today
Ubuntu 22.04
8.0/edge 254 Today
Ubuntu 22.04
juju deploy mysql --channel 8.0/stable
Show information



Deploy Async replication

WARNING: it is an ‘8.0/edge’ article. Do NOT use it in production!
Contact Canonical Data Platform team if you are interested in the topic.


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 db1 --channel=8.0/edge --config profile=testing --config cluster-name=rome --base ubuntu@22.04

juju switch lisbon
juju deploy mysql db2 --channel=8.0/edge --config profile=testing --config cluster-name=lisbon --base ubuntu@22.04

Note: remove profile configuration for production deployments. Check Profiles for documentation.


Offer asynchronous replication on the Primary cluster (Rome):

juju switch rome
juju offer db1:replication-offer replication-offer

(Optional) Offer asynchronous replication on StandBy cluster (Lisbon), for the future:

juju switch lisbon
juju offer db2:replication-offer replication-offer


Consume asynchronous replication on planned StandBy cluster (Lisbon):

juju switch lisbon
juju consume rome.replication-offer
juju integrate replication-offer db2:replication

Once relations are established, cluster Rome will get into Blocked state, waiting for the replication to be created.

To do so, run the action create-replication on rome’s leader unit.

juju switch rome
juju run db1/leader create-replication

(Optional) Consume asynchronous replication on the current Primary (Rome), for the future:

juju switch rome
juju consume lisbon.replication-offer


Run the get-cluster-status action with the cluster-set=True flag:

juju run -m rome db1/0 get-cluster-status cluster-set=True


      clusterrole: replica
      clustersetreplicationstatus: ok
      globalstatus: ok
      clusterrole: primary
      globalstatus: ok
  domainname: cluster-set-bcba09a4d4feb2327fd6f8b0f4ac7a2c
  primarycluster: rome
  status: healthy
  statustext: all clusters available.
success: "True"


The two clusters works independently, this means that it’s possible to independently scaling in/out each cluster without much hassle, e.g.:

juju add-unit db1 -n 2 -m rome

juju add-unit db2 -n 2 -m lisbon

Note: The scaling is possible before and after the asynchronous replication established/created.