Mysql Router

  • By MySQL Charm Maintainers
  • Cloud
Channel Revision Published Runs on
latest/edge 252 02 Oct 2024
Ubuntu 24.04 Ubuntu 23.10 Ubuntu 23.04 Ubuntu 22.10 Ubuntu 22.04 Ubuntu 20.04
latest/edge 251 02 Oct 2024
Ubuntu 24.04 Ubuntu 23.10 Ubuntu 23.04 Ubuntu 22.10 Ubuntu 22.04 Ubuntu 20.04
latest/edge 250 02 Oct 2024
Ubuntu 24.04 Ubuntu 23.10 Ubuntu 23.04 Ubuntu 22.10 Ubuntu 22.04 Ubuntu 20.04
latest/edge 249 02 Oct 2024
Ubuntu 24.04 Ubuntu 23.10 Ubuntu 23.04 Ubuntu 22.10 Ubuntu 22.04 Ubuntu 20.04
latest/edge 201 19 Jun 2024
Ubuntu 24.04 Ubuntu 23.10 Ubuntu 23.04 Ubuntu 22.10 Ubuntu 22.04 Ubuntu 20.04
latest/edge 108 12 Sep 2023
Ubuntu 24.04 Ubuntu 23.10 Ubuntu 23.04 Ubuntu 22.10 Ubuntu 22.04 Ubuntu 20.04
latest/edge 62 10 Feb 2023
Ubuntu 24.04 Ubuntu 23.10 Ubuntu 23.04 Ubuntu 22.10 Ubuntu 22.04 Ubuntu 20.04
8.0/stable 245 25 Sep 2024
Ubuntu 22.04 Ubuntu 20.04
dpe/candidate 225 28 Aug 2024
Ubuntu 22.04 Ubuntu 20.04
dpe/candidate 224 28 Aug 2024
Ubuntu 22.04 Ubuntu 20.04
dpe/candidate 223 28 Aug 2024
Ubuntu 22.04 Ubuntu 20.04
dpe/beta 225 23 Aug 2024
Ubuntu 22.04 Ubuntu 20.04
dpe/beta 224 23 Aug 2024
Ubuntu 22.04 Ubuntu 20.04
dpe/beta 223 23 Aug 2024
Ubuntu 22.04 Ubuntu 20.04
dpe/edge 248 30 Sep 2024
Ubuntu 22.04 Ubuntu 20.04
dpe/edge 247 30 Sep 2024
Ubuntu 22.04 Ubuntu 20.04
dpe/edge 246 30 Sep 2024
Ubuntu 22.04 Ubuntu 20.04
8.0.19/stable 26 05 May 2022
Ubuntu 22.04 Ubuntu 20.04
8.0.19/edge 26 05 May 2022
Ubuntu 22.04 Ubuntu 21.10 Ubuntu 21.04 Ubuntu 20.10 Ubuntu 20.04
8.0.19/edge 15 26 Apr 2022
Ubuntu 22.04 Ubuntu 21.10 Ubuntu 21.04 Ubuntu 20.10 Ubuntu 20.04
juju deploy mysql-router --channel dpe/edge
Show information

Platform:

Ubuntu
24.04 23.10 23.04 22.10 22.04 21.10 21.04 20.10 +1

Note: All commands are written for juju >= v3.0

How to enable monitoring with COS and Grafana

This guide goes over the steps to integrate your MySQL Router deployment with COS to enable monitoring in Grafana.

To learn about Alert Rules, see Charmed MySQL > How to enable COS Alert Rules.

Prerequisites

Summary


Offer interfaces via the COS controller

First, we will switch to the COS K8s environment and offer COS interfaces to be cross-model integrated with the Charmed MySQLRouter VM model.

To switch to the Kubernetes controller for the COS model, run

juju switch <k8s_controller>:<cos_model_name>

To offer the COS interfaces, run

juju offer grafana:grafana-dashboard
juju offer loki:logging
juju offer prometheus:receive-remote-write

Consume offers via the MySQL Router model

Next, we will switch to the Charmed MySQL Router model, find offers, and consume them.

We are currently on the Kubernetes controller for the COS model. To switch to the MySQL Router model, run

juju switch <machine_controller_name>:<mysql_router_model_name>

Display a list of available interfaces with the following command:

juju find-offers <k8s_controller>:  # Do not miss ':' here

In the sample output below, k8s is the k8s controller name and cos is the model where cos-lite has been deployed:

Store  URL               	Access  Interfaces
k8s	admin/cos.grafana 	admin   grafana_dashboard:grafana-dashboard
k8s	admin/cos.loki    	admin   loki_push_api:logging
k8s	admin/cos.prometheus  admin   prometheus_remote_write:receive-remote-write

To consume offers to be reachable in the current model, run

juju consume k8s:admin/cos.grafana
juju consume k8s:admin/cos.loki
juju consume k8s:admin/cos.prometheus

Deploy and integrate Grafana

First, deploy grafana-agent and integrate it with the principal application for the subordinate MySQL Router app <client_application>:

juju deploy grafana-agent
juju integrate <client_application> grafana-agent

Integrate (previously known as “relate”) grafana-agent with the COS interfaces:

juju integrate grafana-agent mysql-router:cos-agent
juju integrate grafana-agent grafana
juju integrate grafana-agent loki
juju integrate grafana-agent prometheus

After this is complete, Grafana will show the new dashboards MySQLRouter Exporter and allows access for Charmed MySQL Router logs on Loki.

Example of juju status on the Charmed MySQL Router VM model:

ubuntu@localhost:~$ juju status
Model 	Controller  Cloud/Region     	Version  SLA      	Timestamp
database  lxd     	localhost/localhost  3.1.8	unsupported  12:34:26Z

SAAS    	Status  Store  URL
grafana 	active  k8s	admin/cos.grafana
loki    	active  k8s	admin/cos.loki
prometheus  active  k8s	admin/cos.prometheus

App         	Version      	Status  Scale  Charm       	Channel 	Rev  Exposed  Message
grafana-agent                	active  	1  grafana-agent   stable   	65  no  	 
mysql       	8.0.34-0ubun...  active  	1  mysql       	8.0/stable  196  no  	 
mysql-router	8.0.36-0ubun...  active  	1  mysql-router	dpe/edge	153  no  	 
mysql-test-app  0.0.2        	active  	1  mysql-test-app  stable   	36  no  	 

Unit            	Workload  Agent  Machine  Public address  Ports       	Message
mysql-test-app/0*   active	idle   1    	10.205.193.82              	 
  grafana-agent/0*  active	idle        	10.205.193.82              	 
  mysql-router/0*   active	idle        	10.205.193.82              	 
mysql/0*        	active	idle   0    	10.205.193.13   3306,33060/tcp  Primary

Machine  State	Address    	Inst id    	Base      	AZ  Message
0    	started  10.205.193.13  juju-65afbd-0  ubuntu@22.04  	Running
1    	started  10.205.193.82  juju-65afbd-1  ubuntu@22.04  	Running

Example of juju status on the COS K8s model:

ubuntu@localhost:~$ juju status
Model  Controller  Cloud/Region    	Version  SLA      	Timestamp
cos	k8s     	microk8s/localhost  3.1.8	unsupported  20:29:12Z

App       	Version  Status  Scale  Charm         	Channel  Rev  Address     	Exposed  Message
alertmanager  0.27.0   active  	1  alertmanager-k8s  stable   106  10.152.183.197  no  	 
catalogue          	active  	1  catalogue-k8s 	stable	33  10.152.183.38   no  	 
grafana   	9.5.3	active  	1  grafana-k8s   	stable   106  10.152.183.238  no  	 
loki      	2.9.4	active  	1  loki-k8s      	stable   124  10.152.183.84   no  	 
prometheus	2.49.1   active  	1  prometheus-k8s	stable   171  10.152.183.182  no  	 

Connect to Grafana web interface

To connect to the Grafana web interface, follow the Browse dashboards section of the MicroK8s “Getting started” guide.

juju run grafana/leader get-admin-password --model <k8s_controller>:<cos_model_name>