1、解压
tar -zxf zookeeper-3.4.6.tar.gz
2、修改配置文件
[[email protected] hadoop]# cd zookeeper-3.4.6/conf/ [[email protected] conf]# cp zoo_sample.cfg zoo.cfg [[email protected] conf]# 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 server.1=cluster1:2888:3888 # 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=/usr/local/hadoop/zookeeper-3.4.6/data dataLogDir=/usr/local/hadoop/zookeeper-3.4.6/logs # the port at which the clients will connect clientPort=2181 server.4=cluster4:2888:3888 server.5=cluster5:2888:3888 # 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 "zoo.cfg" 30L, 1011C written
3、修改myid
[[email protected] conf]# cd /usr/local/hadoop/zookeeper-3.4.6/data [[email protected] data]# vi myid 3 [[email protected] conf]# scp /usr/local/hadoop/zookeeper-3.4.6 [email protected]:/usr/local/hadoop/ [[email protected] data]# scp /usr/local/hadoop/zookeeper-3.4.6 [email protected]:/usr/local/hadoop/ [[email protected] conf]# cd /usr/local/hadoop/zookeeper-3.4.6/data [[email protected] data]# vi myid 4 [[email protected] conf]# cd /usr/local/hadoop/zookeeper-3.4.6/data [[email protected] data]# vi myid 5
4、启动
在cluster4、cluster5启动 [[email protected] bin]# ./zkServer.sh start JMX enabled by default Using config: /usr/local/hadoop/zookeeper-3.4.6/bin/../conf/zoo.cfg Starting zookeeper ... STARTED [[email protected] bin]# ./zkServer.sh start JMX enabled by default Using config: /usr/local/hadoop/zookeeper-3.4.6/bin/../conf/zoo.cfg Starting zookeeper ... STARTED
5、查看
[[email protected] bin]# ./zkServer.sh status JMX enabled by default Using config: /usr/local/hadoop/zookeeper-3.4.6/bin/../conf/zoo.cfg Error contacting service. It is probably not running. 这个可能是脚本问题,暂时不管。
时间: 2024-10-08 06:28:49