Dubbo剖析-监控平台的搭建与使用

一、前言

dubbo-monitor主要用来统计服务的调用次调和调用时间的监控中心,服务消费者和提供者,在内存中累计调用次数和调用时间,定时每分钟发送一次统计数据到监控中心,监控中心则使用数据绘制图表来显示。

二、dubbo-monitor-simple的搭建

  • 在服务提供方和消费方需要配置如下: <dubbo:monitor protocol="registry"/> protocol为"registry",表示服务提供方和消费方从注册中心发现监控中心(monitor)地址。
  • 下载源码 在 https://github.com/alibaba/dubbo/tree/2.5.x 下载dubbo的源码
  • 解压源码,进入dubbo-2.5.x 目录,内容如下:

image.png

在该目录执行mvn clean package -Dmaven.test.skip=true会生成如下结果: [INFO] ------------------------------------------------------------------------ [INFO] Reactor Summary: [INFO] [INFO] dubbo-parent ...................................... SUCCESS [2.857s] [INFO] Hessian Lite(Alibaba embed version) ............... SUCCESS [6.518s] [INFO] dubbo-common ...................................... SUCCESS [7.706s] [INFO] dubbo-container ................................... SUCCESS [0.057s] [INFO] dubbo-container-api ............................... SUCCESS [3.398s] [INFO] dubbo-container-spring ............................ SUCCESS [1.099s] [INFO] dubbo-container-jetty ............................. SUCCESS [1.164s] [INFO] dubbo-container-log4j ............................. SUCCESS [1.196s] [INFO] dubbo-container-logback ........................... SUCCESS [1.138s] [INFO] dubbo-remoting .................................... SUCCESS [0.045s] [INFO] dubbo-remoting-api ................................ SUCCESS [3.615s] [INFO] dubbo-remoting-netty .............................. SUCCESS [1.959s] [INFO] dubbo-remoting-mina ............................... SUCCESS [1.602s] [INFO] dubbo-remoting-grizzly ............................ SUCCESS [1.752s] [INFO] dubbo-remoting-p2p ................................ SUCCESS [2.148s] [INFO] dubbo-remoting-http ............................... SUCCESS [2.154s] [INFO] dubbo-remoting-zookeeper .......................... SUCCESS [2.165s] [INFO] dubbo-remoting-netty4 ............................. SUCCESS [2.721s] [INFO] dubbo-rpc ......................................... SUCCESS [0.060s] [INFO] dubbo-rpc-api ..................................... SUCCESS [3.397s] [INFO] dubbo-rpc-default ................................. SUCCESS [3.278s] [INFO] dubbo-rpc-injvm ................................... SUCCESS [1.706s] [INFO] dubbo-rpc-rmi ..................................... SUCCESS [1.373s] [INFO] dubbo-rpc-hessian ................................. SUCCESS [1.791s] [INFO] dubbo-rpc-http .................................... SUCCESS [1.210s] [INFO] dubbo-rpc-webservice .............................. SUCCESS [1.816s] [INFO] dubbo-cluster ..................................... SUCCESS [2.690s] [INFO] dubbo-registry .................................... SUCCESS [0.033s] [INFO] dubbo-registry-api ................................ SUCCESS [2.548s] [INFO] dubbo-monitor ..................................... SUCCESS [0.020s] [INFO] dubbo-monitor-api ................................. SUCCESS [1.309s] [INFO] dubbo-filter ...................................... SUCCESS [0.023s] [INFO] dubbo-filter-validation ........................... SUCCESS [1.474s] [INFO] dubbo-filter-cache ................................ SUCCESS [1.395s] [INFO] dubbo-registry-default ............................ SUCCESS [1.402s] [INFO] dubbo-monitor-default ............................. SUCCESS [1.258s] [INFO] dubbo-registry-multicast .......................... SUCCESS [1.336s] [INFO] dubbo-config ...................................... SUCCESS [0.018s] [INFO] dubbo-config-api .................................. SUCCESS [3.498s] [INFO] dubbo-config-spring ............................... SUCCESS [3.326s] [INFO] dubbo-rpc-thrift .................................. SUCCESS [2.115s] [INFO] dubbo-rpc-memcached ............................... SUCCESS [1.476s] [INFO] dubbo-rpc-redis ................................... SUCCESS [1.367s] [INFO] dubbo-registry-zookeeper .......................... SUCCESS [1.597s] [INFO] dubbo-registry-redis .............................. SUCCESS [2.111s] [INFO] dubbo-plugin ...................................... SUCCESS [0.027s] [INFO] dubbo-qos ......................................... SUCCESS [2.574s] [INFO] dubbo ............................................. SUCCESS [2.662s] [INFO] dubbo-simple ...................................... SUCCESS [0.017s] [INFO] dubbo-registry-simple ............................. SUCCESS [5.246s] [INFO] dubbo-monitor-simple .............................. SUCCESS [11.301s] [INFO] dubbo-admin ....................................... SUCCESS [11.472s] [INFO] dubbo-demo ........................................ SUCCESS [0.034s] [INFO] dubbo-demo-api .................................... SUCCESS [1.097s] [INFO] dubbo-demo-provider ............................... SUCCESS [1.892s] [INFO] dubbo-demo-consumer ............................... SUCCESS [1.473s] [INFO] dubbo-test ........................................ SUCCESS [0.022s] [INFO] dubbo-test-benchmark .............................. SUCCESS [5.324s] [INFO] dubbo-test-compatibility .......................... SUCCESS [0.017s] [INFO] dubbo-test-spring3 ................................ SUCCESS [1.719s] [INFO] dubbo-test-integration ............................ SUCCESS [0.149s] [INFO] dubbo-test-examples ............................... SUCCESS [3.413s] [INFO] ------------------------------------------------------------------------ [INFO] BUILD SUCCESS [INFO] ------------------------------------------------------------------------ [INFO] Total time: 2:16.562s [INFO] Finished at: Wed Mar 14 17:19:06 CST 2018 [INFO] Final Memory: 38M/654M [INFO] ------------------------------------------------------------------------

进入/Users/zhuizhumengxiang/Downloads/dubbo-2.5.x/dubbo-simple/dubbo-monitor-simple/target 目录,会发现生成了dubbo-monitor-simple-2.5.10-assembly.tar.gz:

image.png

  • 解压dubbo-monitor-simple-2.5.10-assembly.tar.gz,修改进入dubbo-monitor-simple-2.5.10/conf/dubbo.properties:

其中dubbo.registry.address=zookeeper://127.0.0.1:2181设置注册中心地址,这里设置为zk的地址

其中dubbo.protocol.port=7070,为monitor提供的远程服务监听端口,服务提供者和消费者会调用这个端口提供的服务,发送统计信息到monitor

dubbo.charts.directory和dubbo.statistics.directory为monitor本地存放的监控数据文件的位置

dubbo.jetty.port=8081 设置jetty容器的监听地址,类似于tomcat的8080端口,这里设置为8081

  • 进入dubbo-monitor-simple-2.5.10/bin,执行sh start.sh启动monitor

image.png

至此monitor启动了访问http://127.0.0.1:8081/ 会出现下面界面:

image.png

三、dubbo-monitor-simple的使用

3.1 应用程序查看

3.2 服务查看

image.png

3.3 注册中心查看

image.png

3.4 调用数据统计

image.png

image.png

四、总结

dubbo-monitor也不是使用dubbo搭建分布式系统必须的组件,但是它用来统计服务的调用次调和调用时间的监控中心,这些数据有助于系统运维和调优。

本文参与腾讯云自媒体分享计划,欢迎正在阅读的你也加入,一起分享。

发表于

我来说两句

0 条评论
登录 后参与评论

相关文章

来自专栏闻道于事

Spring Boot入门

Spring Boot入门: 使用IDEA创建Spring Boot 项目: 选择 ? 勾选Web ? 生成项目结构: ? 例子: package com.ex...

30340
来自专栏史上最简单的Spring Cloud教程

SpringBoot非官方教程 | 第十三篇:springboot集成spring cache

本文介绍如何在springboot中使用默认的spring cache, 声明式缓存 Spring 定义 CacheManager 和 Cache 接口用来统...

24480
来自专栏闵开慧

a windows service with the name MYSQL already e...

安装MySQL的时候出现这个报错:a windows service with the name MYSQL already exists.Please ...

359110
来自专栏james大数据架构

常见的几种Flume日志收集场景实战

  这里主要介绍几种常见的日志的source来源,包括监控文件型,监控文件内容增量,TCP和HTTP。 Spool类型   用于监控指定目录内数据变更,若有新文...

36050
来自专栏Dawnzhang的开发者手册

@Controller和@RestController的区别?

1)如果只是使用@RestController注解Controller,则Controller中的方法无法返回jsp页面,配置的视图解析器InternalRes...

61930
来自专栏不想当开发的产品不是好测试

spring boot 登录注册 demo (一)

Welcome to Spring Boot 代码结构 ? src/main/java 下 controller层,路由功能 dao层,数据库的访问 domai...

33350
来自专栏码匠的流水账

使用openjdk9-alpine运行springboot2

本文主要研究怎么在docker的java9镜像上运行springboot2并精简jdk.

75810
来自专栏web编程技术分享

用SpringBoot搭建简单电商项目 01

91780
来自专栏张浩的专栏

用Kafka消费Flume传来的日志

28810
来自专栏10km的专栏

Caffe: Could not find PROTOBUF Compiler(Profobuf 3.0 above)

在用cmake生成Caffe工程文件的时候,如果你使用Protobuf 3.0以上的版本,cmake可能会产生如下的报错: CMake Error at cm...

1.1K60

扫码关注云+社区

领取腾讯云代金券