[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

相关文章

mysql的基础语句和外键查询及其语句详解(推荐)

《mysql的基础语句和外键查询及其语句详解(推荐)》:本文主要介绍mysql的基础语句和外键查询及其语句详解(推荐),本文给大家介绍的非常详细,对大家的学习或工作具有一定的参考借鉴价值,需要的朋... 目录一、mysql 基础语句1. 数据库操作 创建数据库2. 表操作 创建表3. CRUD 操作二、外键

Python基础语法中defaultdict的使用小结

《Python基础语法中defaultdict的使用小结》Python的defaultdict是collections模块中提供的一种特殊的字典类型,它与普通的字典(dict)有着相似的功能,本文主要... 目录示例1示例2python的defaultdict是collections模块中提供的一种特殊的字

利用Python快速搭建Markdown笔记发布系统

《利用Python快速搭建Markdown笔记发布系统》这篇文章主要为大家详细介绍了使用Python生态的成熟工具,在30分钟内搭建一个支持Markdown渲染、分类标签、全文搜索的私有化知识发布系统... 目录引言:为什么要自建知识博客一、技术选型:极简主义开发栈二、系统架构设计三、核心代码实现(分步解析

Python基础文件操作方法超详细讲解(详解版)

《Python基础文件操作方法超详细讲解(详解版)》文件就是操作系统为用户或应用程序提供的一个读写硬盘的虚拟单位,文件的核心操作就是读和写,:本文主要介绍Python基础文件操作方法超详细讲解的相... 目录一、文件操作1. 文件打开与关闭1.1 打开文件1.2 关闭文件2. 访问模式及说明二、文件读写1.

使用Python实现快速搭建本地HTTP服务器

《使用Python实现快速搭建本地HTTP服务器》:本文主要介绍如何使用Python快速搭建本地HTTP服务器,轻松实现一键HTTP文件共享,同时结合二维码技术,让访问更简单,感兴趣的小伙伴可以了... 目录1. 概述2. 快速搭建 HTTP 文件共享服务2.1 核心思路2.2 代码实现2.3 代码解读3.

MySQL双主搭建+keepalived高可用的实现

《MySQL双主搭建+keepalived高可用的实现》本文主要介绍了MySQL双主搭建+keepalived高可用的实现,文中通过示例代码介绍的非常详细,对大家的学习或者工作具有一定的参考学习价值,... 目录一、测试环境准备二、主从搭建1.创建复制用户2.创建复制关系3.开启复制,确认复制是否成功4.同

C#基础之委托详解(Delegate)

《C#基础之委托详解(Delegate)》:本文主要介绍C#基础之委托(Delegate),具有很好的参考价值,希望对大家有所帮助,如有错误或未考虑完全的地方,望不吝赐教... 目录1. 委托定义2. 委托实例化3. 多播委托(Multicast Delegates)4. 委托的用途事件处理回调函数LINQ

使用DeepSeek搭建个人知识库(在笔记本电脑上)

《使用DeepSeek搭建个人知识库(在笔记本电脑上)》本文介绍了如何在笔记本电脑上使用DeepSeek和开源工具搭建个人知识库,通过安装DeepSeek和RAGFlow,并使用CherryStudi... 目录部署环境软件清单安装DeepSeek安装Cherry Studio安装RAGFlow设置知识库总

Linux搭建Mysql主从同步的教程

《Linux搭建Mysql主从同步的教程》:本文主要介绍Linux搭建Mysql主从同步的教程,具有很好的参考价值,希望对大家有所帮助,如有错误或未考虑完全的地方,望不吝赐教... 目录linux搭建mysql主从同步1.启动mysql服务2.修改Mysql主库配置文件/etc/my.cnf3.重启主库my

国内环境搭建私有知识问答库踩坑记录(ollama+deepseek+ragflow)

《国内环境搭建私有知识问答库踩坑记录(ollama+deepseek+ragflow)》本文给大家利用deepseek模型搭建私有知识问答库的详细步骤和遇到的问题及解决办法,感兴趣的朋友一起看看吧... 目录1. 第1步大家在安装完ollama后,需要到系统环境变量中添加两个变量2. 第3步 “在cmd中