zookeeper 配置

原创
2017/05/26 16:14
阅读数 121

前提条件:

1.下载

下载hadoop和zookeeper、jdk

hadoop-2.8.0.tar.gz

zookeeper-3.4.10.tar.gz

jdk1.8.0_121

2.修改/etc/hosts文件

增加node 节点。

node1 172.22.14.107

node3 172.22.14.172

node4 172.22.14.169

3.修改hostname

注意:在命令行把 hostname 设置成 本机的ip,例如:

机器172.22.14.107执行

hostname 172.22.14.107

机器172.22.14.172执行

hostname 172.22.14.172

机器172.22.14.169执行

hostname 172.22.14.169

4.设置公钥

ssh 公钥配置

在node1上执行

ssh-keygen

ssh-copy-id root@node3

ssh-copy-id root@node4

类似在 node3,node4上执行

====================================================================

搭建步骤:

在 /etc/profile 问价下面修改

1.配置JAVA_HOME

export JAVA_HOME=/opt/jdk1.8.0_121

export PATH=$JAVA_HOME/bin:$PATH

export CLASSPATH=.:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar

2.配置HADOOP_HOME

export HADOOP_HOME=/hadoop/hadoop

export PATH=$HADOOP_HOME/bin:$HADOOP_HOME/sbin:$PATH

export HADOOP_COMMON_LIB_NATIVE_DIR=$HADOOP_HOME/lib/native

export HADOOP_OPTS="-Djava.library.path=$HADOOP_HOME/lib:$HADOOP_HOME/lib/native"

 

 

 

3. 修改zookeeper的配置文件

zookeeper/conf/zoocfg

# 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=/hadoop/zookeeper/data

# 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.1=node1:2888:3888

server.3=node3:2888:3888

server.4=node4:2888:3888

 

在/hadoop/zookeeper/data 建立 myid文件

172.22.14.107(node1) 机器的的myid文件里面是 :1

172.22.14.172 (node3)机器的的myid文件里面是 :3

172.22.14.169 (node4)机器的的myid文件里面是 :4

这个id适合 server.id 对应的。

4.启动zoopeeper

在node1,node3,node4 上执行

./zkServer.sh start &

=========================以上是zookeeper的配置====================

 

查看zookeeper的状态

./bin/zkServer.sh status

 

展开阅读全文
打赏
0
0 收藏
分享
加载中
更多评论
打赏
0 评论
0 收藏
0
分享
返回顶部
顶部