How to deploy¶
For more thorough, guided instructions on setting up your environment and deploying MySQL Router, see the Tutorial.
Set up a cloud¶
To deploy via the Juju CLI, you need to first bootstrap a cloud controller and create a model:
juju bootstrap <cloud name> <controller name>
juju add-model <model name>
Deploy¶
Deploy MySQL and MySQL Router, and integrate them:
juju deploy mysql --channel 8.0/stable
juju deploy mysql-router --channel dpe/edge
juju integrate mysql mysql-router
juju deploy mysql-k8s --channel 8.0/stable --trust
juju deploy mysql-router-k8s --channel 8.0/stable --trust
juju integrate mysql-k8s mysql-router-k8s
Deploy and integrate your client application with MySQL Router.
Note
If your client application is not a charm, you’ll need to use data-integrator. See:
For this example, we’ll use the mysql-test-app charm:
juju deploy mysql-test-app
juju integrate mysql-router mysql-test-app:database
Example output of juju status --watch 1s with a deployment in a local LXD cloud:
Model Controller Cloud/Region Version SLA Timestamp
mysql lxd localhost/localhost 3.1.6 unsupported 11:57:33+02:00
App Version Status Scale Charm Channel Rev Exposed Message
mysql 8.0.34-0ubun... active 1 mysql 8.0/stable 196 no
mysql-router 8.0.34-0ubun... active 1 mysql-router dpe/edge 119 no
mysql-test-app 0.0.2 active 1 mysql-test-app stable 26 no
Unit Workload Agent Machine Public address Ports Message
mysql-test-app/0* active idle 1 10.3.217.209
mysql-router/0* active idle 10.3.217.209
mysql/0* active idle 0 10.3.217.119 3306,33060/tcp Primary
Machine State Address Inst id Base AZ Message
0 started 10.3.217.119 juju-d458a0-0 ubuntu@22.04 Running
1 started 10.3.217.209 juju-d458a0-1 ubuntu@22.04 Running
For this example, we’ll use the wordpress-k8s charm:
juju deploy wordpress-k8s
juju integrate mysql-router wordpress-k8s:database
Example output of juju status --watch 1s with a deployment in a local MicroK8s cloud:
Model Controller Cloud/Region Version SLA Timestamp
wordpress-demo microk8s microk8s/localhost 3.1.6 unsupported 14:39:27+02:00
App Version Status Scale Charm Channel Rev Address Exposed Message
mysql-k8s 8.0.34-0ubuntu0.22.04.1 active 1 mysql-k8s 8.0/stable 99 10.152.183.189 no
mysql-router-k8s 8.0.34-0ubuntu0.22.04.1 blocked 1 mysql-router-k8s 8.0/stable 69 10.152.183.81 no Missing relation: database
Unit Workload Agent Address Ports Message
mysql-k8s/0* active idle 10.1.12.61 Primary
mysql-router-k8s/0* active idle 10.1.12.16