Zookeeper(一)安装
来源:互联网 发布:淘宝网店域名怎么改 编辑:程序博客网 时间:2024/05/24 06:18
一、下载zookeeper
在apache的官网下载zookeeper,http://mirrors.cnnic.cn/apache/zookeeper/
当前stable的版本是3.4.6,安装文件zookeeper-3.4.6.tar.gz
二、安装zookeeper
如果安装文件没有执行权限,则执行
chmod +x zookeeper-3.4.6.tar.gz执行以下命令:
tar -xzvf zookeeper-3.4.6.tar.gz执行完,会有目录zookeeper-3.4.6
创建zookeeper的data目录,目录看个人而定的,我是创建跟zookeeper-3.4.6同级目录的,
mkdir zkdata
lszkdata zookeeper-3.4.6
接着修改zookeeper的配置文件conf/zoo.cfg
cd zookeeper-3.4.6/conf/; ls会看到有文件zoo_sample.cfg,复制份zoo.cfg文件出来
cp zoo_sample.cfg zoo.cfg修改zoo.cfg
vim zoo.cfg
# synchronization phase can takeinitLimit=10# The number of ticks that can pass between # sending a request and getting an acknowledgementsyncLimit=5# the directory where the snapshot is stored.# do not use /tmp for storage, /tmp here is just # example sakes.#dataDir=/tmp/zookeeperdataDir=/root/zookeeper-a/zkdata# the port at which the clients will connectclientPort=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其中,
dataDir就指向zookeeper存放数据的目录,就是刚才创建的目录zkdata
clientPort=2181,是设定zookeeper的端口
启动zookeeper
cd ../bin/; lsREADME.txt zkCli.cmd zkEnv.cmd zkServer.cmd zookeeper.out
zkCleanup.sh zkCli.sh zkEnv.sh zkServer.sh
其中,
zkServer.sh,启动zookeeper
zkCli.sh,客户端连接zookeeper的程序,后面再讲,
./zkServer.sh start这样zookeeper就启动了。
如果想停止zookeeper
./zkServer.sh stopzkServer.sh有以下用法
Usage: ./zkServer.sh {start|start-foreground|stop|restart|status|upgrade|print-cmd}
如果想连接上zookeeper,查看,操作zookeeper,可执行以下命令:
./zkCli.sh -server 127.0.0.1:2181
以上是只有一个zookeeper跑的安装情况,如果有几个zookeeper跑,即分布式部署,下面讲。
假设是安装3个zookeeper,则分别在zookeeper的conf/zoo.cfg后面加上内容:
server.1=192.168.89.100:2888:3888server.2=192.168.89.101:2888:3888server.3=192.168.89.102:2888:3888其中,
server.1,server.2,server.3,中的数字1,2,3分别是100,101,102节点的zookeeper的序号,
在目录zkdata下创建文件myid,并分别设置内容为1,2,3
#100节点[root@localhost zkdata]# more myid 1
#101节点[root@localhost zkdata]# more myid 2
#102节点[root@localhost zkdata]# more myid 3则分别启动100,101,102 节点就可以了。
0 0
- Zookeeper(一)安装
- zookeeper系列(一)安装
- Hadoop安装(一)zookeeper集群安装
- zookeeper入门(一)——ZooKeeper伪集群安装
- Zookeeper(一)伪分布式安装
- zookeeper(一)安装与启动
- ZooKeeper入门(一)安装配置使用
- Zookeeper(一)伪分布式安装
- Zookeeper(一)伪分布式安装
- zookeeper介绍及集群安装(一)
- zookeeper使用(一)--简介与安装
- zookeeper(一) --- zookeeper概述
- Zookeeper(一)Zookeeper是什么?
- zookeeper安装和学习(一)
- Dubbo : ZooKeeper安装配置(一)
- dubbo相关(一) zookeeper安装与启动
- zookeeper学习笔记(一) —— centos6.8安装zookeeper以及简单命令
- Zookeeper系列(一)
- div、css入门练习
- CodeForces 402A
- FZU2184 逆序数还原
- 每天学习一点新东西——vim篇(二)
- Enum类型
- Zookeeper(一)安装
- C语言中的数组与指针的关系
- 函数返回引用的注意事项
- iOS第三天认识及了解注意
- LeetCode 合并k个有序链表
- USACO Ski Course Design(枚举)
- 剑指off-反转链表
- UGO权限问题
- spring junit 做单元测试,报 Failed to load ApplicationContext 错误。