我是在linux下使用dubbo-2.3.3以上版本的zookeeper注册中心客户端。Zookeeper是Apache Hadoop的子项目,强度相对较好,建议生产环境使用该注册中心。Dubbo未对Zookeeper服务器端做任何侵入修改,只需安装原生的Zookeeper服务器即可,所有注册中心逻辑适配都在调用Zookeeper客户端时完成。
下载解压
wget http://www.apache.org/dist//zookeeper/zookeeper-3.3.3/zookeeper-3.3.3.tar.gz
tar zxvf zookeeper-3.3.3.tar.gz
cd zookeeper-3.3.3
cp conf/zoo_sample.cfg conf/zoo.cfg
vi conf/zoo.cfg
zoo.cfg的内容如下:(其中data目录需改成你真实输出目录)
# 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.
dataDir=/home/dubbo/zookeeper-3.3.3/data
# the port at which the clients will connect
clientPort=2181
tickTime=2000
initLimit=10
syncLimit=5
dataDir=/home/dubbo/zookeeper-3.3.3/data
clientPort=2181
server.1=ip1
server.2=ip2
并在data目录下放置myid文件:(上面zoo.cfg中的dataDir)
mkdir data
vi myid
启动
./bin/zkServer.sh start
./bin/zkServer.sh stop
管理控制台为内部裁剪版本,开源部分主要包含:路由规则,动态配置,服务降级,访问控制,权重调整,负载均衡,等管理功能。
安装
wget http://apache.etoak.com/tomcat/tomcat-6/v6.0.35/bin/apache-tomcat-6.0.35.tar.gz
tar zxvf apache-tomcat-6.0.35.tar.gz
cd apache-tomcat-6.0.35
rm -rf webapps/ROOT
wget http://code.alibabatech.com/mvn/releases/com/alibaba/dubbo-admin/2.4.1/dubbo-admin-2.4.1.war
unzip dubbo-admin-2.4.1.war -d webapps/ROOT
配置: (或将dubbo.properties放在当前用户目录下)
vi webapps/ROOT/WEB-INF/dubbo.properties
dubbo.registry.address=zookeeper://127.0.0.1:2181
dubbo.admin.root.password=root
dubbo.admin.guest.password=guest
启动
./bin/startup.sh
./bin/shutdown.sh
http://127.0.0.1:8090/