1、安装包地址
http://www.apache.org/dyn/closer.cgi/zookeeper/
点击后找到地址http://mirror.bit.edu.cn/apache/zookeeper/zookeeper-3.5.1-alpha/
所以地址安装包地址为
http://mirror.bit.edu.cn/apache/zookeeper/zookeeper-3.5.1-alpha/zookeeper-3.5.1-alpha.tar.gz
右键 复制连接地址得到的。
2、下载安装
#wget http://mirror.bit.edu.cn/apache/zookeeper/zookeeper-3.5.1-alpha/zookeeper-3.5.1-alpha.tar.gz
2.2 安装
# tar -zxvf zookeeper-3.5.1-alpha.tar.gz
2.3 把放到usr/local/ 目录去
# mv zookeeper-3.5.1-alpha /usr/local
2.4修改配置(/usr/local/zookeeper-3.5.1-alpha/conf/目录下)
先备份文件
# cp zoo_sample.cfg zoo.cfg
修改配置
dataDir=/usr/local/zookeeper-3.5.1
3、启动 zookeeper(在/usr/local/zookeeper-3.5.1/bin/下)
[root@iZ25av9xi4hZ bin]# ./zkServer.sh startZooKeeper JMX enabled by default/usr/bin/javaUsing config: /usr/local/zookeeper-3.5.1/bin/../conf/zoo.cfgStarting zookeeper ... STARTED[root@iZ25av9xi4hZ bin]#
启动成功了
3.1查看下状态
[root@iZ25av9xi4hZ bin]# ./zkServer.sh statusZooKeeper JMX enabled by default/usr/bin/javaUsing config: /usr/local/zookeeper-3.5.1/bin/../conf/zoo.cfgClient port found: 2181. Client address: localhost.Mode: standalone[root@iZ25av9xi4hZ bin]#
在日志看下(/usr/local/zookeeper-3.5.1-alpha/logs/目录下)
#tail -f zookeeper-root-server-iZ25av9xi4hZ.out
tail: zookeeper-root-server-iZ25av9xi4hZ.out: file truncated2016-06-27 11:13:43,270 [myid:] - INFO [main:QuorumPeerConfig@114] - Reading configuration from: /usr/local/zookeeper-3.5.1/bin/../conf/zoo.cfg2016-06-27 11:13:43,276 [myid:] - INFO [main:QuorumPeerConfig@316] - clientPortAddress is 0.0.0.0/0.0.0.0:21812016-06-27 11:13:43,276 [myid:] - INFO [main:QuorumPeerConfig@320] - secureClientPort is not set2016-06-27 11:13:43,279 [myid:] - INFO [main:DatadirCleanupManager@78] - autopurge.snapRetainCount set to 32016-06-27 11:13:43,280 [myid:] - INFO [main:DatadirCleanupManager@79] - autopurge.purgeInterval set to 02016-06-27 11:13:43,280 [myid:] - INFO [main:DatadirCleanupManager@101] - Purge task is not scheduled.2016-06-27 11:13:43,280 [myid:] - WARN [main:QuorumPeerMain@122] - Either no config or no quorum defined in config, running in standalone mode2016-06-27 11:13:43,296 [myid:] - INFO [main:QuorumPeerConfig@114] - Reading configuration from: /usr/local/zookeeper-3.5.1/bin/../conf/zoo.cfg2016-06-27 11:13:43,297 [myid:] - INFO [main:QuorumPeerConfig@316] - clientPortAddress is 0.0.0.0/0.0.0.0:21812016-06-27 11:13:43,297 [myid:] - INFO [main:QuorumPeerConfig@320] - secureClientPort is not set2016-06-27 11:13:43,297 [myid:] - INFO [main:ZooKeeperServerMain@113] - Starting server2016-06-27 11:13:43,331 [myid:] - INFO [main:Environment@109] - Server environment:zookeeper.version=3.5.1-alpha-1693007, built on 07/28/2015 07:19 GMT2016-06-27 11:13:43,331 [myid:] - INFO [main:Environment@109] - Server environment:host.name=iZ25av9xi4hZ2016-06-27 11:13:43,332 [myid:] - INFO [main:Environment@109] - Server environment:java.version=1.8.0_912016-06-27 11:13:43,332 [myid:] - INFO [main:Environment@109] - Server environment:java.vendor=Oracle Corporation2016-06-27 11:13:43,332 [myid:] - INFO [main:Environment@109] - Server environment:java.home=/usr/java/jdk1.8.0_91/jre2016-06-27 11:13:43,337 [myid:] - INFO [main:Environment@109] - Server environment:java.class.path=/usr/local/zookeeper-3.5.1/bin/../build/classes:/usr/local/zookeeper-3.5.1/bin/../build/lib/*.jar:/usr/local/zookeeper-3.5.1/bin/../lib/slf4j-log4j12-1.7.5.jar:/usr/local/zookeeper-3.5.1/bin/../lib/slf4j-api-1.7.5.jar:/usr/local/zookeeper-3.5.1/bin/../lib/servlet-api-2.5-20081211.jar:/usr/local/zookeeper-3.5.1/bin/../lib/netty-3.7.0.Final.jar:/usr/local/zookeeper-3.5.1/bin/../lib/log4j-1.2.16.jar:/usr/local/zookeeper-3.5.1/bin/../lib/jline-2.11.jar:/usr/local/zookeeper-3.5.1/bin/../lib/jetty-util-6.1.26.jar:/usr/local/zookeeper-3.5.1/bin/../lib/jetty-6.1.26.jar:/usr/local/zookeeper-3.5.1/bin/../lib/javacc.jar:/usr/local/zookeeper-3.5.1/bin/../lib/jackson-mapper-asl-1.9.11.jar:/usr/local/zookeeper-3.5.1/bin/../lib/jackson-core-asl-1.9.11.jar:/usr/local/zookeeper-3.5.1/bin/../lib/commons-cli-1.2.jar:/usr/local/zookeeper-3.5.1/bin/../zookeeper-3.5.1-alpha.jar:/usr/local/zookeeper-3.5.1/bin/../src/java/lib/*.jar:/usr/local/zookeeper-3.5.1/bin/../conf:2016-06-27 11:13:43,337 [myid:] - INFO [main:Environment@109] - Server environment:java.library.path=/usr/java/packages/lib/amd64:/usr/lib64:/lib64:/lib:/usr/lib2016-06-27 11:13:43,337 [myid:] - INFO [main:Environment@109] - Server environment:java.io.tmpdir=/tmp2016-06-27 11:13:43,338 [myid:] - INFO [main:Environment@109] - Server environment:java.compiler=2016-06-27 11:13:43,338 [myid:] - INFO [main:Environment@109] - Server environment:os.name=Linux2016-06-27 11:13:43,338 [myid:] - INFO [main:Environment@109] - Server environment:os.arch=amd642016-06-27 11:13:43,338 [myid:] - INFO [main:Environment@109] - Server environment:os.version=2.6.32-431.23.3.el6.x86_642016-06-27 11:13:43,339 [myid:] - INFO [main:Environment@109] - Server environment:user.name=root2016-06-27 11:13:43,339 [myid:] - INFO [main:Environment@109] - Server environment:user.home=/root2016-06-27 11:13:43,340 [myid:] - INFO [main:Environment@109] - Server environment:user.dir=/usr/local/zookeeper-3.5.1/bin2016-06-27 11:13:43,340 [myid:] - INFO [main:Environment@109] - Server environment:os.memory.free=12MB2016-06-27 11:13:43,340 [myid:] - INFO [main:Environment@109] - Server environment:os.memory.max=966MB2016-06-27 11:13:43,341 [myid:] - INFO [main:Environment@109] - Server environment:os.memory.total=15MB2016-06-27 11:13:43,345 [myid:] - INFO [main:ZooKeeperServer@858] - minSessionTimeout set to 40002016-06-27 11:13:43,345 [myid:] - INFO [main:ZooKeeperServer@867] - maxSessionTimeout set to 400002016-06-27 11:13:43,345 [myid:] - INFO [main:ZooKeeperServer@156] - Created server with tickTime 2000 minSessionTimeout 4000 maxSessionTimeout 40000 datadir /usr/local/zookeeper-3.5.1/version-2 snapdir /usr/local/zookeeper-3.5.1/version-22016-06-27 11:13:43,375 [myid:] - INFO [main:Slf4jLog@67] - Logging to org.slf4j.impl.Log4jLoggerAdapter(org.mortbay.log) via org.mortbay.log.Slf4jLog2016-06-27 11:13:43,405 [myid:] - INFO [main:Slf4jLog@67] - jetty-6.1.262016-06-27 11:13:43,487 [myid:] - INFO [main:Slf4jLog@67] - Started SelectChannelConnector@0.0.0.0:80802016-06-27 11:13:43,494 [myid:] - INFO [main:JettyAdminServer@105] - Started AdminServer on address 0.0.0.0, port 8080 and command URL /commands2016-06-27 11:13:43,511 [myid:] - INFO [main:NIOServerCnxnFactory@673] - Configuring NIO connection handler with 10s sessionless connection timeout, 1 selector thread(s), 2 worker threads, and 64 kB direct buffers.2016-06-27 11:13:43,520 [myid:] - INFO [main:NIOServerCnxnFactory@686] - binding to port 0.0.0.0/0.0.0.0:21812016-06-27 11:13:43,548 [myid:] - INFO [main:FileSnap@83] - Reading snapshot /usr/local/zookeeper-3.5.1/version-2/snapshot.02016-06-27 11:13:43,555 [myid:] - INFO [main:FileTxnSnapLog@298] - Snapshotting: 0x0 to /usr/local/zookeeper-3.5.1/version-2/snapshot.02016-06-27 11:13:43,578 [myid:] - INFO [main:ContainerManager@64] - Using checkIntervalMs=60000 maxPerMinute=100002016-06-27 11:15:02,676 [myid:] - INFO [NIOServerCxnFactory.AcceptThread:0.0.0.0/0.0.0.0:2181:NIOServerCnxnFactory$AcceptThread@296] - Accepted socket connection from /127.0.0.1:586762016-06-27 11:15:02,794 [myid:] - INFO [NIOWorkerThread-1:NIOServerCnxn@485] - Processing srvr command from /127.0.0.1:586762016-06-27 11:15:02,798 [myid:] - INFO [NIOWorkerThread-1:NIOServerCnxn@606] - Closed socket connection for client /127.0.0.1:58676 (no session established for client)
端口看下
[root@iZ25av9xi4hZ bin]# telnet 127.0.0.1 2181Trying 127.0.0.1...Connected to 127.0.0.1.Escape character is '^]'.