一. dubbo-simple-monitor的作用

是Alibaba的开源项目,用于监控在dubbo框架下接口暴露,注册情况,也可以看接口的调用明细,调用时间等。而且监控中心挂掉并不会影响生成者和消费者。

二. 安装dubbo-simple-monitor

1. 下载源码(托管在github上)

~]# wget https://github.com/alibaba/dubbo/archive/dubbo-2.6.0.zip
~]# unzip dubbo-2.6.0.zip
~]# cd dubbo-dubbo-2.6.0/

2. 安装依赖

~]# yum -y install java-1.8.0-openjdk maven

maven: 用于编译dubbo-simple-monitor
jdk: dubbo-simple-monitor是java语言所写,故需要jdk

3. 编译dubbo-simple-monitor

dubbo-dubbo-2.6.0]# cd dubbo-simple/dubbo-monitor-simple/
dubbo-monitor-simple]# mvn clean install

编译成功后的目标文件为:target/dubbo-monitor-simple-2.6.0-assembly.tar.gz
dubbo监控中心dubbo-simple-monitor安装

4. 修改配置文件

我们使用dubbo-monitor-simple-2.6.0-assembly.tar.gz启动程序,因为还有一些配置需要修改

target]# tar xf dubbo-monitor-simple-2.6.0-assemble.tar.gz -C /usr/local
target]# cd /usr/local
local]# vim dubbo-monitor-simple-2.6.0/conf/dubbo.properties

# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements.  See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may not use this file except in compliance with
# the License.  You may obtain a copy of the License at
#
#      http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

dubbo.container=log4j,spring,registry,jetty
dubbo.application.name=simple-monitor
dubbo.application.owner=
#dubbo.registry.address=multicast://224.5.6.7:1234
dubbo.registry.address=zookeeper://127.0.0.1:2181
#dubbo.registry.address=redis://127.0.0.1:6379
#dubbo.registry.address=dubbo://127.0.0.1:9090
dubbo.protocol.port=7070
dubbo.jetty.port=8080
dubbo.jetty.directory=/data/monitor
dubbo.charts.directory=${dubbo.jetty.directory}/charts
dubbo.statistics.directory=/data/monitor/statistics
dubbo.log4j.file=logs/dubbo-monitor-simple.log
dubbo.log4j.level=WARN

dubbo监控中心dubbo-simple-monitor安装

dubbo.jetty.port : 服务启动后访问的端口

5. 启动服务

dubbo-monitor-simple-2.6.0]# bin/start.sh

6.访问服务

dubbo监控中心dubbo-simple-monitor安装

查看服务调用情况
dubbo监控中心dubbo-simple-monitor安装

三. 出现的错误

1. 出现的问题

访问是无法看到图
dubbo监控中心dubbo-simple-monitor安装

2. 解决

  • dubbo-simple-monitor配置文件中dubbo.jetty.directory中指明的目录需要手动创建
  • 我们需要监控的服务在配置dubbo时要加入<dubbo:monitor protocol="registry"/>这项配置