zookeeper須要java,見http://www.javashuo.com/article/p-fuaghjly-gt.html html
cd /app wget http://mirror-hk.koddos.net/apache/zookeeper/zookeeper-3.5.5/apache-zookeeper-3.5.5-bin.tar.gz tar zxvf apache-zookeeper-3.5.5-bin.tar.gz mv apache-zookeeper-3.5.5-bin zookeeper cp conf/zoo.sample.cfg conf/zoo.cfg vim conf/zoo.cfg mkdir data vim data/myid echo 1 > data/myid # 這個確保和下面的server.x後面的數字對應 vim /etc/hosts # /etc/hosts # 自定義Hosts 10.13.6.1 kafka-node1 10.13.6.2 kafka-node2 10.13.6.3 kafka-node3
zoo.cfgjava
# 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=/app/zookeeper/data # 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 # 節點配置信息 server.1=kafka-node1:2888:3888 server.2=kafka-node2:2888:3888 server.3=kafka-node3:2888:3888 #server.A=B:C:D # 其中 A 是一個數字,表示這個是第幾號服務器; # B 是這個服務器的 ip 地址; # C 表示的是這個服務器與集羣中的 Leader 服務器交換信息的端口; # D 表示的是若是集羣中的 Leader 服務器故障,須要一個端口來從新進行選舉,選出一個新的 Leader,而這個端口就是#用來執行選舉時服務器相互通訊的端口。 # # 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
其餘2個節點同理,注意myid設置不同node