Zookeeper配置(搭建zookeeper服务器集群)

1.1 结构:一共三个节点 (zk服务器集群规模不小于3个节点),要求服务器之间系统时间保持一致。

1.2 上传zk 

                           进行解压:              tar zookeeper-3.4.5.tar.gz

                           重命名:                  mv zookeeper-3.4.5 zookeeper

                           修改环境变量:     vi /etc/profile

                                                      export  ZOOKEEPER_HOME=/usr/local/zookeeper

                                                      export PATH=.:$HADOOP_HOME/bin:$ZOOKEEPER_HOME/bin:$JAVA_HOME/…

                           刷新:              source /etc/profile

                           到zookeeper下修改配置文件 

                                                      cd /usr/local/zookeeper/conf

                                                      mv zoo_sample.cfg zoo.cfg

修改conf: vi  zoo.cfg  修改两处

                                                      (1)dataDir=/usr/local/zookeeper/data                       

                                                      (2)最后面添加

                                                               server.0=bhz:2888:3888

                                                               server.1=hadoop1:2888:3888

                                                               server.2=hadoop2:2888:3888

                           服务器标识配置:

                                                      创建文件夹:mkdir data

                                                      创建文件myid并填写内容为0:vi myid (内容为服务器标识 : 0)

                 

                           进行复制zookeeper目录到hadoop01和hadoop02 还有/etc/profile文件

                           把hadoop01、hadoop02中的myid文件里的值修改为1和2 路径(vi /usr/local/zookeeper/data/myid)

                          

                           启动zookeeper:

                                                      路径:/usr/local/zookeeper/bin

                                                      执行:zkServer.sh start (注意这里3台机器都要进行启动)

                                                      状态:zkServer.sh status(在三个节点上检验zk的mode,一个leader和俩个follower)

点赞