zookeeper和dubbo-admin管理中心的搭建

ZooKeeper是一个分布式的,开放源码的分布式应用程序协调服务,是Google的Chubby一个开源的实现,是Hadoop和Hbase的重要组件。它是一个为分布式应用提供一致性服务的软件,提供的功能包括:配置维护、名字服务、分布式同步、组服务等。

  ZooKeeper官网为:http://zookeeper.apache.org/

  Dubbo是Alibaba开源的分布式服务框架,它最大的特点是按照分层的方式来架构,使用这种方式可以使各个层之间解耦合(或者最大限度地松耦合)。从服务模型的角度来看,Dubbo采用的是一种非常简单的模型,要么是提供方提供服务,要么是消费方消费服务,所以基于这一点可以抽象出服务提供方(Provider)和服务消费方(Consumer)两个角色。关于注册中心、协议支持、服务监控等内容。

  Dubbo官网为:http://dubbo.io/

一、zookeeper安装

    下载,解压,修改配置文件。

      Zookeeper 的配置文件在conf目录下,这个目录下有 zoo_sample.cfg 和 log4j.propert ies,你需要做的就是zoo_sample.cfg 改名为 zoo.cfg,因为 Zookeeper 在启动时会找这个文件作为默认配置文件。

# 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=C:\\Users\\xiliangmen\\Desktop\\xzp\\zookeeper-3.3.6\\data  
dataLogDir=C:\\Users\\xiliangmen\\Desktop\\xzp\\zookeeper-3.3.6\\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

    

参数说明:

tickTime:zookeeper中使用的基本时间单位, 毫秒值这个时间是作为Zookeeper 服务器之间或客户端与服务器之间维持心跳的时间间隔,也就是每个 t ickTime 时间就会发送一个心跳。

dataDir:数据目录. 可以是任意目录,默认情况下,Zookeeper 将写数据

的日志文件也保存在这个目录里。

clientPort:这个端口就是客户端连接 Zookeeper 服务器的端口,Zookeeper 会监听这个端口,接受客户端的访问请求。

至此, zookeeper的单机模式已经配置好了. 启动server只需运行bin目录下的zkServer.cmd即可

二、dubbo-admin管理平台的安装

    因为zookeeper只是一个黑框,我们无法看到是否存在了什么提供者或消费者,这时就要借助Dubbo-Admin管理平台来实时的查看,也可以通过这个平台来管理提者和消费者。

点击下载:dubbo-admin.war

    下载好dubbo-admin.war后,我们就可以按常用的web部署方式进行部署即可,把war包放到tomcat的webapps目录下,启动tomcat,后再部署下相应的参数。配置修改tomcat的端口8088,修改方法如下,打到conf下的文件 server.xml,因为zookeeper会用到8080的端口,所以为了不冲突,把Tomcat的端口改一下image.png

    1.启动zookeeper

  2.启动tomcat

  访问http: //ip地址:端口号/dubbo-admin-2.5.4 / 一定要注意名一定要和你webapp下的工程名一样,如果一切正常,则会弹出登录界面,输入密码image.png

参考文章:

  ZooKeeper官网为:http://zookeeper.apache.org/

  Dubbo官网为:http://dubbo.io/

  Zookeeper在线API速查:http://zookeeper.apache.org/doc/r3.4.6/api/index.html

  Zookeeper学习:http://www.cnblogs.com/sunddenly/category/620563.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值