1.在系统的/etc/hosts中添加
# zookeeper servers 192.168.1.105 edu-provider-012.到apache官网下载zookeeper,例如:
$ wget http://apache.fayea.com/zookeeper/zookeeper-3.4.6/zookeeper-3.4.6.tar.gz
$ tar -zxvf zookeeper-3.4.6.tar.gz4.在/home/CentOS6.7/zookeeper/zookeeper-3.4.6目录下创建一下目录
$ cd /home/CentOS6.7/zookeeper/zookeeper-3.4.6 $ mkdir data $ mkdir logs
$ cp zoo_sample.cfg zoo.cfg
$ vi zoo.cfg dataDir=/home/CentOS6.7/zookeeper/zookeeper-3.4.6/data dataLogDir=/home/CentOS6.7/zookeeper/zookeeper-3.4.6/logs clientPort=2181 server.1=edu-provider-01:2888:3888
$ vi myid 1
$ vi /home/CentOS6.7/.bash_profile #zookeeper evn export ZOOKEEPER_HOME=/home/CentOS6.7/zookeeper-3.4.6 export PATH=$ZOOKEEPER_HOME/bin:$PATH
$ source /home/CentOS6.7/.bash_profile
# chkconfig iptables on # service iptables start # vi /etc/sysconfig/iptables
-A INPUT -m state --state NEW -m tcp -p tcp --dport 2181 -j ACCEPT -A INPUT -m state --state NEW -m tcp -p tcp --dport 2888 -j ACCEPT -A INPUT -m state --state NEW -m tcp -p tcp --dport 3888 -j ACCEPT
# service iptables restart
# service iptables status
$ zkServer.sh start输入jps命令查看进程
24897 QuorumPeerMain 24914 Jps
$ zkServer.sh stop
2.设置jdk环境
这里采用全局设置方法,就是修改etc/profile,它是是所有用户的共用的环境变量
$ sudo gedit /etc/profile
$ export JAVA_HOME=/home/CentOS6.7/java/jdk1.7.0_45 $ export JRE_HOME=/home/CentOS6.7/java/jdk1.7.0_45/jre $ export CLASSPATH=.:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar:$JRE_HOME/lib:$CLASSPATH $ export PATH=$JAVA_HOME/bin: $PATH