Zookeeper安装部署

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了Zookeeper安装部署相关的知识,希望对你有一定的参考价值。

Zookeeper安装部署


一、下载zookeeper安装文件

[[email protected] ~]# wget http://www.apache.org/dist//zookeeper/zookeeper-3.3.6/zookeeper-3.3.6.tar.gz

[[email protected] ~]# tar -zxvf zookeeper-3.3.6.tar.gz

[[email protected] ~]# cp -r zookeeper-3.3.6 /usr/local/

[[email protected] ~]# cd /usr/local/

[[email protected] local]# chown -R hadoop:hadoop zookeeper-3.3.6/


二、修改配置文件

[[email protected] local]# cd zookeeper-3.3.6/conf/

[[email protected] conf]# cp zoo_sample.cfg zoo.cfg

[[email protected] 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目录并赋予权限

[[email protected] local]# scp -r zookeeper-3.3.6/ [email protected]:/usr/local/

[[email protected] local]# scp -r zookeeper-3.3.6/ [email protected]:/usr/local/

[[email protected] local]# ssh slave1

[email protected]‘s password:

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

[[email protected] ~]# cd /usr/local/

[[email protected] local]# chown -R hadoop:hadoop zookeeper-3.3.6/

[[email protected] local]# su hadoop

[[email protected] local]$ cd zookeeper-3.3.6/

[[email protected] zookeeper-3.3.6]$ cd conf/

[[email protected] conf]$ mkdir /tmp/zookeeper

[[email protected] conf]$ cd /tmp/zookeeper/

[[email protected] zookeeper]$ mkdir data

[[email protected] zookeeper]$ vim myid

1

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


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

[[email protected] ~]# chown -R hadoop:hadoop /tmp/zookeeper/


四、启动zookeeper

[[email protected] bin]$ ./zkServer.sh start

JMX enabled by default

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

Starting zookeeper ... STARTED


本文出自 “梅花香自苦寒来!” 博客,请务必保留此出处http://daixuan.blog.51cto.com/5426657/1760559

以上是关于Zookeeper安装部署的主要内容,如果未能解决你的问题,请参考以下文章

Zookeeper安装部署

20190426 部署Zookeeper集群

zookeeper安装及部署

Zookeeper安装部署

大数据之Zookeeper:Zookeeper分布式安装部署

zookeeper部署安装