通過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文件,修改配置文件如下
- <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
出現如下界面