获取dubbo源码编译并导入idea以及启动入门项目dubbo-demo

一直想研究下dubbo,然后就动手开始干啦。。
首先说一下dubbo说明文档的一些坑,按照文档部署不一定能部署起来,不过它是一个基本的参考,建议部署dubbo是参考dubbox的部署说明。很神奇。
1、下载zookeeper并部署
下载地址
http://mirror.bit.edu.cn/apache/zookeeper/zookeeper-3.4.10/
下载后解压并编辑conf/zoo.cfg文件
这是我的文件内容

# The number of milliseconds of each tick
tickTime=2000
# The number of ticks that the initial 
# synchronization phase can take
initLimit=10
# The number of ticks that can pass between 
# sending a request and getting an acknowledgement
syncLimit=5
# the directory where the snapshot is stored.
# do not use /tmp for storage, /tmp here is just 
# example sakes.
dataDir=D:\\zookeeper\\data
dataLogDir=D:\\zookeeper\\log
# the port at which the clients will connect
clientPort=2181
# the maximum number of client connections.
# increase this if you need to handle more clients
#maxClientCnxns=60
#
# Be sure to read the maintenance section of the 
# administrator guide before turning on autopurge.
#
# http://zookeeper.apache.org/doc/current/zookeeperAdmin.html#sc_maintenance
#
# The number of snapshots to retain in dataDir
#autopurge.snapRetainCount=3
# Purge task interval in hours
# Set to "0" to disable auto purge feature
#autopurge.purgeInterval=1

然后启动bin/zkServer.cmd启动zookeeper服务。
这里写图片描述
2、获取dubbo源码
话说阿里又开始更新dbuuo(官网地址http://dubbo.apache.org)了,
GitHub源码地址:
控制中心:[ https://github.com/apache/incubator-dubbo-ops ]
dubbo项目地址:[ https://github.com/apache/incubator-dubbo ]
在你的workspace中打开git客户端,然后开始下载项目
输入命令

git clone https://github.com/apache/incubator-dubbo.git

等待下载完,然后输入

cd incubator-dubbo

然后输入

mvn install -Dmaven.test.skip=true

然后再输入

mvn idea:ideamvn eclipse:eclipse  (根据自己使用的开发工具而言进行选择)

然后再进行控制中心项目进行编译,也是输入命令

git clone https://github.com/apache/incubator-dubbo-ops.git

等待下载完,然后输入

cd incubator-dubbo

然后输入

mvn install -Dmaven.test.skip=true

然后再输入

mvn idea:ideamvn eclipse:eclipse  (根据自己使用的开发工具而言进行选择)

至此,项目已经编译好了,然后可以打开idea并导入相关项目如下图:
这里写图片描述
dubbo-demo项目分为三个主要模块,分别是dubbo-demo-api、dubbo-demo-consumer、dubbo-demo-provider。这里需要修改连个地方
dubbo-demo-consumer下的dubbo-demo-consumer.xml就是把订阅中心改为zookeeper,端口自定义
这里写图片描述

 <dubbo:registry address="zookeeper://localhost:2181"/>

然后启动Consumer类 (直接右键运行main方法即可)
dubbo-demo-provider下的dubbo-demo-provider.xml中的配置修改为zookeeper发布
这里写图片描述

<dubbo:registry address="zookeeper://localhost:2181"/>

主要作用可以参考http://dubbo.apache.org 有详细描述。
这里写图片描述
然后启动Provider类 (直接右键运行main方法即可)
这里写图片描述
这里写图片描述
控制中心项目最主要的就是dubbo-admin了,它是一个web你可以在idea里发布它到Tomcat或者用target下编译好的jar直接部署到Tomcat。
然后访问http://localhost:8080 输入用户名:root 密码:root 或 用户名:guest 密码:guest即可
这里写图片描述

参考:
https://xuliugen.gitbooks.io/javaweb-1/31-dubbo%E7%AE%80%E4%BB%8B.html
http://dubbo.apache.org/books/dubbo-user-book/preface/usage.html
http://dubbo.apache.org/books/dubbo-admin-book/install/admin-console.html

  • 0
    点赞
  • 8
    收藏
    觉得还不错? 一键收藏
  • 5
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 5
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值