Linux 安裝Zookeeper集羣

1.解壓,配置環境變量網絡

export ZOOKEEPER_HOME=/usr/local/zk
export PATH=.:$HADOOP_HOME/bin:$ZOOKEEPER_HOME/bin:$JAVA_HOME/bin:$PATHspa

啓動ZooKeeper的Server:zkServer.sh start;關閉ZooKeeper的Server:zkServer.sh stopcode

2.配置zoo.cfgserver

# 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.
dataDir=/usr/local/zk/data

# the port at which the clients will connect
clientPort=2181

#the location of the log file
dataLogDir=/usr/local/zk/logs

server.0=192.168.12.12:2287:3387
server.1=192.168.12.13:2287:3387
server.2=192.168.12.14:2287:3387

在/usr/local/zk/data新建myid 和當前的server.X對應。blog

3.啓動,查看狀態get

zkServer.sh start zoo1.sh 
zkServer.sh status
若是啓動沒問題,狀態出現其餘兩臺機子網絡異常,請檢查防火牆。
#關閉firewall:
systemctl stop firewalld.service #中止firewall
systemctl disable firewalld.service #禁止firewall開機啓動
firewall-cmd --state #查看默認防火牆狀態(關閉後顯示notrunning,開啓後顯示running)
相關文章
相關標籤/搜索