ZooKeeper:win7上安装单机及伪分布式安装

  zookeeper是一个为分布式应用所设计的分布式的、开源的调度服务,它主要用来解决分布式应用中经常遇到的一些数据管理问题,简化分布式应用,协调及其管理的难度,提高性能的分布式服务。

  本章的目的:如何安装zookeeper(在win7环境下),zookeeper下载https://mirrors.cnnic.cn/apache/zookeeper/。这里下载的版本是3.4.8.  

  zoomkeeper本身是可以单节点模式安装运行,不过一般为了确保zookeeper的稳定性和可用性,都会采用分布式部署,也进而保证了分布式应用的可靠性。它在分布式zookepper集群中,会基于选举算法来实现一个leader,多个follower。

  参考文章:http://blog.csdn.net/lovesummerforever/article/details/48975703

  • 单节点安装及配置:

1)下载zookeeper-3.4.8.tar.gz,并解压到目录:D:\Work\zookeeper\zookeeper-3.4.8下

2)进入conf目录下把zoo_sample.cfg文件重名为:zoo.cfg,并修改配置为如下:

# 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=D:\\Work\\zookeeper\\data
# log config
dataLogDir=D:\\Work\\zookeeper\\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

3)启动zookeeper服务:

进入目录:D:\Work\zookeeper\zookeeper-3.4.8\bin,执行zkServer.cmd,这样就启动了zookeeper服务了。

--启动打印信息
D:\Work\zookeeper\zookeeper-3.4.8\bin>zkServer.cmd

D:\Work\zookeeper\zookeeper-3.4.8\bin>call "D:\Program Files\Java\jdk1.8.0_111"\bin\java "-Dzookeeper.log.dir=D:\Work\zookeeper\zookeeper-3.4.8\bin\.." "-Dzookeeper.root.logger=INFO,CONSOLE" -cp "D:\Work\zookeeper\zookeeper-3.4.8\bin\..\build\classes;D:\Work\zookeeper\zookeeper-3.4.8\bin\..\build\lib\*;D:\Work\zookeeper\zookeeper-3.4.8\bin\..\*;D:\Work\zookeeper\zookeeper-3.4.8\bin\..\lib\*;D:\Work\zookeeper\zookeeper-3.4.8\bin\..\conf" org.apache.zookeeper.server.quorum.QuorumPeerMain "D:\Work\zookeeper\zookeeper-3.4.8\bin\..\conf\zoo.cfg"
2017-09-09 21:02:58,180 [myid:] - INFO  [main:[email protected]] - Reading configuration from: D:\Work\zookeeper\zookeeper-3.4.8\bin\..\conf\zoo.cfg
2017-09-09 21:02:58,204 [myid:] - INFO  [main:[email protected]] - autopurge.snapRetainCount set to 3
2017-09-09 21:02:58,205 [myid:] - INFO  [main:[email protected]] - autopurge.purgeInterval set to 0
2017-09-09 21:02:58,205 [myid:] - INFO  [main:[email protected]] - Purge task is not scheduled.
2017-09-09 21:02:58,211 [myid:] - WARN  [main:[email protected]] - Either no config or no quorum defined in config, running  in standalone mode
2017-09-09 21:02:58,445 [myid:] - INFO  [main:[email protected]] - Reading configuration from: D:\Work\zookeeper\zookeeper-3.4.8\bin\..\conf\zoo.cfg
2017-09-09 21:02:58,446 [myid:] - INFO  [main:[email protected]] - Starting server
2017-09-09 21:02:58,769 [myid:] - INFO  [main:[email protected]] - Server environment:zookeeper.version=3.4.8--1, built on 02/06/2016 03:18 GMT
2017-09-09 21:02:58,772 [myid:] - INFO  [main:[email protected]] - Server environment:host.name=192.168.233.1
2017-09-09 21:02:58,777 [myid:] - INFO  [main:[email protected]] - Server environment:java.version=1.8.0_111
2017-09-09 21:02:58,778 [myid:] - INFO  [main:[email protected]] - Server environment:java.vendor=Oracle Corporation
2017-09-09 21:02:58,780 [myid:] - INFO  [main:[email protected]] - Server environment:java.home=D:\Program Files\Java\jdk1.8.0_111\jre
2017-09-09 21:02:58,782 [myid:] - INFO  [main:[email protected]] - Server environment:java.class.path=D:\Work\zookeeper\zookeeper-3.4.8\bin\..\build\classes;D:\Work\zookeeper\zookeeper-3.4.8\bin\..\build\lib\*;D:\Work\zookeeper\zookeeper-3.4.8\bin\..\zookeeper-3.4.8.jar;D:\Work\zookeeper\zookeeper-3.4.8\bin\..\lib\jline-0.9.94.jar;D:\Work\zookeeper\zookeeper-3.4.8\bin\..\lib\log4j-1.2.16.jar;。。。2017-09-09 21:02:58,784 [myid:] - INFO  [main:[email protected]] - Server environment:java.library.path=D:\Program Files\Java\jdk1.8.0_111\bin;D:\Program Files\Java\jdk1.8.0_111\bin;D:\Program Files\Java\jdk1.8.0_111\jre\bin;
.
2017-09-09 21:02:58,789 [myid:] - INFO  [main:[email protected]] - Server environment:java.io.tmpdir=C:\Users\ADMINI~1\AppData\Local\Temp2017-09-09 21:02:58,791 [myid:] - INFO  [main:[email protected]] - Server environment:java.compiler=<NA>
2017-09-09 21:02:58,800 [myid:] - INFO  [main:[email protected]] - Server environment:os.name=Windows 7
2017-09-09 21:02:58,801 [myid:] - INFO  [main:[email protected]] - Server environment:os.arch=amd64
2017-09-09 21:02:58,804 [myid:] - INFO  [main:[email protected]] - Server environment:os.version=6.1
2017-09-09 21:02:58,811 [myid:] - INFO  [main:[email protected]] - Server environment:user.name=Administrator
2017-09-09 21:02:58,813 [myid:] - INFO  [main:[email protected]] - Server environment:user.home=C:\Users\Administrator
2017-09-09 21:02:58,816 [myid:] - INFO  [main:[email protected]] - Server environment:user.dir=D:\Work\zookeeper\zookeeper-3.4.8\bin
2017-09-09 21:02:58,849 [myid:] - INFO  [main:[email protected]] - tickTime set to 2000
2017-09-09 21:02:58,851 [myid:] - INFO  [main:[email protected]] - minSessionTimeout set to -1
2017-09-09 21:02:58,852 [myid:] - INFO  [main:[email protected]] - maxSessionTimeout set to -1
2017-09-09 21:03:00,548 [myid:] - INFO  [main:[email protected]] - binding to port 0.0.0.0/0.0.0.0:2181

--当客户端启动后,就立即打印出来以下信息:
2017-09-09 21:05:23,463 [myid:] - INFO  [NIOServerCxn.Factory:0.0.0.0/0.0.0.0:2181:[email protected]] - Accepted socket connection from /127.0.0.1:33988
2017-09-09 21:05:23,483 [myid:] - INFO  [NIOServerCxn.Factory:0.0.0.0/0.0.0.0:2181:[email protected]] - Client attempting to establish new session at /127.0.0.1:33988
2017-09-09 21:05:23,496 [myid:] - INFO  [SyncThread:0:[email protected]] - Creating new log file: log.1
2017-09-09 21:05:23,542 [myid:] - INFO  [SyncThread:0:[email protected]] - Established session 0x15e66bc75ec0000 with negotiated timeout 30000 for client /127.0.0.1:33988

4)启动客户端

进入目录:D:\Work\zookeeper\zookeeper-3.4.8\bin,执行zkCli.cmd -server 127.0.0.1:2181,这样就启动了zookeeper服务了。

D:\Work\zookeeper\zookeeper-3.4.8\bin>zkCli.cmd -server 127.0.0.1:2181
Connecting to 127.0.0.1:2181
2017-09-09 21:05:21,934 [myid:] - INFO  [main:[email protected]] - Client environment:zookeeper.version=3.4.8--1, built on 02/06/2016 03:18 GMT
2017-09-09 21:05:21,942 [myid:] - INFO  [main:[email protected]] - Client environment:host.name=192.168.233.1
2017-09-09 21:05:21,943 [myid:] - INFO  [main:[email protected]] - Client environment:java.version=1.8.0_111
2017-09-09 21:05:21,947 [myid:] - INFO  [main:[email protected]] - Client environment:java.vendor=Oracle Corporation
2017-09-09 21:05:21,948 [myid:] - INFO  [main:[email protected]] - Client environment:java.home=D:\Program Files\Java\jdk1.8.0_111\jre
2017-09-09 21:05:21,949 [myid:] - INFO  [main:[email protected]] - Client environment:java.class.path=D:\Work\zookeeper\zookeeper-3.4.8\bin\..\build\classes;D:\Work\zookeeper\zookeeper-3.4.8\bin\..。。。。;
.
2017-09-09 21:05:21,960 [myid:] - INFO  [main:[email protected]] - Client environment:java.io.tmpdir=C:\Users\ADMINI~1\AppData\Local\Temp2017-09-09 21:05:21,963 [myid:] - INFO  [main:[email protected]] - Client environment:java.compiler=<NA>
2017-09-09 21:05:21,965 [myid:] - INFO  [main:[email protected]] - Client environment:os.name=Windows 7
2017-09-09 21:05:21,967 [myid:] - INFO  [main:[email protected]] - Client environment:os.arch=amd64
2017-09-09 21:05:21,969 [myid:] - INFO  [main:[email protected]] - Client environment:os.version=6.1
2017-09-09 21:05:21,973 [myid:] - INFO  [main:[email protected]] - Client environment:user.name=Administrator
2017-09-09 21:05:21,975 [myid:] - INFO  [main:[email protected]] - Client environment:user.home=C:\Users\Administrator
2017-09-09 21:05:21,977 [myid:] - INFO  [main:[email protected]] - Client environment:user.dir=D:\Work\zookeeper\zookeeper-3.4.8\bin
2017-09-09 21:05:21,983 [myid:] - INFO  [main:[email protected]] - Initiating client connection, connectString=127.0.0.1:2181 sessionTimeout=30000 watcher=org.apache.zookeeper.ZooKeeperMain$MyWatcher@7aec35a
Welcome to ZooKeeper!
2017-09-09 21:05:23,459 [myid:] - INFO  [main-SendThread(127.0.0.1:2181):ClientCnxn$SendThread@1032] - Opening socket connection to server 127.0.0.1/127.0.0.1:2181. Will not attempt to authenticate using SASL (unknown error)
2017-09-09 21:05:23,464 [myid:] - INFO  [main-SendThread(127.0.0.1:2181):ClientCnxn$SendThread@876] - Socket connection established to 127.0.0.1/127.0.0.1:2181, initiating session
JLine support is enabled
[zk: 127.0.0.1:2181(CONNECTING) 0] 2017-09-09 21:05:23,548 [myid:] - INFO  [main-SendThread(127.0.0.1:2181):ClientCnxn$SendThread@1299] - Session establishmentcomplete on server 127.0.0.1/127.0.0.1:2181, sessionid = 0x15e66bc75ec0000, negotiated timeout = 30000

WATCHER::

WatchedEvent state:SyncConnected type:None path:null

这样就安装完成了单节点zookeeper服务。

时间: 2024-12-24 03:16:01

ZooKeeper:win7上安装单机及伪分布式安装的相关文章

Linux系统zookeeper环境搭建(单机、伪分布式、分布式)

本人现在对zookeeper的环境搭建做一个总结,一般zookeeper的安装部署可以有三种模式,单机模式.伪分布式和分布式,这三种模式在什么时候应用具体看大家的使用场景,如果你只有一台机器且只是想自己开发测试时用,你可以安装个单机模式,简单又实用.如果想装逼但又没有足够的机器,那你可以选择伪分布式的方式搭建,这可以满足你内心高大上的分布式需求又可以满足没有机器的屌丝现状.如果手头有三台以上的服务器,那就可以大展高富帅的风采,直接上真的分布式,真的分布式部署一般是在系统的正式环境中应用.下面我来

Hadoop伪分布式安装

本文介绍的主要是Hadoop的伪分布式的搭建以及遇到的相关问题的解决,做一下记录,jdk的安装这里就不做太多的介绍了,相信大家根据网上的安装介绍很快就能安装成功. 环境 操作系统 Oracle VM VirtualBox-rhel-6.4_64   本机名称 yanduanduan   本机IP 192.168.1.102   JDK 1.7.0_79   hadoop 2.7.3 点此下载 Hadoop 有两个主要版本,Hadoop 1.x.y 和 Hadoop 2.x.y 系列,比较老的教材

Zookeeper 初体验之——伪分布式安装(转)

原文地址: http://blog.csdn.net/salonzhou/article/details/47401069 简介 Apache Zookeeper 是由 Apache Hadoop 的 Zookeeper 子项目发展而来,现在已经成为了 Apache 的顶级项目.Zookeeper 为分布式系统提供了高效可靠且易于使用的协同服务,它可以为分布式应用提供相当多的服务,诸如统一命名服务,配置管理,状态同步和组服务等.Zookeeper 接口简单,开发人员不必过多地纠结在分布式系统编程

(转)Zookeeper 初体验之——伪分布式安装

Zookeeper 初体验之——伪分布式安装 简介 Apache Zookeeper 是由 Apache Hadoop 的 Zookeeper 子项目发展而来,现在已经成为了 Apache 的顶级项目.Zookeeper 为分布式系统提供了高效可靠且易于使用的协同服务,它可以为分布式应用提供相当多的服务,诸如统一命名服务,配置管理,状态同步和组服务等.Zookeeper 接口简单,开发人员不必过多地纠结在分布式系统编程难于处理的同步和一致性问题上,你可以使用 Zookeeper 提供的现成(of

【Hadoop】在Ubuntu系统下安装Hadoop单机/伪分布式安装

Ubuntu 14.10 前方有坑: 由于之前的分布式系统电脑带不动,所以想换一个伪分布式试一试.用的是Virtualbox + Ubuntu 14.10 .结果遇到了 apt-get 源无法更新的情况,以及安装包安装不全的情况.只好咬一咬牙,又重新把系统给更新一边. apt-get 源无法更新解决方案:传送门 首先先备份源列表: sudo cp /etc/apt/sources.list /etc/apt/sources.list_backup 用编辑器打开: sudo gedit /etc/

HBase基础和伪分布式安装配置

一.HBase(NoSQL)的数据模型 1.1 表(table),是存储管理数据的. 1.2 行键(row key),类似于MySQL中的主键,行键是HBase表天然自带的,创建表时不需要指定 1.3 列族(column family),列的集合. 一张表中有多个行健,一个行健读取出来的是一条记录,列族和MySQL中的列差不多,但是它是列的集合 HBase中列族是需要在定义表时指定的,列是在插入记录时动态增加的. HBase表中的数据存储在本地磁盘上的时候,每个列族单独一个作为文件存储. 上图表

Hadoop学习笔记_4_实施Hadoop集群 --伪分布式安装

实施Hadoop集群 --伪分布式安装 准备与配置安装环境 安装虚拟机和linux,虚拟机推荐使用vmware,PC可以使用workstation,服务器可以使用ESXi,在管理上比较方便.ESXi还可以通过拷贝镜像文件复制虚拟机,复制后自动修改网卡号和ip,非常快捷.如果只是实验用途,硬盘大约预留20-30G空间. 以Centos为例,分区可以选择默认[如果想要手动分区,请参考博客:http://blog.csdn.net/zjf280441589/article/details/175485

Hadoop日记Day3---Hadoop的伪分布式安装

导录 比较仔细的读者可能发现,注意本章的图片又不太对劲的地方,那就是linux中的主机名有的是hadoop,有的是localhost,是由于使用的不同的电脑编辑的本文章,有的电脑上并没有修改主机名,一直使用默认的localhost主机名,不影响大家的学习,只是主机名不一样,其他的都一样,大家注意一下就可以了,自己是什么主机名,就把他看成自己的主机名就可以了,文章中的localhost和hadoop只是不同的主机名,他们的目录结构都是一样的.还有就是一下的软件下载地址:http://pan.bai

hadoop伪分布式安装【翻译自hadoop1.1.2官方文档】

1.hadoop支持的平台: GNU/Linux平台是一个开发和生产的平台. hadoop已经被证明可以在GNU/Linux平台不是2000多个节点. win32是一个开发平台,分布式操作还没有在win32系统上很好的测试, 所以它不被作为生产环境. 2.安装hdoop需要的软件: linux和windows下安装hadoop需要的软件: 2.1从sun官网下载的1.6的jdk必须被安装. 2.2ssh 必须被安装 and ssh协议必须使用hadoop脚本用来管理远程的hadoop进程. 2.