码迷,mamicode.com
首页 > Windows程序 > 详细

win10下安装并启动zookeeper

时间:2018-09-11 14:14:21      阅读:227      评论:0      收藏:0      [点我收藏+]

标签:本地   ssh   3.3   cve   文件   git   配置文件   tcl   purge   

  下载直接到zk的官网(zookeeper.apache.org)即可,点击右边的Releases,在Download下再点Download进入镜像下载页面,在给出的链接列表里选择一个镜像地址,进去后选择版本(这里最新的是3.4.10)下载压缩包。

  解压到本地(这里是D盘)后,需要修改下配置文件名,进入conf目录,将zoo_sample.cfg改为zoo.cfg。如果仅将zk作为单点来用,那么进入bin目录双击zkServer.cmd启动服务端,出现命令行窗口:

D:\Dev\zookeeper-3.4.10\bin>call "D:\Dev\Java\jdk1.8.0_102"\bin\java "-Dzookeeper.log.dir=D:\Dev\zookeeper-3.4.10\bin\.." "-Dzookeeper.root.logger=INFO,CONSOLE" -cp "D:\Dev\zookeeper-3.4.10\bin\..\build\classes;D:\Dev\zookeeper-3.4.10\bin\..\build\lib\*;D:\Dev\zookeeper-3.4.10\bin\..\*;D:\Dev\zookeeper-3.4.10\bin\..\lib\*;D:\Dev\zookeeper-3.4.10\bin\..\conf" org.apache.zookeeper.server.quorum.QuorumPeerMain "D:\Dev\zookeeper-3.4.10\bin\..\conf\zoo.cfg"
2018-09-11 11:19:28,567 [myid:] - INFO  [main:QuorumPeerConfig@134] - Reading configuration from: D:\Dev\zookeeper-3.4.10\bin\..\conf\zoo.cfg
2018-09-11 11:19:28,600 [myid:] - INFO  [main:DatadirCleanupManager@78] - autopurge.snapRetainCount set to 3
2018-09-11 11:19:28,600 [myid:] - INFO  [main:DatadirCleanupManager@79] - autopurge.purgeInterval set to 0
2018-09-11 11:19:28,600 [myid:] - INFO  [main:DatadirCleanupManager@101] - Purge task is not scheduled.
2018-09-11 11:19:28,602 [myid:] - WARN  [main:QuorumPeerMain@113] - Either no config or no quorum defined in config, running  in standalone mode
2018-09-11 11:19:28,767 [myid:] - INFO  [main:QuorumPeerConfig@134] - Reading configuration from: D:\Dev\zookeeper-3.4.10\bin\..\conf\zoo.cfg
2018-09-11 11:19:28,768 [myid:] - INFO  [main:ZooKeeperServerMain@96] - Starting server
2018-09-11 11:19:28,800 [myid:] - INFO  [main:Environment@100] - Server environment:zookeeper.version=3.4.10-39d3a4f269333c922ed3db283be479f9deacaa0f, built on 03/23/2017 10:13 GMT
2018-09-11 11:19:28,800 [myid:] - INFO  [main:Environment@100] - Server environment:host.name=windows10.microdone.cn
2018-09-11 11:19:28,801 [myid:] - INFO  [main:Environment@100] - Server environment:java.version=1.8.0_102
2018-09-11 11:19:28,801 [myid:] - INFO  [main:Environment@100] - Server environment:java.vendor=Oracle Corporation
2018-09-11 11:19:28,801 [myid:] - INFO  [main:Environment@100] - Server environment:java.home=D:\Dev\Java\jdk1.8.0_102\jre
2018-09-11 11:19:28,802 [myid:] - INFO  [main:Environment@100] - Server environment:java.class.path=D:\Dev\zookeeper-3.4.10\bin\..\build\classes;D:\Dev\zookeeper-3.4.10\bin\..\build\lib\*;D:\Dev\zookeeper-3.4.10\bin\..\zookeeper-3.4.10.jar;D:\Dev\zookeeper-3.4.10\bin\..\lib\jline-0.9.94.jar;D:\Dev\zookeeper-3.4.10\bin\..\lib\log4j-1.2.16.jar;D:\Dev\zookeeper-3.4.10\bin\..\lib\netty-3.10.5.Final.jar;D:\Dev\zookeeper-3.4.10\bin\..\lib\slf4j-api-1.6.1.jar;D:\Dev\zookeeper-3.4.10\bin\..\lib\slf4j-log4j12-1.6.1.jar;D:\Dev\zookeeper-3.4.10\bin\..\conf
2018-09-11 11:19:28,802 [myid:] - INFO  [main:Environment@100] - Server environment:java.library.path=D:\Dev\Java\jdk1.8.0_102\bin;C:\WINDOWS\Sun\Java\bin;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\WINDOWS\System32\WindowsPowerShell\v1.0\;C:\Windows\CCM;D:\Utility\TortoiseSVN\bin;D:\Utility\PuTTY\;D:\Dev\Java\jdk1.8.0_102\bin;D:\Dev\apache-maven-3.3.9\bin;D:\Dev\apache-tomcat-9.0.0.M26\bin;D:\Dev\oracle\product\11.2.0\dbhome_1\bin;C:\ProgramData\Oracle\Java\javapath;D:\Dev\oracle\instantclient_12_2;D:\Dev\nodejs\;C:\Program Files\MySQL\MySQL Utilities 1.6\;D:\Dev\Git\cmd;C:\WINDOWS\System32\OpenSSH\;C:\Program Files (x86)\Windows Kits\8.1\Windows Performance Toolkit\;C:\Program Files\Microsoft SQL Server\110\Tools\Binn\;C:\Users\wulf\AppData\Local\Microsoft\WindowsApps;C:\Users\wulf\AppData\Roaming\npm;;D:\Utility\Fiddler;%USERPROFILE%\AppData\Local\Microsoft\WindowsApps;.
2018-09-11 11:19:28,802 [myid:] - INFO  [main:Environment@100] - Server environment:java.io.tmpdir=C:\Users\wulf\AppData\Local\Temp2018-09-11 11:19:28,802 [myid:] - INFO  [main:Environment@100] - Server environment:java.compiler=<NA>
2018-09-11 11:19:28,803 [myid:] - INFO  [main:Environment@100] - Server environment:os.name=Windows 10
2018-09-11 11:19:28,803 [myid:] - INFO  [main:Environment@100] - Server environment:os.arch=amd64
2018-09-11 11:19:28,804 [myid:] - INFO  [main:Environment@100] - Server environment:os.version=10.0
2018-09-11 11:19:28,805 [myid:] - INFO  [main:Environment@100] - Server environment:user.name=wulf
2018-09-11 11:19:28,805 [myid:] - INFO  [main:Environment@100] - Server environment:user.home=C:\Users\wulf
2018-09-11 11:19:28,806 [myid:] - INFO  [main:Environment@100] - Server environment:user.dir=D:\Dev\zookeeper-3.4.10\bin
2018-09-11 11:19:28,816 [myid:] - INFO  [main:ZooKeeperServer@829] - tickTime set to 2000
2018-09-11 11:19:28,816 [myid:] - INFO  [main:ZooKeeperServer@838] - minSessionTimeout set to -1
2018-09-11 11:19:28,817 [myid:] - INFO  [main:ZooKeeperServer@847] - maxSessionTimeout set to -1
2018-09-11 11:19:29,070 [myid:] - INFO  [main:NIOServerCnxnFactory@89] - binding to port 0.0.0.0/0.0.0.0:2181

  再双击zkCli.cmd启动客户端:

Connecting to localhost:2181
2018-09-11 11:19:47,802 [myid:] - INFO  [main:Environment@100] - Client environment:zookeeper.version=3.4.10-39d3a4f269333c922ed3db283be479f9deacaa0f, built on 03/23/2017 10:13 GMT
2018-09-11 11:19:47,805 [myid:] - INFO  [main:Environment@100] - Client environment:host.name=windows10.microdone.cn
2018-09-11 11:19:47,805 [myid:] - INFO  [main:Environment@100] - Client environment:java.version=1.8.0_102
2018-09-11 11:19:47,808 [myid:] - INFO  [main:Environment@100] - Client environment:java.vendor=Oracle Corporation
2018-09-11 11:19:47,809 [myid:] - INFO  [main:Environment@100] - Client environment:java.home=D:\Dev\Java\jdk1.8.0_102\jre
2018-09-11 11:19:47,809 [myid:] - INFO  [main:Environment@100] - Client environment:java.class.path=D:\Dev\zookeeper-3.4.10\bin\..\build\classes;D:\Dev\zookeeper-3.4.10\bin\..\build\lib\*;D:\Dev\zookeeper-3.4.10\bin\..\zookeeper-3.4.10.jar;D:\Dev\zookeeper-3.4.10\bin\..\lib\jline-0.9.94.jar;D:\Dev\zookeeper-3.4.10\bin\..\lib\log4j-1.2.16.jar;D:\Dev\zookeeper-3.4.10\bin\..\lib\netty-3.10.5.Final.jar;D:\Dev\zookeeper-3.4.10\bin\..\lib\slf4j-api-1.6.1.jar;D:\Dev\zookeeper-3.4.10\bin\..\lib\slf4j-log4j12-1.6.1.jar;D:\Dev\zookeeper-3.4.10\bin\..\conf
2018-09-11 11:19:47,809 [myid:] - INFO  [main:Environment@100] - Client environment:java.library.path=D:\Dev\Java\jdk1.8.0_102\bin;C:\WINDOWS\Sun\Java\bin;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\WINDOWS\System32\WindowsPowerShell\v1.0\;C:\Windows\CCM;D:\Utility\TortoiseSVN\bin;D:\Utility\PuTTY\;D:\Dev\Java\jdk1.8.0_102\bin;D:\Dev\apache-maven-3.3.9\bin;D:\Dev\apache-tomcat-9.0.0.M26\bin;D:\Dev\oracle\product\11.2.0\dbhome_1\bin;C:\ProgramData\Oracle\Java\javapath;D:\Dev\oracle\instantclient_12_2;D:\Dev\nodejs\;C:\Program Files\MySQL\MySQL Utilities 1.6\;D:\Dev\Git\cmd;C:\WINDOWS\System32\OpenSSH\;C:\Program Files (x86)\Windows Kits\8.1\Windows Performance Toolkit\;C:\Program Files\Microsoft SQL Server\110\Tools\Binn\;C:\Users\wulf\AppData\Local\Microsoft\WindowsApps;C:\Users\wulf\AppData\Roaming\npm;;D:\Utility\Fiddler;%USERPROFILE%\AppData\Local\Microsoft\WindowsApps;.
2018-09-11 11:19:47,809 [myid:] - INFO  [main:Environment@100] - Client environment:java.io.tmpdir=C:\Users\wulf\AppData\Local\Temp2018-09-11 11:19:47,809 [myid:] - INFO  [main:Environment@100] - Client environment:java.compiler=<NA>
2018-09-11 11:19:47,809 [myid:] - INFO  [main:Environment@100] - Client environment:os.name=Windows 10
2018-09-11 11:19:47,809 [myid:] - INFO  [main:Environment@100] - Client environment:os.arch=amd64
2018-09-11 11:19:47,809 [myid:] - INFO  [main:Environment@100] - Client environment:os.version=10.0
2018-09-11 11:19:47,809 [myid:] - INFO  [main:Environment@100] - Client environment:user.name=wulf
2018-09-11 11:19:47,810 [myid:] - INFO  [main:Environment@100] - Client environment:user.home=C:\Users\wulf
2018-09-11 11:19:47,810 [myid:] - INFO  [main:Environment@100] - Client environment:user.dir=D:\Dev\zookeeper-3.4.10\bin
2018-09-11 11:19:47,811 [myid:] - INFO  [main:ZooKeeper@438] - Initiating client connection, connectString=localhost:2181 sessionTimeout=30000 watcher=org.apache.zookeeper.ZooKeeperMain$MyWatcher@799f7e29
Welcome to ZooKeeper!
2018-09-11 11:19:48,062 [myid:] - INFO  [main-SendThread(0:0:0:0:0:0:0:1:2181):ClientCnxn$SendThread@1032] - Opening socket connection to server 0:0:0:0:0:0:0:1/0:0:0:0:0:0:0:1:2181. Will not attempt to authenticate using SASL (unknown error)
2018-09-11 11:19:48,065 [myid:] - INFO  [main-SendThread(0:0:0:0:0:0:0:1:2181):ClientCnxn$SendThread@876] - Socket connection established to 0:0:0:0:0:0:0:1/0:0:0:0:0:0:0:1:2181, initiating session
JLine support is enabled
[zk: localhost:2181(CONNECTING) 0] 2018-09-11 11:19:48,090 [myid:] - INFO  [main-SendThread(0:0:0:0:0:0:0:1:2181):ClientCnxn$SendThread@1299] - Session establishment complete on server 0:0:0:0:0:0:0:1/0:0:0:0:0:0:0:1:2181, sessionid = 0x165c6a41e3a0000, negotiated timeout = 30000

WATCHER::

WatchedEvent state:SyncConnected type:None path:null

  这时就可以开始在客户端敲命令了:

[zk: localhost:2181(CONNECTED) 2] ls /
[zookeeper]
[zk: localhost:2181(CONNECTED) 3] create /zk hello,world!
Created /zk
[zk: localhost:2181(CONNECTED) 4] ls /
[zk, zookeeper]
[zk: localhost:2181(CONNECTED) 5] get /zk
hello,world!
cZxid = 0x2
ctime = Tue Sep 11 11:22:48 CST 2018
mZxid = 0x2
mtime = Tue Sep 11 11:22:48 CST 2018
pZxid = 0x2
cversion = 0
dataVersion = 0
aclVersion = 0
ephemeralOwner = 0x0
dataLength = 12
numChildren = 0

  服务端也会打印客户端过来的请求:

2018-09-11 11:19:48,064 [myid:] - INFO  [NIOServerCxn.Factory:0.0.0.0/0.0.0.0:2181:NIOServerCnxnFactory@192] - Accepted socket connection from /0:0:0:0:0:0:0:1:57459
2018-09-11 11:19:48,073 [myid:] - INFO  [NIOServerCxn.Factory:0.0.0.0/0.0.0.0:2181:ZooKeeperServer@942] - Client attempting to establish new session at /0:0:0:0:0:0:0:1:57459
2018-09-11 11:19:48,076 [myid:] - INFO  [SyncThread:0:FileTxnLog@203] - Creating new log file: log.1
2018-09-11 11:19:48,088 [myid:] - INFO  [SyncThread:0:ZooKeeperServer@687] - Established session 0x165c6a41e3a0000 with negotiated timeout 30000 for client /0:0:0:0:0:0:0:1:57459

  

win10下安装并启动zookeeper

标签:本地   ssh   3.3   cve   文件   git   配置文件   tcl   purge   

原文地址:https://www.cnblogs.com/wuxun1997/p/9626683.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!