CentOS6.5下安装ZooKeeper3.4.8单机模式(Standalone mode)

1.需求

安装ZooKeeper

2.下载

http://mirror.bit.edu.cn/apache/zookeeper/zookeeper-3.4.8/

当前stable版是zookeeper-3.4.8

3.解压

上传到/usr/local路径下

tar –xf  zookeeper-3.4.8.tar.gz

解压文件到"/usr/local/zookeeper-3.4.8".

4.复制conf目录下的zoo_sample.cfg,并命名为zoo.cfg

5.修改zoo.cfg配置文件

# The number of millisecondsof each tick

tickTime=2000

# The number of ticks thatthe initial

# synchronization phase cantake

initLimit=10

# The number of ticks thatcan pass between

# sending a request andgetting an acknowledgement

syncLimit=5

# the directory where thesnapshot is stored.

# do not use /tmp forstorage, /tmp here is just

# example sakes.

dataDir=/data/zookeeper/data

dataLogDir=/data/zookeeper/logs

# the port at which theclients will connect

clientPort=2181

# the maximum number ofclient connections.

# increase this if you needto handle more clients

#maxClientCnxns=60

#

# Be sure to read themaintenance section of the

# administrator guide beforeturning on autopurge.

#

#http://zookeeper.apache.org/doc/ ... html#sc_maintenance

#

# The number of snapshots toretain in dataDir

#autopurge.snapRetainCount=3

# Purge task interval inhours

# Set to "0" todisable auto purge feature

#autopurge.purgeInterval=1

启动:

cd/usr/local/zookeeper-3.4.8/bin

./zkServer.sh start


查看状态:

cd/usr/local/zookeeper-3.4.8/bin

./zkServer.shstatus


启动客户端

cd/usr/local/zookeeper-3.4.8/bin

./zkCli.sh -server 127.0.0.1:2181

停止zookeeper进程:

cd/usr/local/zookeeper-3.4.8/bin

./zkServer.shstop

修改防火墙:

在开启了防火墙时,如果用java客户端连接时,会报连接失败错误,做如下设置,开启相关端口, 

修改/etc/sysconfig/iptables 文件,添加以下内容: 

vi /etc/sysconfig/iptables 

-A INPUT -m state --state NEW -m tcp -p tcp --dport 2181 -j ACCEPT

修改完后,重启防火墙:

service iptables stop 

service iptables start 


转载于:https://my.oschina.net/ydsakyclguozi/blog/626668

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值