[Dubbox] dubbox基础组成与搭建

2024-05-14 07:48
文章标签 基础 搭建 组成 dubbox

本文主要是介绍[Dubbox] dubbox基础组成与搭建,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!

前言

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

相关知识1: dubbo的组成

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

  • registry: 注册中心。可以选择mulicast或者zookeeper.
  • provider: 服务提供者. 提供服务.
  • consumer: 服务消费者. 消费服务.
  • monitor: 监控器. 监控服务状况与服务消费情况.
  • container?
相关知识2: dubbo的版本问题
  • dubbo原生由阿里构建,于2016年更新最后一个版本dubbo 2.8.4. 于2018年又开始重新维护.
    https://github.com/apache/dubbo
  • 后由当当网对于dubbo进行改进, 构建dubbox 2.8.4. (因为当时2.8.4不支持rest服务, 所以dubbox也火了一段时间.)
    https://github.com/dangdangdotcom/dubbox
  • 韩都衣舍改造了dubbo内的dubbo-monitor模块.
    https://gitee.com/handu/dubbo-monitor

相关环境

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

构建dubbox

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

  • 1 拉取dubbox源码
    https://github.com/dangdangdotcom/dubbox
  • 2 打包. 并且装载到自己的maven仓库.
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)

  • 下载handu的源码
    https://gitee.com/handu/dubbo-monitor
  • 运行maven打包命令
    mvn clean package
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的配置和使用

这篇关于[Dubbox] dubbox基础组成与搭建的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!



http://www.chinasem.cn/article/988178

相关文章

鸿蒙开发搭建flutter适配的开发环境

《鸿蒙开发搭建flutter适配的开发环境》文章详细介绍了在Windows系统上如何创建和运行鸿蒙Flutter项目,包括使用flutterdoctor检测环境、创建项目、编译HAP包以及在真机上运... 目录环境搭建创建运行项目打包项目总结环境搭建1.安装 DevEco Studio NEXT IDE

零基础学习Redis(10) -- zset类型命令使用

zset是有序集合,内部除了存储元素外,还会存储一个score,存储在zset中的元素会按照score的大小升序排列,不同元素的score可以重复,score相同的元素会按照元素的字典序排列。 1. zset常用命令 1.1 zadd  zadd key [NX | XX] [GT | LT]   [CH] [INCR] score member [score member ...]

搭建Kafka+zookeeper集群调度

前言 硬件环境 172.18.0.5        kafkazk1        Kafka+zookeeper                Kafka Broker集群 172.18.0.6        kafkazk2        Kafka+zookeeper                Kafka Broker集群 172.18.0.7        kafkazk3

【IPV6从入门到起飞】5-1 IPV6+Home Assistant(搭建基本环境)

【IPV6从入门到起飞】5-1 IPV6+Home Assistant #搭建基本环境 1 背景2 docker下载 hass3 创建容器4 浏览器访问 hass5 手机APP远程访问hass6 更多玩法 1 背景 既然电脑可以IPV6入站,手机流量可以访问IPV6网络的服务,为什么不在电脑搭建Home Assistant(hass),来控制你的设备呢?@智能家居 @万物互联

【Linux 从基础到进阶】Ansible自动化运维工具使用

Ansible自动化运维工具使用 Ansible 是一款开源的自动化运维工具,采用无代理架构(agentless),基于 SSH 连接进行管理,具有简单易用、灵活强大、可扩展性高等特点。它广泛用于服务器管理、应用部署、配置管理等任务。本文将介绍 Ansible 的安装、基本使用方法及一些实际运维场景中的应用,旨在帮助运维人员快速上手并熟练运用 Ansible。 1. Ansible的核心概念

pico2 开发环境搭建-基于ubuntu

pico2 开发环境搭建-基于ubuntu 安装编译工具链下载sdk 和example编译example 安装编译工具链 sudo apt install cmake gcc-arm-none-eabi libnewlib-arm-none-eabi libstdc++-arm-none-eabi-newlib 注意cmake的版本,需要在3.17 以上 下载sdk 和ex

AI基础 L9 Local Search II 局部搜索

Local Beam search 对于当前的所有k个状态,生成它们的所有可能后继状态。 检查生成的后继状态中是否有任何状态是解决方案。 如果所有后继状态都不是解决方案,则从所有后继状态中选择k个最佳状态。 当达到预设的迭代次数或满足某个终止条件时,算法停止。 — Choose k successors randomly, biased towards good ones — Close

音视频入门基础:WAV专题(10)——FFmpeg源码中计算WAV音频文件每个packet的pts、dts的实现

一、引言 从文章《音视频入门基础:WAV专题(6)——通过FFprobe显示WAV音频文件每个数据包的信息》中我们可以知道,通过FFprobe命令可以打印WAV音频文件每个packet(也称为数据包或多媒体包)的信息,这些信息包含该packet的pts、dts: 打印出来的“pts”实际是AVPacket结构体中的成员变量pts,是以AVStream->time_base为单位的显

C 语言基础之数组

文章目录 什么是数组数组变量的声明多维数组 什么是数组 数组,顾名思义,就是一组数。 假如班上有 30 个同学,让你编程统计每个人的分数,求最高分、最低分、平均分等。如果不知道数组,你只能这样写代码: int ZhangSan_score = 95;int LiSi_score = 90;......int LiuDong_score = 100;int Zhou

c++基础版

c++基础版 Windows环境搭建第一个C++程序c++程序运行原理注释常亮字面常亮符号常亮 变量数据类型整型实型常量类型确定char类型字符串布尔类型 控制台输入随机数产生枚举定义数组数组便利 指针基础野指针空指针指针运算动态内存分配 结构体结构体默认值结构体数组结构体指针结构体指针数组函数无返回值函数和void类型地址传递函数传递数组 引用函数引用传参返回指针的正确写法函数返回数组