linux 上安装 zookeeper

本贴最后更新于 1929 天前,其中的信息可能已经渤澥桑田

1. zookeeper 的下载

从官网下载自己要安装的 zookeeper

附上官网地址

http://zookeeper.apache.org/releases.html

2.开始安装

2.1 上传到服务器

scp zookeeper.3.14.tar.gz root@:hdp:~/

2.2 解压

tar zvxf zookeeper.3.14.tar.gz

2.3 移动到/usr/local 目录并重命名为 zookeeper

mv zookeeper-3.14 /usr/local/zookeeper

2.4 修改配置文件

先复制模版

cd zookeeper/conf

cp zookeeper-sample.cfg zookeeper.cfg

2.4.1 如果单机启动的话只修改数据存放文件就可以了

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

2.4.2 集群启动的话需要配置各节点

# 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=/root/zkdata
# the port at which the clients will connect
clientPort=2181
server.1=hdp-master:2888:3888
server.2=hdp-node:2888:3888
server.3=hdp-node2:2888:3888

2.5 在服务器上新建数据目录/root/zkdata,并生成 myid

mkdir zkdata
echo 1 > zkdata/myid

2.6 如果启动集群的话分发 zookeeper

scp zookeeper root@hdp-node:$PWD

3 启动

bin/zkServer.sh start

4 通过脚本批量启动集群

#!/bin/bash
# 要启动的集群hosts
manager_hosts=(hdp-master hdp-node hdp-node2)
for host in ${manager_hosts[@]}
do
        echo "${host}:${1}ing..."
        ssh ${host} "source /etc/profile;/usr/local/zookeeper/bin/zkServer.sh $1"
done

sleep 2

for host in ${manager_hosts[@]}
do
        echo "${host}:${1}ing..."
        ssh ${host} "source /etc/profile;/usr/local/zookeeper/bin/zkServer.sh status"
done
  • Linux

    Linux 是一套免费使用和自由传播的类 Unix 操作系统,是一个基于 POSIX 和 Unix 的多用户、多任务、支持多线程和多 CPU 的操作系统。它能运行主要的 Unix 工具软件、应用程序和网络协议,并支持 32 位和 64 位硬件。Linux 继承了 Unix 以网络为核心的设计思想,是一个性能稳定的多用户网络操作系统。

    915 引用 • 931 回帖
  • ZooKeeper

    ZooKeeper 是一个分布式的,开放源码的分布式应用程序协调服务,是 Google 的 Chubby 一个开源的实现,是 Hadoop 和 HBase 的重要组件。它是一个为分布式应用提供一致性服务的软件,提供的功能包括:配置维护、域名服务、分布式同步、组服务等。

    59 引用 • 29 回帖 • 15 关注

相关帖子

欢迎来到这里!

我们正在构建一个小众社区,大家在这里相互信任,以平等 • 自由 • 奔放的价值观进行分享交流。最终,希望大家能够找到与自己志同道合的伙伴,共同成长。

注册 关于
请输入回帖内容 ...
  • kevinBobo
    作者

    谢了,发现我好多地方都写成 liunx 了,尴尬 😂

  • 其他回帖
  • 88250

    稍微纠正一下拼写问题:Linux 😋

    1 回复