本来负责的支付项目中有一个调用第三方短信平台的接口,因为短信平台要求短信发送有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脚本就可以