工学1号馆

home

hadoop2.6完全分布式安装zookeeper3.4.6

Wu Yudong    May 25, 2015     Hadoop   583   

原创文章,转载请注明: 转载自工学1号馆

1、下载解压Zookeeper3.4.6

hadoop@master:~/opt$ tar -zxvf zookeeper-3.4.6.tar.gz

2、Zookeeper环境变量的配置

hadoop@master:~$ vim ~/.bashrc

# set zookeeper environment
export ZOOKEEPER_HOME=/home/hadoop/opt/zookeeper-3.4.6
export PATH=$PATH:$ZOOKEEPER_HOME/bin:$ZOOKEEPER_HOME/conf

3、更改配置文件

将conf/zoo_sample.cfg改成conf/zoo.cfg并修改成如下:

dataDir=/home/hadoop/opt/zookeeper-3.4.6/var/data
# the port at which the clients will connect
clientPort=2181
server.1=master:2888:3888
server.2=slave1:2888:3888

4、在DataDir路径下创建myid文件

hadoop@master:~/opt/zookeeper-3.4.6$ mkdir var
hadoop@master:~/opt/zookeeper-3.4.6$ cd var
hadoop@master:~/opt/zookeeper-3.4.6/var$ mkdir data
hadoop@master:~/opt/zookeeper-3.4.6/var$ mkdir datalog
hadoop@master:~/opt/zookeeper-3.4.6/var$ cd data
hadoop@master:~/opt/zookeeper-3.4.6/var/data$ vim myid

5、分发到集群的其它机器

hadoop@master:~$ scp -r /home/hadoop/opt/zookeeper-3.4.6 hadoop@slave1:/home/hadoop/opt

6、启动与关闭zookeeper

hadoop@master:~$ cd ~/opt/zookeeper-3.4.6/bin
hadoop@master:~/opt/zookeeper-3.4.6/bin$ ./zkServer.sh start

JMX enabled by default
Using config: /home/hadoop/opt/zookeeper-3.4.6/bin/../conf/zoo.cfg
Starting zookeeper … STARTED

表示启动成功!

要想关闭zookeeper,运行下面的命令:

hadoop@master:~/opt/zookeeper-3.4.6/bin$ ./zkServer.sh stop

JMX enabled by default
Using config: /home/hadoop/opt/zookeeper-3.4.6/bin/../conf/zoo.cfg
Stopping zookeeper … STOPPED

 

如果文章对您有帮助,欢迎点击下方按钮打赏作者

Comments

No comments yet.
To verify that you are human, please fill in "七"(required)