dubbo監控中心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
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.jetty.port : 服務啟動後訪問的端口
5. 啟動服務
dubbo-monitor-simple-2.6.0]# bin/start.sh
6.訪問服務
查看服務調用情況
三. 出現的錯誤
1. 出現的問題
訪問是無法看到圖
2. 解決
- dubbo-simple-monitor配置文件中dubbo.jetty.directory中指明的目錄需要手動創建
- 我們需要監控的服務在配置dubbo時要加入<dubbo:monitor protocol="registry"/>這項配置
dubbo監控中心dubbo-simple-monitor安裝