Hadoop环境配置(9)-zookeeper搭建

zookeeper搭建前提关闭防火墙

1.将zookeeper安装包拖至cd /opt/software文件夹下

 

2.解压zookeeper到cd /opt/module/文件夹下

cd /opt/software/
tar -zxvf apache-zookeeper-3.5.5-bin.tar.gz -C /opt/module/

3.在解压后的zookeeper文件夹下,创建log文件夹和data文件夹

cd /opt/module/apache-zookeeper-3.5.7-bin/
mkdir data
mkdir log

4.拷贝配置文件

cd /opt/module/apache-zookeeper-3.5.7-bin/conf/
cp zoo_sample.cfg zoo.cfg

5.配置文件更改

vi zoo.cfg

将如下内容添加到编辑面板中:

The number of milliseconds of each tick

tickTime=2000

The number of ticks that the initial 

synchronization phase can take

initLimit=10

The number of ticks that can pass between 

sending a request and getting an acknowledgement

syncLimit=5

the directory where the snapshot is stored.

do not use /tmp for storage, /tmp here is just 

example sakes.

dataDir=/opt/module/apache-zookeeper-3.5.5-bin/data
dataLogDir=/opt/module/apache-zookeeper-3.5.5-bin/log

the port at which the clients will connect

clientPort=2181

the maximum number of client connections.

increase this if you need to handle more clients

#maxClientCnxns=60
#

Be sure to read the maintenance section of the 

administrator guide before turning on autopurge.

#

#http://zookeeper.apache.org/doc/current/zookeeperAdmin.html#sc_maintenance

#

The number of snapshots to retain in dataDir

#autopurge.snapRetainCount=3

Purge task interval in hours

Set to "0" to disable auto purge feature

#autopurge.purgeInterval=1
server.0=192.168.1.100:2888:3888
server.1=192.168.1.101:2888:3888
server.2=192.168.1.102:2888:3888

6.创建服务器myid

在data目录下创建一个myid的文件,里面的值可以给个任意的值,但要和上述服务起server.x对应

cd /opt/module/apache-zookeeper-3.5.7-bin/data/
 
touch myid

 

 7.集群拷贝

scp -r /opt/module/apache-zookeeper-3.5.5-bin root@hadoop101:/opt/module/apache-zookeeper-3.5.5-bin

scp -r /opt/module/apache-zookeeper-3.5.5-bin root@hadoop102:/opt/module/apache-zookeeper-3.5.5-bin

8.集群myid更改

进入每个节点进行更改myid的值

Hadoop101改为1

Hadoop102改为2

9.添加系统环境变量

vi /etc/profile

在编辑面板中添加如下内容:

export ZOOKEEPER_HOME=/opt/module/apache-zookeeper-3.5.7-bin
export PATH=$PATH:$ZOOKEEPER_HOME/bin

然后

source /etc/profile

10.集群启动

进入到每个节点启动

cd /opt/module/apache-zookeeper-3.5.5-bin
zkServer.sh start
zkServer.sh status

启动zkServer.sh satus时,要先找到leader,leader可能在3个服务器之中的某一个里

所以现在每个服务器中启动一下找到leader,然后再启动另外的服务器

11.zkCli连接验证

zkCli.sh -server hadoop100:2181

然后jps查看进程

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值