zhuangjinxin / blog

:notebook: 个人博客 技术分享 整理笔记
http://blog.zhuangjinxin.top
7 stars 0 forks source link

使用Dubbo-monitor安装部署Dubbo监控中心 #4

Open zhuangjinxin opened 7 years ago

zhuangjinxin commented 7 years ago

Dubbo Monitor 效果图

Dubbo-Admin

下载

从Github上下载Dubbo的源码,地址:https://github.com/alibaba/dubbo

打包

进入目录:cd dubbo-master/dubbo-sample/dubbo-monitor-sample/src/main/assembly/conf 修改dubbo.properties文件:

dubbo.container=log4j,spring,registry,jetty
dubbo.application.name=simple-monitor
dubbo.application.owner=
dubbo.registry.address=zookeeper://127.0.0.1:2181

dubbo.protocol.port=7070
dubbo.jetty.port=8080
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

dubbo.registry.address换成真实的注册地址 ${user.home}填写真实的用户目录cd ~ pwd查看 在创建${user.home}/monitor/下手动创建charts文件夹: mkdir ~/monitor cd ~/monitor/ mkdir charts

进入目录:cd dubbo-master/dubbo-sample/dubbo-monitor-sample 修改pom.xml文件中Dubbo的版本:从${project.parent.version}修改成2.5.3

<dependencies>
    <dependency>
        <groupId>com.alibaba</groupId>
        <artifactId>dubbo</artifactId>
        <version>2.5.3</version>
    </dependency>
</dependencies>
<build>
    <plugins>
        <plugin>
            <artifactId>maven-dependency-plugin</artifactId>
            <executions>
                <execution>
                    <id>unpack</id>
                    <phase>package</phase>
                    <goals>
                        <goal>unpack</goal>
                    </goals>
                    <configuration>
                        <artifactItems>
                            <artifactItem>
                                <groupId>com.alibaba</groupId>
                                <artifactId>dubbo</artifactId>
                                <version>2.5.3</version>
                                <outputDirectory>${project.build.directory}/dubbo</outputDirectory>
                                <includes>META-INF/assembly/**</includes>
                            </artifactItem>
                        </artifactItems>
                    </configuration>
                </execution>
            </executions>
        </plugin>
    </plugins>
</build>

dubbo-master/dubbo-sample/dubbo-monitor-sample/目录下, 编译打包:mvn package -Dmaven.skip.test=true

[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 19.918 s
[INFO] Finished at: 2017-03-25T11:18:24+08:00
[INFO] Final Memory: 27M/344M
[INFO] ------------------------------------------------------------------------

运行

dubbo-master/dubbo-sample/dubbo-monitor-sample/target/目录下,找到dubbo-monitor-simple-2.5.4-SNAPSHOT-assembly.tar.gz,解压! 进入解压后的目录cd bin,运行./start.sh

➜  bin ./start.sh
Starting the simple-monitor ........................OK!
PID: 37656
STDOUT: logs/stdout.log

浏览器访问:localhost:8080即可!

提示

  1. 配置dubbo.properties文件 charts文件夹并不会自动生成,需要手动创建该文件夹。
  2. 修改pom.xml中dubbo的版本号 Maven仓库中最新的dubbo版本号是2.5.3,所以需要先修改dubbo版本号再进行打包。https://repo1.maven.org/maven2/com/alibaba/dubbo/
  3. 应用配置 在Dubbo的服务提供者和服务消费者的Dubbo配置中添加<dubbo:monitor protocol="registry"/>

官方文档

http://dubbo.io/Administrator+Guide-zh.htm

zhuangjinxin commented 7 years ago

新版Dubbo更新,解决如下问题:

  1. 打包前无需修改Dubbo版本号;
  2. 打包时无需跳过单元测试[mvn package];