Msyql、Redis、MongoDB可视化监控工具Grafana

根据docker装置mysql、redis的可视化监控东西

一、装置Grafana

下载Grafana的Docker镜像

[root@localhost ~]# docker pull grafana/grafana

可视化动容器

[root@localhost docker]# docker run -p 3000:3000 --name grafana -d --restart=always grafana/grafana
6a0540849952c4cf0a1d4012ed25410e80d3e14b0bf67108aea95dbc7b7bba9c

二、装置prom

[root@localhost ~]# docker pull prom/prometheus
[root@localhost ~]# cd /docker/
[root@localhost docker]# mkdir prometheus
[root@localhost docker]# cd prometheus/
[root@localhost prometheus]# vim prometheus.yml

1.在/docke公积金r/prometheus下新建prometheus.yml配置文件,新增以下内容

global:
  scrape_interval: 5s

2.发动容器,把宿主机MySQL中的配置文件prometheus.yml挂载到容器中去;

[root@localhost prometheus]# docker run -p 3001:3001 --name prometheus -v /docker/prometheus/prometheus.yml:/etc/prometheus/prometheus.yml -d  --restart=always prom/prometheus
e35ede0a51c4cd85c0ce5f554b44e7f9da11ff9b978443e5f0a33c8c990861f3
[root@localhost prometheus]# docker ps
CONTAINER ID   IMAGE             COMMAND                  CREATED         STATUS         PORTS                                                 NAMES
e35ede0a51c4   prom/prometheus   "/bin/prometheus --c…"   2 seconds ago   Up 2 seconds   0.0.0.0:3001->3001/tcp, :::3001->3001/tcp, 9090/tcp   prometheus
6a0540849952   grafana/grafana   "/run.sh"                2 minutes ago   Up 2 minutes   0.0.0.0:3000->3000/tcp, :::3000->3000/tcp             grafana

三、在grafana装置redis-datasourMySQLce插件

1.进入容器grafana

[root@localhost prometheus]# docker exec -it grafana bash
bash-5.1$ grafana-cli plugins install redis-datasource
✔ Downloaded redis-datasource v2.1.1 zip successfully
Please restart Grafana after installing plugins. Refer to Grafana documentation for instructions if necessary.
bash-5.1$ exit
exit

2.重启grafana

[root@localhost prometheus]# docker restart grafana
grafana

四、登陆可视化界面

1.浏览器访问:http://192.168.2.252:3000/

默认账号密码admin:admin

登陆后修改原始MySQL密码

2.新增数据源

能够增加各种数据库,记得address处填写ip+端口

配置好后点击下方【save&test】

Msyql、Redis、MongoDB可视化监控东西Grafana

Msyql、Redis、MongoDB可视化监控东西Grafana

Msyql、Redis、MongoDB可视化监控东西Grafana

3.mysql点击下面【Explore】,能够进行mysql相关的查询

4.redis点击上面的浏览器【Dashboards】,再点击redis一栏后边对应的“import可视化音乐软件”,能够检查相关的数据图表

Msyql、Redis、MongoDB可视化监控东西Grafana

发表回复

提供最优质的资源集合

立即查看 了解详情