我的私人笔记(zookeeper分布式安装)

分布式安装

1.安装前准备

(1)下载zookeeper:Index of /dist/zookeeper(当前使用为3.4.10版本)

(2)安装JDK

(3)拷贝zookeeper安装包到Linux系统下

(4)解压到指定目录

tar -xzvf zookeeper-3.4.10.tar.gz -C /opt/servers/

(5)修改名称

mv zookeeper-3.4.10/ zookeeper

2.配置修改

(1)修改配置文件

vi /etc/profile

添加:

export ZOOKEEPER_HOME=/opt/servers/zookeeper

export PATH=$PATH:$ZOOKEEPER_HOME/bin

        

更新配置文件:

source /etc/profile

(2)将/opt/servers/zookeeper/conf路径下的zoo_sample.cfg修改为zoo.cfg

cp zoo_sample.cfg zoo.cfg

    

(3)打开zoo.cfg文件,修改dataDir路径

vi zoo.cfg

修改如下内容:

dataDir=/opt/servers/zookeeper/zkData

server.1=hadoop01:2888:3888

server.2=hadoop02:2888:3888:

server.3=hadoop03:2888:3888

(4)在/opt/servers/zookeeper这个目录下创建zkData

mkdir zkData

(5)在zkData下创建myid文件

touch myid

(6)编辑myid文件,在文件中加上对应的server编号

vi myid

1

    

(7)拷贝Zookeeper到其他节点上,修改myid的服务编号

scp -r zookeeper/ hadoop02:/opt/servers/

scp -r zookeeper/ hadoop03:/opt/servers/

(8)hadoop02和hadoop03添加环境变量

(1)修改配置文件

vi /etc/profile

添加:

export ZOOKEEPER_HOME=/opt/servers/zookeeper

export PATH=$PATH:$ZOOKEEPER_HOME/bin        

更新配置文件:

source /etc/profile

3.操作Zookeeper

(1)启动Zookeeper

zkServer.sh start

    

(2)查看进程是否启动

jps

4101 Jps

2620 HQuorumPeer

(4)启动客户端

zkCli.sh

    

(5)退出客户端

quit

(6)停止Zookerper

zkServer.sh stop

你可能感兴趣的:(笔记,debian,运维)