2013年12月4日 星期三

[研究] Zookeeper 3.4.5 動物園管理員 (分散式應用程式協調服務) 安裝 (CentOS 6.4 x64)

[研究] Zookeeper 3.4.5 動物園管理員 (分散式應用程式協調服務) 安裝 (CentOS 6.4 x64)

2013-12-04

ZooKeeper顧名思義是動物園管理員(Zoo Keeper),他是拿來管大象(Hadoop)、蜜蜂(Hive)、小豬(Pig)的管理員, Apache Hbase和 Apache Solr 以及LinkedIn sensei  等項目中都採用到了 Zookeeper。ZooKeeper是一個分散式的,開放源碼的分散式應用程式協調服務,以Fast Paxos演算法為基礎,實現同步服務,設定維護和命名服務等分散式應用。

官方網站
http://zookeeper.apache.org/

安裝參考
http://zookeeper.apache.org/doc/r3.4.5/zookeeperStarted.html

3.4.5 版於 18 November, 2012 釋出。

安裝

cd /usr/local
wget http://ftp.mirror.tw/pub/apache/zookeeper/zookeeper-3.4.5/zookeeper-3.4.5.tar.gz
tar  zxvf  zookeeper-3.4.5.tar.gz
cd  zookeeper-3.4.5/conf
cp  zoo_sample.cfg  zoo.cfg

啟動

[root@localhost bin]# /usr/local/zookeeper-3.4.5/zkServer.sh start
JMX enabled by default
Using config: /usr/local/zookeeper-3.4.5/bin/../conf/zoo.cfg
Starting zookeeper ... STARTED

確認

[root@localhost ~]# ps axu | grep zookeeper
root     27998  0.1  3.8 1418848 38640 pts/1   Sl   21:21   0:00 java -Dzookeeper.log.dir=. -Dzookeeper.root.logger=INFO,CONSOLE -cp /usr/local/zookeeper-3.4.5/bin/../build/classes:/usr/local/zookeeper-3.4.5/bin/../build/lib/*.jar:/usr/local/zookeeper-3.4.5/bin/../lib/slf4j-log4j12-1.6.1.jar:/usr/local/zookeeper-3.4.5/bin/../lib/slf4j-api-1.6.1.jar:/usr/local/zookeeper-3.4.5/bin/../lib/netty-3.2.2.Final.jar:/usr/local/zookeeper-3.4.5/bin/../lib/log4j-1.2.15.jar:/usr/local/zookeeper-3.4.5/bin/../lib/jline-0.9.94.jar:/usr/local/zookeeper-3.4.5/bin/../zookeeper-3.4.5.jar:/usr/local/zookeeper-3.4.5/bin/../src/java/lib/*.jar:/usr/local/zookeeper-3.4.5/bin/../conf: -Dcom.sun.management.jmxremote -Dcom.sun.management.jmxremote.local.only=false org.apache.zookeeper.server.quorum.QuorumPeerMain /usr/local/zookeeper-3.4.5/bin/../conf/zoo.cfg
root     28035  0.0  0.0 103244   844 pts/1    S+   21:28   0:00 grep zookeeper
[root@localhost ~]#

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=/tmp/zookeeper
# the port at which the clients will connect
clientPort=2181
#
# 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

但官方教學
http://zookeeper.apache.org/doc/r3.4.5/zookeeperStarted.html
設定
tickTime=2000
dataDir=/var/lib/zookeeper
clientPort=2181

兩者 datadir 設定不同目錄,確認一下,確實會自己建立 /tmp/zookeeper/ 目錄和產出。

[root@localhost ~]# ls -al /tmp/zookeeper/
total 16
drwxr-xr-x.  3 root root 4096 Dec  4 21:21 .
drwxrwxrwt. 11 root root 4096 Dec  4 21:21 ..
drwxr-xr-x.  2 root root 4096 Dec  4 21:21 version-2
-rw-r--r--.  1 root root    5 Dec  4 21:21 zookeeper_server.pid
[root@localhost ~]#

停止

zkServer.sh  stop

(完)

[研究] Apache Zookeeper 3.3.5 安裝 (CentOS 6.4 x64)
http://shaurong.blogspot.tw/2013/07/apache-zookeeper-345.html



2 則留言: