安装
下载zk后,确保有java环境的情况下解压就可以使用了
代码语言:javascript复制[root@h102 src]# tar -zxvf zookeeper-3.4.8.tar.gz
zookeeper-3.4.8/
zookeeper-3.4.8/zookeeper-3.4.8.jar.md5
zookeeper-3.4.8/zookeeper-3.4.8.jar.asc
zookeeper-3.4.8/zookeeper-3.4.8.jar
zookeeper-3.4.8/contrib/
...
...
zookeeper-3.4.8/conf/
zookeeper-3.4.8/conf/configuration.xsl
zookeeper-3.4.8/conf/zoo_sample.cfg
zookeeper-3.4.8/conf/log4j.properties
zookeeper-3.4.8/zookeeper-3.4.8.jar.sha1
zookeeper-3.4.8/NOTICE.txt
zookeeper-3.4.8/build.xml
[root@h102 src]#
配置
将 zoo_sample.cfg 修改为 zoo.cfg
代码语言:javascript复制[root@h102 src]# cd zookeeper-3.4.8/conf
[root@h102 conf]# grep -v "^#" zoo_sample.cfg
tickTime=2000
initLimit=10
syncLimit=5
dataDir=/tmp/zookeeper
clientPort=2181
[root@h102 conf]# cp zoo_sample.cfg zoo.cfg
[root@h102 conf]#
运行
代码语言:javascript复制[root@h102 zookeeper-3.4.8]# bin/zkServer.sh start
ZooKeeper JMX enabled by default
Using config: /usr/local/src/zookeeper-3.4.8/bin/../conf/zoo.cfg
Starting zookeeper ... STARTED
[root@h102 zookeeper-3.4.8]# ps faux | grep zook
root 34642 0.0 0.0 103256 824 pts/0 S 20:03 0:00 _ grep zook
root 34622 35.0 2.1 2094296 40376 pts/0 Sl 20:03 0:02 java -Dzookeeper.log.dir=. -Dzookeeper.root.logger=INFO,CONSOLE -cp /usr/local/src/zookeeper-3.4.8/bin/../build/classes:/usr/local/src/zookeeper-3.4.8/bin/../build/lib/*.jar:/usr/local/src/zookeeper-3.4.8/bin/../lib/slf4j-log4j12-1.6.1.jar:/usr/local/src/zookeeper-3.4.8/bin/../lib/slf4j-api-1.6.1.jar:/usr/local/src/zookeeper-3.4.8/bin/../lib/netty-3.7.0.Final.jar:/usr/local/src/zookeeper-3.4.8/bin/../lib/log4j-1.2.16.jar:/usr/local/src/zookeeper-3.4.8/bin/../lib/jline-0.9.94.jar:/usr/local/src/zookeeper-3.4.8/bin/../zookeeper-3.4.8.jar:/usr/local/src/zookeeper-3.4.8/bin/../src/java/lib/*.jar:/usr/local/src/zookeeper-3.4.8/bin/../conf: -Dcom.sun.management.jmxremote -Dcom.sun.management.jmxremote.local.only=false org.apache.zookeeper.server.quorum.QuorumPeerMain /usr/local/src/zookeeper-3.4.8/bin/../conf/zoo.cfg
[root@h102 zookeeper-3.4.8]# netstat -ant | grep 2181
tcp 0 0 :::2181 :::* LISTEN
[root@h102 zookeeper-3.4.8]#
下载
Mycat-web 的 下载地址
代码语言:javascript复制[root@h102 src]# wget https://github.com/MyCATApache/Mycat-download/raw/master/mycat-web-1.0/Mycat-web-1.0-SNAPSHOT-20160218145029-linux.tar.gz
--2016-02-29 20:09:04-- https://github.com/MyCATApache/Mycat-download/raw/master/mycat-web-1.0/Mycat-web-1.0-SNAPSHOT-20160218145029-linux.tar.gz
Resolving github.com... 192.30.252.130
Connecting to github.com|192.30.252.130|:443... connected.
HTTP request sent, awaiting response... 302 Found
Location: https://raw.githubusercontent.com/MyCATApache/Mycat-download/master/mycat-web-1.0/Mycat-web-1.0-SNAPSHOT-20160218145029-linux.tar.gz [following]
--2016-02-29 20:09:05-- https://raw.githubusercontent.com/MyCATApache/Mycat-download/master/mycat-web-1.0/Mycat-web-1.0-SNAPSHOT-20160218145029-linux.tar.gz
Resolving raw.githubusercontent.com... 103.245.222.133
Connecting to raw.githubusercontent.com|103.245.222.133|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 54378894 (52M) [application/octet-stream]
Saving to: “Mycat-web-1.0-SNAPSHOT-20160218145029-linux.tar.gz”
100%[============================================================================>] 54,378,894 191K/s in 3m 14s
2016-02-29 20:13:19 (274 KB/s) - “Mycat-web-1.0-SNAPSHOT-20160218145029-linux.tar.gz” saved [54378894/54378894]
[root@h102 src]# file Mycat-web-1.0-SNAPSHOT-20160218145029-linux.tar.gz
Mycat-web-1.0-SNAPSHOT-20160218145029-linux.tar.gz: gzip compressed data, from FAT filesystem (MS-DOS, OS/2, NT)
[root@h102 src]# ll Mycat-web-1.0-SNAPSHOT-20160218145029-linux.tar.gz
-rw-r--r-- 1 root root 54378894 Feb 29 20:13 Mycat-web-1.0-SNAPSHOT-20160218145029-linux.tar.gz
[root@h102 src]#