1.作用,保证分布式环境中数据的一致性
顺序一致性、原子性、单一视图、可靠性、实时性
2.主要就是做数据服务的一致性,实时性
tar -zxvf
scp zookeeper-3.4.5.tar.gz 192.168.85.140:/usr/local/software
tar -zxvf zookeeper-3.4.5.tar.gz -C /usr/local/
mv zookeeper-3.4.5 zookeeper
vim /etc/profile
JAVA_HOME=/usr/local/software/jdk1.7
JRE_HOME=/usr/local/software/jdk1.7/jre
ZOOKEEPER_HOME=/usr/local/zookeeper
PATH=$PATH:$JAVA_HOME/bin:$ZOOKEEPER_HOME/bin:$JRE_HOME/bin
CLASSPATH=.:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar:$JRE_HOME/lib
export JAVA_HOME JRE_HOME PATH CLASSPATH ZOOKEEPER_HOME
source /etc/profile
cd /usr/local/zookeeper/conf
mv zoo_sample.cfg zoo.cfg
vim zoo.cfg
dataDir=/usr/local/zookeeper/data
server.0=192.168.85.138:2888:3888
server.1=192.168.85.139:2888:3888
server.2=192.168.85.140:2888:3888
cd ..
mkdir data
cd /usr/local/zookeeper/data
vim myid
0 1 2
zkServer.sh start
zkServer.sh stop
zkServer.sh status
zkServer.sh start-foreground
netstat -anp |grep 2888
报错处理
1.vim /etc/hosts 加入
192.168.85.138 server0
192.168.85.139 server1
192.168.85.140 server2
2.删除data目录下出了myid之外的部相关文件
查询 netstat -ptnl |grep 2181
port 2189
3.address aready use
# 查看防火墙状态
service iptables status
# 停止防火墙
service iptables stop
# 启动防火墙
service iptables start
# 重启防火墙
service iptables restart
# 永久关闭防火墙
chkconfig iptables off
# 永久关闭后重启
chkconfig iptables
on