dubbo-admin dubbo-monitor 安装

 

dubbo-admin:

因为我们不能直观的看到dubbo和zk上到底有什么服务(提供者),所以我们需要一个可视化工具来方便我们管理每一个服务和每一个节点。
dubbo-admin 就是dubbo的管理控制台

需要的准备工作是你的Linux已经安装了

jdk
Zookeeper
tomcat

编译java包还需要用到Maven,安装教程
https://www.cnblogs.com/centos2017/p/10382161.html

 

 

1、官网下载dubbo源码

Dubbo 在2.6版本时合并了dubbox 的分支,现在dubbo-admin也迁移到一个单独项目  apache/incubator-dubbo-ops

在这个地址只能下载  apache-dubbo-2.5.0版本,这个里面带有admin
https://github.com/apache/incubator-dubbo/

新版本中apache-dubbo-2.7.0已经没有dubbo-admin了

转移到新项目 apache/incubator-dubbo-ops   https://github.com/apache/incubator-dubbo-ops

 

总结:

  • 打成war包,放到tomcat容器中,启动,访问,期间可能存在端口冲突,主要使用于dubbo2.5.x之前的版本
  • 打成jar包,通过java -jar xxx.jar命令启动,访问,dubbo2.6.0之后开始使用该方式

 

旧版本的安装流程
1.下载
2
、编译dubbo-admin工程,打成war包 dubbo-admin-2.5.8.war
3、进入 WEB-INF 目录修改文件 dubbo.properties 设置zookeeper 地址 dubbo.registry.address=zookeeper://127.0.0.1:2181 dubbo.admin.root.password=root dubbo.admin.guest.password=guest 4、在tomcat 中部署dubbo-admin-2.5.8.war 5、用户密码都root/root

 

新版本安装流程

### 生产环境配置


1. 下载代码: `git clone https://github.com/apache/incubator-dubbo-ops.git`
2. 在 `dubbo-admin-server/src/main/resources/application-production.properties`中指定注册中心地址
3. 构建


> - `mvn clean package`
4. 启动
* `mvn --projects dubbo-admin-server spring-boot:run`
或者
* `cd dubbo-admin-distribution/target; java -jar dubbo-admin-0.1.jar`
5. 访问 `http://localhost:8080`

 

 

 

 

 dubbo-Monitor:

dubbo-monitor-simple是dubbo提供的简单监控中心,可以用来显示接口暴露,注册情况,也可以看接口的调用明细,调用时间等。

  • Simple Monitor挂掉不会影响到Consumer和Provider之间的调用,所以用于生产环境不会有风险。
  • Simple Monitor采用磁盘存储统计信息,请注意安装机器的磁盘限制,如果要集群,建议用mount共享磁盘。
  • charts目录必须放在jetty.directory下,否则页面上访问不了。
  • 配置好了之后可以结合admin管理后台使用,可以清晰的看到服务的访问记录、成功次数、失败次数。

下面是官网的安装步骤

安装:

git clone https://github.com/apache/incubator-dubbo-ops
cd incubator-dubbo-ops && mvn package
cd dubbo-monitor-simple/target && tar xvf dubbo-monitor-simple-2.0.0-assembly.tar.gz
cd dubbo-monitor-simple-2.0.0
配置:

vi conf/dubbo.properties
启动:

./assembly.bin/start.sh
停止:

./assembly.bin/stop.sh
重启:

./assembly.bin/restart.sh
调试:

./assembly.bin/start.sh debug
系统状态:

./assembly.bin/dump.sh
总控入口:

./assembly.bin/server.sh start
./assembly.bin/server.sh stop
./assembly.bin/server.sh restart
./assembly.bin/server.sh debug
./assembly.bin/server.sh dump
标准输出:

tail -f logs/stdout.log
命令行 [1]:

telnet 127.0.0.1 7070
help
或者:

echo status | nc -i 1 127.0.0.1 7070
访问:

http://127.0.0.1:8080

 

 

我的安装步骤

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

进入target文件夹
可以直接下载我编译好的包

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   zookeeper的地址
#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                               服务启动后访问的端口(修改一下,不要和tomcat冲突)  
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

5. 启动服务

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

报错:

2018-07-06 16:18:37,135 [main] WARN  com.alibaba.dubbo.config.ServiceConfig (ServiceConfig.java:568) -  [DUBBO] lvs: lvs: Temporary failure in name resolution, dubbo version: 2.6.0, current host: 127.0.0.1
java.net.UnknownHostException: lvs: lvs: Temporary failure in name resolution
        at java.net.InetAddress.getLocalHost(InetAddress.java:1505)
        at com.alibaba.dubbo.config.ServiceConfig.findConfigedHosts(ServiceConfig.java:566)
        at com.alibaba.dubbo.config.ServiceConfig.doExportUrlsFor1Protocol(ServiceConfig.java:469)
        at com.alibaba.dubbo.config.ServiceConfig.doExportUrls(ServiceConfig.java:357)
        at com.alibaba.dubbo.config.ServiceConfig.doExport(ServiceConfig.java:316)
        at com.alibaba.dubbo.config.ServiceConfig.export(ServiceConfig.java:215)
        at com.alibaba.dubbo.config.spring.ServiceBean.onApplicationEvent(ServiceBean.java:121)
        at com.alibaba.dubbo.config.spring.ServiceBean.onApplicationEvent(ServiceBean.java:50)

解决:修改hosts文件,把服务器名称 lvs 和 127.0.0.1 地址做一下 映射就好了

# vi /etc/hosts
加入

127.0.0.1  lvs

 

出现的错误

1.

# ./start.sh 
./start.sh: line 30: netstat: command not found
Starting the simple-monitor ...../start.sh: line 79: netstat: command not found
../start.sh: line 79: netstat: command not found

提示找不到netstat命令,centos7 默认不使用这个命令了。
我们安装一下network工具包,就可以使用这个命令了

# yum install net-tools

 

2. 

访问时无法看到图

 解决

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

 

posted @ 2018-07-05 18:20  乌托邦眺望  阅读(4974)  评论(0编辑  收藏  举报