dubbo--3.注册中心Zookeeper

1.  注册中心

1.1. Zookeeper介绍

官方推荐使用zookeeper注册中心。

注册中心负责服务地址的注册与查找,相当于目录服务,服务提供者和消费者只在启动时与注册中心交互,注册中心不转发请求,压力较小。使用dubbo-2.3.3以上版本,建议使用zookeeper注册中心。

Zookeeper是Apacahe Hadoop的子项目,是一个树型的目录服务,支持变更推送,适合作为Dubbo服务的注册中心,工业强度较高,可用于生产环境,并推荐使用

 

Zookeeper:

1、可以作为集群的管理工具使用。

2、可以集中管理配置文件。

 

1.2. linux的安装

安装环境:

Linux:centos6.4

Jdk:1.7以上版本

 

Zookeeper是java开发的可以运行在windows、linux环境。需要先安装jdk。

安装步骤:

第一步:安装jdk

第二步:把zookeeper的压缩包上传到linux系统。

第三步:解压缩压缩包

tar -zxvfzookeeper-3.4.6.tar.gz

第四步:进入zookeeper-3.4.6目录,创建data文件夹。

第五步:把zoo_sample.cfg改名为zoo.cfg

[root@localhost conf]#mv zoo_sample.cfg zoo.cfg

第六步:修改data属性:dataDir=/root/zookeeper-3.4.6/data

第七步:启动zookeeper

[root@localhost bin]#./zkServer.sh start

关闭:[root@localhostbin]# ./zkServer.sh stop

查看状态:[root@localhostbin]# ./zkServer.sh status

 

注意:需要关闭防火墙。

service iptables stop

永久关闭修改配置开机不启动防火墙:

chkconfig iptables off

如果不能成功启动zookeeper,需要删除data目录下的zookeeper_server.pid文件。

 

1.3. Windows下安装

1.3.1.    第一步 解压到指定目录

解压到

并且新建文件夹data和log

 

1.3.2.    第二步 zoo.cfg

在conf文件新建zoo.cfg可由zoo_simple.cfg复制

并修改以下内容

# The number of milliseconds of eachtick 
tickTime=2000 
# The number of ticks that the initial  
# synchronization phase can take 
initLimit=10 
# The number of ticks that can passbetween  
# sending a request and getting anacknowledgement 
syncLimit=5 
# the directory where the snapshot isstored. 
# do not use /tmp for storage, /tmp here isjust  
# example sakes. 
dataDir=E:\\zookeeper\\data 
dataLogDir=E:\\zookeeper\\log 
# the port at which the clients willconnect 
clientPort=2181 
# the maximum number of clientconnections. 
# increase this if you need to handle moreclients 
#maxClientCnxns=60 
# 
# Be sure to read the maintenance sectionof the  
# administrator guide before turning onautopurge. 
# 
# http://zookeeper.apache.org/doc/current/zookeeperAdmin.html#sc_maintenance 
# 
# The number of snapshots to retain indataDir 
#autopurge.snapRetainCount=3 
# Purge task interval in hours 
# Set to "0" to disable autopurge feature 
#autopurge.purgeInterval=1 

 

1.3.3.    第三步 测试启动 必须打开

双击zkServer.cmd或者

 

另外在右键打开命令窗口

 

再继续运行zkCli.cmd

 

注意看是否有错误信息,而且运行dubbo程序时这个必须打开

 

2.  问题

2.1. jps 报processinformation unavailable解决办法

 

jps 报process information unavailable解决办法,说明进程没有启动,删除缓存文件

C:\Users\Administrator\AppData\Local\Temp

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值