zookeeper單擊環境安裝
1.安裝jdk1.7,配置環境變數
tar -zxvf ./jdk-7u71-linux-x64.tar.gz
配置環境變數
進入/etc/profile, 貼上以下指令碼到檔案,儲存檔案。
export PATH=/usr/jdk1.7.0_71/bin:$PATH
export classpath=/usr/jdk1.7.0_71/lib
export JAVA_HOME=/usr/jdk1.7.0_7
2.下載zookeeper-3.4.6.tar.gz
http://apache.fayea.com/zookeeper/zookeeper-3.4.6/
3.解壓zookeeper-3.4.6.tar.gz
tar -zvxf zookeeper-3.4.6.tar.gz
4.修改zookeeper-3.4.6/conf目錄,修改zookeeper_sample.cfg為 zoo.cfg
cp zoo_sample.cfg zoo.cfg
5.配置zoo.cfg dataDir目錄和log目錄
# 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=/home/user/software/zookeeper-3.4.6/data
dataLogDir=/home/user/software/zookeeper-3.4.6/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.
#
# 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
引數說明:
tickTime:ZK中的一個時間單元。ZK所有時間都是以這個時間單元為基礎,進行整數倍配置。例如session的最小超時時間是2*ticktime。
dataDir:zookeeper的工作目錄,註釋寫得很清楚,只有測試環境才使用tmp目錄,否則都建議進行專門的設定。
dataLogDir:zookerper日誌輸出的目錄
clientPort:客戶端的連線埠
maxClientCnxns:客戶端最大連線數
clientport:客戶端連線server的埠,即對外服務埠,一般設定為2181
6.啟動zookeeper,進入bin目錄
./zkServer.sh start
7.檢查zookeeper是否啟動成功,採用jps命令即可
出現如下內容說明啟動成功
3129 Jps
2973 QuorumPeerMain
QuorumPeerMain這個程序就是zookeeper的程序。至此,zookeeper的單節點安裝就成功了。
8.檢視後臺的zookeeper節點資訊,進入bin目錄執行如下命令
./zkCli.sh