Zookeeper安装部署

Zookeeper安装部署


一、下载zookeeper安装文件

[root@master ~]# wget http://www.apache.org/dist//zookeeper/zookeeper-3.3.6/zookeeper-3.3.6.tar.gz

[root@master ~]# tar -zxvf zookeeper-3.3.6.tar.gz

[root@master ~]# cp -r zookeeper-3.3.6 /usr/local/

[root@master ~]# cd /usr/local/

[root@master local]# chown -R hadoop:hadoop zookeeper-3.3.6/


二、修改配置文件

[root@master local]# cd zookeeper-3.3.6/conf/

[root@master conf]# cp zoo_sample.cfg zoo.cfg

[root@master conf]# vim 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.

dataDir=/tmp/zookeeper

# the port at which the clients will connect

clientPort=2181

#server.A=B:C:D:其中 A 是一个数字,表示这个是第几号服务器;B 是这个服务器的 ip 地址;C 表示的是这个服务器与集群中的 Leader 服务器交换信息的端口;D 表示的是万一集群中的 #Leader 服务器挂了,需要一个端口来重新进行选举,选出一个新的 Leader,而这个端口就是用来执行选举时服务器相互通信的端口。如果是伪集群的配置方式,由于 B 都是一样,所以不同的 #Zookeeper 实例通信端口号不能一样,所以要给它们分配不同的端口号。

server.1=192.168.101.230:2555:3555

server.2=192.168.101.231:2555:3555

server.2=192.168.101.232:2555:3555


三、修改权限,建立data目录并赋予权限

[root@master local]# scp -r zookeeper-3.3.6/ root@slave1:/usr/local/

[root@master local]# scp -r zookeeper-3.3.6/ root@slave2:/usr/local/

[root@master local]# ssh slave1

root@slave1's password:

Last login: Tue Apr  5 16:57:35 2016 from master

[root@slave1 ~]# cd /usr/local/

[root@slave1 local]# chown -R hadoop:hadoop zookeeper-3.3.6/

[root@slave1 local]# su hadoop

[hadoop@slave1 local]$ cd zookeeper-3.3.6/

[hadoop@slave1 zookeeper-3.3.6]$ cd conf/

[hadoop@slave1 conf]$ mkdir /tmp/zookeeper

[hadoop@slave1 conf]$ cd /tmp/zookeeper/

[hadoop@slave1 zookeeper]$ mkdir data

[hadoop@master zookeeper]$ vim myid

1

同理,slave1上myid为2,在slave2上输入myid=3


修改权限,data目录修改属主和属组为hadoop,master、slave1和slave2上都得修改权限

[root@slave2 ~]# chown -R hadoop:hadoop /tmp/zookeeper/


四、启动zookeeper

[hadoop@master bin]$ ./zkServer.sh start

JMX enabled by default

Using config: /usr/local/zookeeper-3.3.6/bin/../conf/zoo.cfg

Starting zookeeper ... STARTED


你可能感兴趣的:(zookeeper,安装,部署)