zookeeper安裝和部署

一、Zookeeper單體版安裝

    在安裝zookeeper之前要先安裝jdk環境,具體在linux環境安裝jdk1.8請參照linux筆記。

    1.在/usr/local/zoo 文件夾下執行命令 wget http://apache.fayea.com/zookeeper/zookeeper-3.5.5/apache-zookeeper-3.5.5-bin.tar.gz 下載zookeeper壓縮包,並執行tar -zxvf 進行解壓。

    2.初次使用zookeeper需要將conf文件夾下的zoo_sample.cfg修改爲zoo.cfg

zoo.cfg 文件內容

# 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=/tomcathxw/zookeeper/apache-zookeeper-3.5.5-bin/data

dataLogDir=/tomcathxw/zookeeper/apache-zookeeper-3.5.5-bin/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

  3.在zookeeper安裝目錄下建立一個文件夾data。

    4.修改zoo.cfg文件中的dataDir爲data的路徑,保存退出。

    5.啓動zookeeper,zkServer.sh.

    (遇到的問題,在bin目錄下執行zkServer.sh start提示我命令不存在???

    原因是zookeeper沒有配置環境變量,可以選擇配置環境變量或者使用命令./zkServer.sh start)

    (修改之後。。。。命令好使了,但是啓動失敗,連原因都沒有,查看zookeeper目錄下的logs發現報錯:Error: Could not find or load main class org.apache.zookeeper.server.quorum.QuorumPeerMain

)    這裏注意一個大坑:

    在zookeeper3.5.5版本中,官網下載有兩個文件:

 

要選擇第一個壓縮包下載,第二個壓縮包是源碼包,第一個壓縮包下載後按照正常步驟就可以運行起來,太坑了。

要選擇第一個壓縮包下載,第二個壓縮包是源碼包,第一個壓縮包下載後按照正常步驟就可以運行起來,太坑了。

 

 

 

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章