|
| 1 | +# Deploy on Juju spaces |
| 2 | + |
| 3 | +The Charmed MySQL operator supports [Juju spaces](https://documentation.ubuntu.com/juju/latest/reference/space/index.html) to separate network traffic for: |
| 4 | +- **Client** - MySQL instance to client data. |
| 5 | +- **Instance-replication** - cluster instances replication data. |
| 6 | +- **Cluster-replication** - cluster to cluster replication data. |
| 7 | +- **Backup** - backup and restore data. |
| 8 | + |
| 9 | +## Prerequisites |
| 10 | + |
| 11 | +* Charmed MySQL revision 380+ |
| 12 | +* Configured network spaces |
| 13 | + * See [Juju | How to manage network spaces](https://documentation.ubuntu.com/juju/latest/reference/juju-cli/list-of-juju-cli-commands/add-space/) |
| 14 | + |
| 15 | +## Deploy |
| 16 | + |
| 17 | +On application deployment, constraints are required to ensure the unit(s) have address(es) on the specified network space(s), and endpoint binding(s) for the space(s). |
| 18 | + |
| 19 | +For example, with spaces configured for instance replication and client traffic: |
| 20 | +```text |
| 21 | +❯ juju spaces |
| 22 | +Name Space ID Subnets |
| 23 | +alpha 0 10.163.154.0/24 |
| 24 | +client 1 10.0.0.0/24 |
| 25 | +peers 2 10.10.10.0/24 |
| 26 | +``` |
| 27 | + |
| 28 | +The space `alpha` is default and cannot be removed. To deploy Charmed MySQL operator using the spaces: |
| 29 | +```text |
| 30 | +juju deploy mysql --channel 8.0/edge \ |
| 31 | + --constraints spaces=client,peers \ |
| 32 | + --bind "database-peers=peers database=client" |
| 33 | +``` |
| 34 | + |
| 35 | +[note type=caution] |
| 36 | +Currently there's no support for the juju `bind` command. Network space binding must be defined at deploy time only. |
| 37 | +[/note] |
| 38 | + |
| 39 | +Consequently, a client application must use the `client` space on the model, or a space for the same subnet in another model, for example: |
| 40 | +```text |
| 41 | +juju deploy client-app \ |
| 42 | + --constraints spaces=client \ |
| 43 | + --bind database=client |
| 44 | +``` |
| 45 | + |
| 46 | +The two application can be then related using: |
| 47 | +```text |
| 48 | +juju integrate mysql:database client-app:database |
| 49 | +``` |
| 50 | + |
| 51 | +The client application will receive network endpoints on the `10.0.0.0/24` subnet. |
| 52 | + |
| 53 | +The Charmed MySQL operator endpoints are: |
| 54 | + |
| 55 | +| Endpoint | Traffic | |
| 56 | +| ------------------------------ | -------------------- | |
| 57 | +| database | Client | |
| 58 | +| database-peers | Instance-replication | |
| 59 | +| replication-offer, replication | Cluster-replication | |
| 60 | +| s3-parameters | Backup | |
| 61 | + |
| 62 | + |
| 63 | +[note] |
| 64 | +If using a network space for the backup traffic, the user is responsible for ensuring that the target object storage URL traffic is routed via the specified network space. |
| 65 | +[/note] |
0 commit comments