在window平台运行Dubbo的一个小demo

250 阅读1分钟

1.下载zookeeper

下载3.4.10版本

http://mirrors.hust.edu.cn/apache/zookeeper/

2.运行zookeeper

conf目录下配置好zoo.cfg文件(主要是将zoo_sample.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目录下启动:
    打开dos窗体运行zkServer.cmd
    zkEnv.cmd主要zookeeper的相关环境配置文件,如JAVA_HOME的指定

3.Dubbo的管理控制台

tomcat采用的8.6

主要是需要采用mvn的命令需要将Dubbo的admin的模块打包成war放到tomcat的webapps

cd到tomcat的bin目录,启动startup.bat

4.Dubbo整合zookeeper的的依赖

主要存在zookeeper的依赖:
    groupId是:org.apache.zookeeper
    artifactId是:zookeeper
    版本是:3.4.6
已经zkclient的依赖:
     groupId是:com.github.sgroschupf
    artifactId是:zkclient
    版本是:0.1
	



Dubbo参考:

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

主要指定服务注册的地址:
    
    <dubbo:registry address="zookeeper://127.0.0.1:2181"></dubbo:registry>