ZooKeeper是Hadoop的正式子項目,它是一個針對大型分佈式系統的可靠協調系統,提供的功能包括:配置維護、名字服務、分佈式同步、組服務等。ZooKeeper的目標就是封裝好複雜易出錯的關鍵服務,將簡單易用的接口和性能高效、功能穩定的系統提供給用戶。html
官網地址:http://zookeeper.apache.org/ java
穩定版本:3.4.6node
windows 10 pro 64位下安裝sql
一、解壓zookeeper-3.4.6.tar.gz文件到 D:\app\sso\zookeeperapache
二、修改 D:\app\sso\zookeeper\conf 路徑下的 zoo_sample.cfg 爲 zoo.cfgwindows
三、打開 zoo.cfg 進行編輯api
# 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:\\app\\sso\\zookeeper\\data #log 日誌位置 dataLogDir=d:\\app\\sso\\zookeeper\\logs # 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
按如上進行編輯 主要是dataDir和dataLogDir的編輯,而後再對應位置新增data和logs文件夾,否則啓動會報錯。app
四、進入到bin目錄,而且啓動zkServer.cmd,這個腳本中會啓動一個java進程maven
輸出以下信息,表明啓動成功分佈式
Microsoft Windows [版本 6.1.7601] 版權全部 (c) 2009 Microsoft Corporation。保留全部權利。 D:\app\sso\zookeeper\bin>zkServer D:\app\sso\zookeeper\bin>java "-Dzookeeper.log.dir=D:\app\sso\zookeeper\bin\.." "-Dzookeeper.root.logger=INFO,CONSOLE" -cp "D:\app\sso\zookeeper\bin\..\build\cl asses;D:\app\sso\zookeeper\bin\..\build\lib\*;D:\app\sso\zookeeper\bin\..\*;D:\a pp\sso\zookeeper\bin\..\lib\*;D:\app\sso\zookeeper\bin\..\conf" org.apache.zooke eper.server.quorum.QuorumPeerMain "D:\app\sso\zookeeper\bin\..\conf\zoo.cfg" 2015-08-14 17:02:22,319 [myid:] - INFO [main:QuorumPeerConfig@103] - Reading co nfiguration from: D:\app\sso\zookeeper\bin\..\conf\zoo.cfg 2015-08-14 17:02:22,334 [myid:] - INFO [main:DatadirCleanupManager@78] - autopu rge.snapRetainCount set to 3 2015-08-14 17:02:22,334 [myid:] - INFO [main:DatadirCleanupManager@79] - autopu rge.purgeInterval set to 0 2015-08-14 17:02:22,334 [myid:] - INFO [main:DatadirCleanupManager@101] - Purge task is not scheduled. 2015-08-14 17:02:22,337 [myid:] - WARN [main:QuorumPeerMain@113] - Either no co nfig or no quorum defined in config, running in standalone mode 2015-08-14 17:02:22,500 [myid:] - INFO [main:QuorumPeerConfig@103] - Reading co nfiguration from: D:\app\sso\zookeeper\bin\..\conf\zoo.cfg 2015-08-14 17:02:22,501 [myid:] - INFO [main:ZooKeeperServerMain@95] - Starting server 2015-08-14 17:02:22,548 [myid:] - INFO [main:Environment@100] - Server environm ent:zookeeper.version=3.4.6-1569965, built on 02/20/2014 09:09 GMT 2015-08-14 17:02:22,549 [myid:] - INFO [main:Environment@100] - Server environm ent:host.name=hanfeng-PC 2015-08-14 17:02:22,552 [myid:] - INFO [main:Environment@100] - Server environm ent:java.version=1.8.0_45 2015-08-14 17:02:22,554 [myid:] - INFO [main:Environment@100] - Server environm ent:java.vendor=Oracle Corporation 2015-08-14 17:02:22,555 [myid:] - INFO [main:Environment@100] - Server environm ent:java.home=C:\Program Files\Java\jre1.8.0_45 2015-08-14 17:02:22,557 [myid:] - INFO [main:Environment@100] - Server environm ent:java.class.path=D:\app\sso\zookeeper\bin\..\build\classes;D:\app\sso\zookeep er\bin\..\build\lib\*;D:\app\sso\zookeeper\bin\..\zookeeper-3.4.6.jar;D:\app\sso \zookeeper\bin\..\lib\jline-0.9.94.jar;D:\app\sso\zookeeper\bin\..\lib\log4j-1.2 .16.jar;D:\app\sso\zookeeper\bin\..\lib\netty-3.7.0.Final.jar;D:\app\sso\zookeep er\bin\..\lib\slf4j-api-1.6.1.jar;D:\app\sso\zookeeper\bin\..\lib\slf4j-log4j12- 1.6.1.jar;D:\app\sso\zookeeper\bin\..\conf 2015-08-14 17:02:22,562 [myid:] - INFO [main:Environment@100] - Server environm ent:java.library.path=C:\windows\system32;C:\windows\Sun\Java\bin;C:\windows\sys tem32;C:\windows;C:\Program Files (x86)\MacType\;D:\Ruby193\bin;C:\windows\syste m32;C:\ProgramData\Oracle\Java\javapath;C:\windows\system32;C:\windows;C:\window s\System32\Wbem;C:\windows\System32\WindowsPowerShell\v1.0\;C:\Program Files (x8 6)\Intel\OpenCL SDK\2.0\bin\x86;C:\Program Files (x86)\Intel\OpenCL SDK\2.0\bin\ x64;D:\Program Files\TortoiseSVN\bin;C:\Program Files\Java\jdk1.7.0_79\bin;C:\Pr ogram Files\Java\jdk1.7.0_79\jre\bin;D:\Program Files\Mysql\bin;d:\Program Files (x86)\Git\cmd;D:\Program Files\TortoiseGit\bin;D:\app\maven\bin;D:\Program File s\nodejs\;D:\app\Sencha\Cmd\6.0.0.202;C:\Program Files (x86)\MacType;. 2015-08-14 17:02:22,570 [myid:] - INFO [main:Environment@100] - Server environm ent:java.io.tmpdir=C:\Users\hanfeng\AppData\Local\Temp\ 2015-08-14 17:02:22,571 [myid:] - INFO [main:Environment@100] - Server environm ent:java.compiler=<NA> 2015-08-14 17:02:22,575 [myid:] - INFO [main:Environment@100] - Server environm ent:os.name=Windows 7 2015-08-14 17:02:22,577 [myid:] - INFO [main:Environment@100] - Server environm ent:os.arch=amd64 2015-08-14 17:02:22,580 [myid:] - INFO [main:Environment@100] - Server environm ent:os.version=6.1 2015-08-14 17:02:22,582 [myid:] - INFO [main:Environment@100] - Server environm ent:user.name=hanfeng 2015-08-14 17:02:22,583 [myid:] - INFO [main:Environment@100] - Server environm ent:user.home=C:\Users\hanfeng 2015-08-14 17:02:22,585 [myid:] - INFO [main:Environment@100] - Server environm ent:user.dir=D:\app\sso\zookeeper\bin 2015-08-14 17:02:22,599 [myid:] - INFO [main:ZooKeeperServer@755] - tickTime se t to 2000 2015-08-14 17:02:22,601 [myid:] - INFO [main:ZooKeeperServer@764] - minSessionT imeout set to -1 2015-08-14 17:02:22,602 [myid:] - INFO [main:ZooKeeperServer@773] - maxSessionT imeout set to -1 2015-08-14 17:02:22,772 [myid:] - INFO [main:NIOServerCnxnFactory@94] - binding to port 0.0.0.0/0.0.0.0:2181