[Dubbox] dubbox基础组成与搭建

前言

回顾了一下关于dubbo方便的知识。本文主要介绍如何获取dubbox,并且启动自己的dubbo-admindubbo-monitor.

相关知识1: dubbo的组成

在这里插入图片描述
关于dubbo的组成,配一张经常看过的图. 其组成主要包括如下几个部分:

  • registry: 注册中心。可以选择mulicast或者zookeeper.
  • provider: 服务提供者. 提供服务.
  • consumer: 服务消费者. 消费服务.
  • monitor: 监控器. 监控服务状况与服务消费情况.
  • container?
相关知识2: dubbo的版本问题

相关环境

  • dubbo: 2.8.4 dubbox
    当当网
  • dubbo-monitor: 2.8.4
    韩都衣舍

构建dubbox

由于maven主仓库的关于dubbo的2.8.4的包都是原版的, 且不支持rest服务. 所以, 那个时候需要自己拉源码, 并且对于dubbox进行打包. 基本操作如下:

mvn clean install -Dmaven.test.skip=true
  • 3 成功标志

INFO] ------------------------------------------------------------------------
[INFO] Reactor Summary:
[INFO]
[INFO] dubbo-parent ....................................... SUCCESS [  2.775 s]
[INFO] Hessian Lite(Alibaba embed version) ................ SUCCESS [  6.029 s]
[INFO] dubbo-common ....................................... SUCCESS [  5.350 s]
[INFO] dubbo-container .................................... SUCCESS [  0.012 s]
[INFO] dubbo-container-api ................................ SUCCESS [  1.438 s]
[INFO] dubbo-container-spring ............................. SUCCESS [  1.046 s]
[INFO] dubbo-container-javaconfig ......................... SUCCESS [  0.919 s]
[INFO] dubbo-container-jetty .............................. SUCCESS [  0.848 s]
[INFO] dubbo-container-log4j .............................. SUCCESS [  0.859 s]
[INFO] dubbo-container-logback ............................ SUCCESS [  0.951 s]
[INFO] dubbo-remoting ..................................... SUCCESS [  0.006 s]
[INFO] dubbo-remoting-api ................................. SUCCESS [  2.393 s]
[INFO] dubbo-remoting-netty ............................... SUCCESS [  1.516 s]
[INFO] dubbo-remoting-mina ................................ SUCCESS [  1.270 s]
[INFO] dubbo-remoting-grizzly ............................. SUCCESS [  1.194 s]
[INFO] dubbo-remoting-p2p ................................. SUCCESS [  1.291 s]
[INFO] dubbo-remoting-http ................................ SUCCESS [  1.129 s]
[INFO] dubbo-remoting-zookeeper ........................... SUCCESS [  1.190 s]
[INFO] dubbo-rpc .......................................... SUCCESS [  0.007 s]
[INFO] dubbo-rpc-api ...................................... SUCCESS [  2.018 s]
[INFO] dubbo-rpc-default .................................. SUCCESS [  1.978 s]
[INFO] dubbo-rpc-injvm .................................... SUCCESS [  1.096 s]
[INFO] dubbo-rpc-rmi ...................................... SUCCESS [  0.886 s]
[INFO] dubbo-rpc-hessian .................................. SUCCESS [  1.094 s]
[INFO] dubbo-rpc-http ..................................... SUCCESS [  0.965 s]
[INFO] dubbo-rpc-webservice ............................... SUCCESS [  1.056 s]
[INFO] dubbo-cluster ...................................... SUCCESS [  1.901 s]
[INFO] dubbo-registry ..................................... SUCCESS [  0.016 s]
[INFO] dubbo-registry-api ................................. SUCCESS [  1.720 s]
[INFO] dubbo-monitor ...................................... SUCCESS [  0.016 s]
[INFO] dubbo-monitor-api .................................. SUCCESS [  1.075 s]
[INFO] dubbo-filter ....................................... SUCCESS [  0.005 s]
[INFO] dubbo-filter-validation ............................ SUCCESS [  1.089 s]
[INFO] dubbo-filter-cache ................................. SUCCESS [  0.989 s]
[INFO] dubbo-registry-default ............................. SUCCESS [  1.039 s]
[INFO] dubbo-monitor-default .............................. SUCCESS [  1.047 s]
[INFO] dubbo-registry-multicast ........................... SUCCESS [  1.164 s]
[INFO] dubbo-config ....................................... SUCCESS [  0.009 s]
[INFO] dubbo-config-api ................................... SUCCESS [  1.918 s]
[INFO] dubbo-config-spring ................................ SUCCESS [  1.611 s]
[INFO] dubbo-rpc-thrift ................................... SUCCESS [  1.611 s]
[INFO] dubbo-rpc-memcached ................................ SUCCESS [  1.068 s]
[INFO] dubbo-rpc-redis .................................... SUCCESS [  1.003 s]
[INFO] dubbo-rpc-rest ..................................... SUCCESS [  1.417 s]
[INFO] dubbo-registry-zookeeper ........................... SUCCESS [  1.129 s]
[INFO] dubbo-registry-redis ............................... SUCCESS [  1.219 s]
[INFO] dubbo .............................................. SUCCESS [  4.142 s]
[INFO] dubbo-simple ....................................... SUCCESS [  0.009 s]
[INFO] dubbo-registry-simple .............................. SUCCESS [ 28.237 s]
[INFO] dubbo-monitor-simple ............................... SUCCESS [ 15.472 s]
[INFO] dubbo-admin ........................................ SUCCESS [  7.164 s]
[INFO] dubbo-demo ......................................... SUCCESS [  0.007 s]
[INFO] dubbo-demo-api ..................................... SUCCESS [  1.291 s]
[INFO] dubbo-demo-provider ................................ SUCCESS [  3.520 s]
[INFO] dubbo-demo-consumer ................................ SUCCESS [ 21.343 s]
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 02:22 min
[INFO] Finished at: 2020-12-25T17:11:33+08:00
[INFO] Final Memory: 42M/437M
[INFO] ------------------------------------------------------------------------
  • PS: 值得注意的是虽然当当网的项目名称叫做dubbox. 但是由于是fork原生项目, 所以其pom文件的名称还是没有改变的. 即并没有将项目pom依赖名改为dubbox, 也没有把项目组织改成com.dangdang. 这点在进行依赖的时候需要注意一下.

在这里插入图片描述
在这里插入图片描述


Zookeeper

搭建单结点或者多结点都可. 详情请见博主其他文章.


Dubbo-admin

dubbo-admin为dubbo的管理模块。构建dubbox后,其dubbo-admin.war会出现在本地maven仓库的com/alibaba/dubbo-admin/2.8.4或者源码的dubbox/dubbo-admin/target目录都可以找到dubbo-admin-2.8.4.war文件. 将其放入本地tomcat的webapps目录即可.
在这里插入图片描述
在这里插入图片描述

http://localhost:8080/dubbo-admin-2.8.4/
在这里插入图片描述
PS: 登陆用户admin/admin / guest/guest.

dubbo-admin管理平台搭建


Dubbo-monitor(handu)

localhost:dubbo-monitor-handu sean$ mvn clean package
[INFO] Scanning for projects...
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building Dubbo Monitor for RD 1.0.0
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] --- maven-clean-plugin:2.5:clean (default-clean) @ dubbo-monitor ---
[INFO] Deleting /Users/sean/Documents/Gitrep/dubbo-monitor-handu/target
[INFO]
[INFO] --- maven-resources-plugin:2.6:resources (default-resources) @ dubbo-monitor ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] Copying 3 resources
[INFO]
[INFO] --- maven-compiler-plugin:3.1:compile (default-compile) @ dubbo-monitor ---
[INFO] Changes detected - recompiling the module!
[INFO] Compiling 33 source files to /Users/sean/Documents/Gitrep/dubbo-monitor-handu/target/classes
[WARNING] /Users/sean/Documents/Gitrep/dubbo-monitor-handu/src/main/java/com/handu/open/dubbo/monitor/support/CommonResponse.java: 某些输入文件使用了未经检查或不安全的操作。
[WARNING] /Users/sean/Documents/Gitrep/dubbo-monitor-handu/src/main/java/com/handu/open/dubbo/monitor/support/CommonResponse.java: 有关详细信息, 请使用 -Xlint:unchecked 重新编译。
[INFO]
[INFO] --- maven-resources-plugin:2.6:testResources (default-testResources) @ dubbo-monitor ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] skip non existing resourceDirectory /Users/sean/Documents/Gitrep/dubbo-monitor-handu/src/test/resources
[INFO]
[INFO] --- maven-compiler-plugin:3.1:testCompile (default-testCompile) @ dubbo-monitor ---
[INFO] No sources to compile
[INFO]
[INFO] --- maven-surefire-plugin:2.12.4:test (default-test) @ dubbo-monitor ---
Downloading: http://maven.aliyun.com/nexus/content/groups/public/org/apache/maven/surefire/surefire-booter/2.12.4/surefire-booter-2.12.4.pom
Downloaded: http://maven.aliyun.com/nexus/content/groups/public/org/apache/maven/surefire/surefire-booter/2.12.4/surefire-booter-2.12.4.pom (0 B at 0.0 KB/sec)
Downloading: http://maven.aliyun.com/nexus/content/groups/public/org/apache/maven/surefire/surefire-api/2.12.4/surefire-api-2.12.4.pom
Downloaded: http://maven.aliyun.com/nexus/content/groups/public/org/apache/maven/surefire/surefire-api/2.12.4/surefire-api-2.12.4.pom (0 B at 0.0 KB/sec)
Downloading: http://maven.aliyun.com/nexus/content/groups/public/org/apache/maven/surefire/maven-surefire-common/2.12.4/maven-surefire-common-2.12.4.pom
Downloaded: http://maven.aliyun.com/nexus/content/groups/public/org/apache/maven/surefire/maven-surefire-common/2.12.4/maven-surefire-common-2.12.4.pom (0 B at 0.0 KB/sec)
Downloading: http://maven.aliyun.com/nexus/content/groups/public/org/apache/maven/plugin-tools/maven-plugin-annotations/3.1/maven-plugin-annotations-3.1.pom
Downloaded: http://maven.aliyun.com/nexus/content/groups/public/org/apache/maven/plugin-tools/maven-plugin-annotations/3.1/maven-plugin-annotations-3.1.pom (0 B at 0.0 KB/sec)
Downloading: http://maven.aliyun.com/nexus/content/groups/public/org/apache/maven/plugin-tools/maven-plugin-tools/3.1/maven-plugin-tools-3.1.pom
Downloaded: http://maven.aliyun.com/nexus/content/groups/public/org/apache/maven/plugin-tools/maven-plugin-tools/3.1/maven-plugin-tools-3.1.pom (0 B at 0.0 KB/sec)
Downloading: http://maven.aliyun.com/nexus/content/groups/public/org/apache/maven/shared/maven-common-artifact-filters/1.3/maven-common-artifact-filters-1.3.pom
Downloaded: http://maven.aliyun.com/nexus/content/groups/public/org/apache/maven/shared/maven-common-artifact-filters/1.3/maven-common-artifact-filters-1.3.pom (0 B at 0.0 KB/sec)
Downloading: http://maven.aliyun.com/nexus/content/groups/public/org/apache/maven/surefire/surefire-booter/2.12.4/surefire-booter-2.12.4.jar
Downloading: http://maven.aliyun.com/nexus/content/groups/public/org/apache/maven/surefire/surefire-api/2.12.4/surefire-api-2.12.4.jar
Downloading: http://maven.aliyun.com/nexus/content/groups/public/org/apache/maven/surefire/maven-surefire-common/2.12.4/maven-surefire-common-2.12.4.jar
Downloading: http://maven.aliyun.com/nexus/content/groups/public/org/apache/maven/shared/maven-common-artifact-filters/1.3/maven-common-artifact-filters-1.3.jar
Downloading: http://maven.aliyun.com/nexus/content/groups/public/org/apache/maven/plugin-tools/maven-plugin-annotations/3.1/maven-plugin-annotations-3.1.jar
Downloaded: http://maven.aliyun.com/nexus/content/groups/public/org/apache/maven/surefire/surefire-booter/2.12.4/surefire-booter-2.12.4.jar (0 B at 0.0 KB/sec)
Downloaded: http://maven.aliyun.com/nexus/content/groups/public/org/apache/maven/shared/maven-common-artifact-filters/1.3/maven-common-artifact-filters-1.3.jar (0 B at 0.0 KB/sec)
Downloaded: http://maven.aliyun.com/nexus/content/groups/public/org/apache/maven/surefire/maven-surefire-common/2.12.4/maven-surefire-common-2.12.4.jar (0 B at 0.0 KB/sec)
Downloaded: http://maven.aliyun.com/nexus/content/groups/public/org/apache/maven/surefire/surefire-api/2.12.4/surefire-api-2.12.4.jar (0 B at 0.0 KB/sec)
Downloaded: http://maven.aliyun.com/nexus/content/groups/public/org/apache/maven/plugin-tools/maven-plugin-annotations/3.1/maven-plugin-annotations-3.1.jar (0 B at 0.0 KB/sec)
[INFO] No tests to run.
[INFO]
[INFO] --- maven-war-plugin:2.2:war (default-war) @ dubbo-monitor ---
[INFO] Packaging webapp
[INFO] Assembling webapp [dubbo-monitor] in [/Users/sean/Documents/Gitrep/dubbo-monitor-handu/target/dubbo-monitor]
[INFO] Processing war project
[INFO] Copying webapp resources [/Users/sean/Documents/Gitrep/dubbo-monitor-handu/src/main/webapp]
[INFO] Webapp assembled in [789 msecs]
[INFO] Building war: /Users/sean/Documents/Gitrep/dubbo-monitor-handu/target/dubbo-monitor.war
[INFO] WEB-INF/web.xml already added, skipping
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 8.350 s
[INFO] Finished at: 2020-12-25T17:45:36+08:00
[INFO] Final Memory: 30M/277M
[INFO] ------------------------------------------------------------------------

随后,在target目录下会发现dubbo-monitor.war. 同样, 将其放入tomcat即可.

http://localhost:8080/dubbo-monitor/applications
注意其WEB-INF/classes/application.properties文件的配置.

dubbo.application.name=dubbo-monitor
dubbo.application.owner=
dubbo.registry.address=zookeeper://127.0.0.1:2181
dubbo.protocol.port=6060

# Database Settings
db.url=jdbc:mysql://127.0.0.1:3306/monitor?prepStmtCacheSize=517&cachePrepStmts=true&autoReconnect=true&characterEncoding=utf-8
db.username=root
db.password=admin
db.maxActive=500

# System Manager
manager.username=admin
manager.password=admin

PS: 韩都衣舍的monitor登陆账户密码为admin/admin.
在这里插入图片描述


Reference

[1]. Dubbo分布式服务框架入门(附工程)
[2]. dubbox 2.8.4的配置和使用

已标记关键词 清除标记
©️2020 CSDN 皮肤主题: Age of Ai 设计师:meimeiellie 返回首页