zookeeper环境搭建与配置

1. 将下载下来的zookeeper扔到linux上,并解压。
命令tar -zxvf 文件名。

2. 创建数据存放目录和日志存放目录
mkdir home/zookeeper/data
mkdir home/zookeeper/logs

3. 将zookeeper-3.4.3/conf目录下的zoo_sample.cfg文件拷贝一份,命名为为“zoo.cfg”。 修改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=/home/zookeeper/data
dataLogDir=/home/zookeeper/logs

# the port at which the clients will connect
clientPort=2181
#
# 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

# 2888,3888 are election port
server.1=zookeeper:2888:3888
4、创建dataDir参数指定的目录(这里指的是“ /home/hadooptest/zookeeper-3.4.3/zookeeperdir/zookeeper-data”),并在目录下创建文件,命名为“myid”。


5、在/etc/profile文件中设置PATH
修改profile文件:
sudo vi /etc/profile


export ZOOKEEPER_HOME=/home/hadooptest/zookeeper-3.4.3
PATH=$ZOOKEEPER_HOME/bin:$PATH
export PATH


6、在所有服务器中执行:
./bin/zookeeper-server-start.sh  ../config/zookeeper.properties  &

7、输入jps命令查看进程

猜你喜欢

转载自meowo.iteye.com/blog/2001352