springMVC整合dubbo+zookeeper

本文介绍了如何在SpringMVC项目中整合Dubbo和Zookeeper,包括Zookeeper的安装配置,Dubbo服务提供者和消费者的创建,以及解决相关配置问题。通过实例详细阐述了从接口定义到服务发布和消费的全过程。
摘要由CSDN通过智能技术生成

本来负责的支付项目中有一个调用第三方短信平台的接口,因为短信平台要求短信发送有IP白名单限制,于是老大决定将项目中短信发送这一块提取出来,项目中使用dubbo,和zookeeper相关配置。

参照dubbo官网,附上dubbo官网上quickstart部分:http://dubbo.io/User+Guide-zh.htm

其实很早之前就想看dubbo和zookeeper,可是看到dubbo官网上那么多架构就很烦躁,所以知难而退,本次即将在项目中使用,所以扎下心来看官网上的快速启动部分。也百度了很多相关配置,终于搞定了dubbo的入门部分

用到dubbo,首先安装zookeeper,作为调度中心。下面介绍zookeeper的安装。

1. 解压zookeeper-3.4.9.tar.gz到指定目录,进入zookeeper-3.4.9\conf目录并复制zoo_sample.cfg文件改名为zoo.cfg


因为zookeeper启动时默认找zoo.cfg这个文件,修改zoo.cfg文件内容如下:  

# The number of milliseconds of each tick  
<span style="color:#ff0000;">tickTime=2000  </span>
# The number of ticks that the initial   
# synchronization phase can take  
<span style="color:#ff0000;">initLimit=10  </span>
# The number of ticks that can pass between   
# sending a request and getting an acknowledgement  
<span style="color:#ff0000;">syncLimit=5  </span>
# the directory where the snapshot is stored.  
# do not use /tmp for storage, /tmp here is just   
# example sakes.   
dataDir=E:\Develop\DevelopmentKit\zookeeper-3.4.9\data
# 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 

到此zookeeper安装完毕,进入zookeeper-3.4.6\bin目录,执行zkServer.cmd或者zkServer.sh脚本就可以

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值