之前已经下载好的dubbo-admin-master源码中,有dubbo-monitor-simple工程,同理,使用maven命令打包成一个可执行的jar包:
1.进入dubbo-monitor-simple工程目录里面进行打包(win8要使用管理员权限打开cmd命令行再去执行打包命令)
2. 打包完成,生成一个dubbo-monitor-simple-2.0.0-assembly.tar.gz文件
将dubbo-monitor-simple-2.0.0-assembly.tar.gz这个压缩包拷贝到指定目录并解压
conf目录下是dubbo.properies配置文件
# 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-monitor dubbo.application.name=simple-monitor dubbo.application.owner=dubbo #dubbo.registry.address=multicast://224.5.6.7:1234 dubbo.registry.address=zookeeper://127.0.0.1:2181 #dubbo注册中心的地址,这里不用做修改 #dubbo.registry.address=redis://127.0.0.1:6379 #dubbo.registry.address=dubbo://127.0.0.1:9090 dubbo.protocol.port=7070 #监控中心与dubbo服务的通信端口 dubbo.jetty.port=8080 #dubbo监控中心的web访问端口 dubbo.jetty.directory=${user.home}/monitor dubbo.charts.directory=${user.home}/monitor/charts dubbo.statistics.directory=${user.home}/monitor/statistics dubbo.log4j.file=logs/dubbo-monitor-simple.log dubbo.log4j.level=WARN
3.进入assembly/bin目录,双击start.bat启动监控中心
4.访问监控中心:
点击applications,可以看到监控的服务信息:
5. 在代码中配置监控中心: