通過dubbo監控中心和背景管理可以很好的監控dubbo服務,監控服務端服務和用戶端調用情況,調用次數,調用日志,友善問題查找。下面我們看看dubbo的管理背景和監控中心怎麼部署。
1.軟體下載下傳
部署管理背景和監控中心需要以下軟體
opensesame 下載下傳位址:https://github.com/alibaba/opensesame
Dubbo源碼下載下傳 https://github.com/alibaba/dubbo (注意分支不是 master 是2.5x 才有dubbo-admin )
Tomcat下載下傳位址 http://tomcat.apache.org/download-70.cgi
2.編譯
下載下傳完成後,解壓,切換到opensesame-master目錄下(如上圖),打開CMD指令,執行如下指令
mvn install -Dmaven.test.skip=true
3.dubbo-admin部署
dubbo管理平台dubbo-admin部署
解壓dubbo-master檔案夾,打開CMD指令,切換到dubbo-master目錄,執行
mvn install -Dmaven.test.skip=true指令,完成後,會看到dubbo-admin的target檔案夾下有dubbo-admin-2.5.4-SNAPSHOT.war
如下圖
解壓tomcat,将dubbo-admin-2.5.4-SNAPSHOT.war包拷貝到Tomcat的webapps檔案夾下
然後啟動tomcat,啟動tomcat的方法如下,
切換到tomcat的bin檔案夾,啟動startup.bat指令
目錄如下
指令如下
此時dubbo-admin-2.5.4-SNAPSHOT.war會自動解壓,在webapps目錄下生成一個dubbo-admin-2.5.4-SNAPSHOT檔案夾,
将webapps下的root檔案夾下的内容全部删除,将dubbo-admin-2.5.4-SNAPSHOT檔案夾下的内容全部拷貝到Root檔案夾下,最終結果如下圖
修改下root檔案夾下web-inf檔案夾下的dubbo.properties檔案,
檔案内容如下
dubbo.registry.address=127.0.0.1:2181,127.0.0.1:2182,127.0.0.1:2183
dubbo.admin.root.password=root
dubbo.admin.guest.password=guest
打開浏覽器輸入位址: http://localhost:8080/,輸入賬号和密碼登入guest/guest
4.dubbo監控平台monitor部署
在本地倉庫中或者dubbo-monitor-simple項目中找到dubbo-monitor-simple-2.5.4-SNAPSHOT-assembly.tar.gz檔案,拷貝到D盤,解壓後如下圖
找到conf檔案夾下的dubbo.properties檔案,修改配置檔案如下
[html] view plain copy
- <span style="font-family:Microsoft YaHei;">##
- # Copyright 1999-2011 Alibaba Group.
- #
- # Licensed 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=127.0.0.1:2181,127.0.0.1:2182,127.0.0.1:2183
- dubbo.registry.address=zookeeper://127.0.0.1:2181?backup=127.0.0.1:2182,127.0.0.1:2183
- #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=8086
- dubbo.jetty.directory=${user.home}/monitor
- dubbo.charts.directory=${dubbo.jetty.directory}/charts
- dubbo.statistics.directory=${user.home}/monitor/statistics
- dubbo.log4j.file=logs/dubbo-monitor-simple.log
- dubbo.log4j.level=WARN
- </span>
打開cmd指令行,切換到bin檔案夾,執行start.bat指令
執行完成後,輸入位址http://localhost:8086/index.html
出現如下界面