20190426 部署Zookeeper集群


kafka是制作消息队列的,与redis相似,但是优于redis,支持消息并列与通知,

实验:部署zookeeper集群:

安装思路及环境:先安装Java环境,再安装zookeeper,后安装kafka,:安装思路及环境:先安装Java环境,再安装zookeeper,后安装kafka,
zookeeper版本下载网址: http://mirror.bit.edu.cn/apache/zookeeper/zookeeper-3.4.14/zookeeper-3.4.14.tar.gz
http://zookeeper.apache.org/doc/current/zookeeperStarted.html中有
server.1=172.18.9.203:2888:3888 server.2=172.18.9.204:2888:3888 server.3=172.18.9.205:2888:3888
制作zookeeper集群需三台服务器:172.18.9.203,172.18.9.204,172.18.9.205
三台服务器分别配置hosts文件:
#cat /etc/hosts
127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4
::1 localhost localhost.localdomain localhost6 localhost6.localdomain6
172.18.9.203 linux-host1.exmaple.com
172.18.9.204 linux-host2.exmaple.com
172.18.9.205 linux-host3.exmaple.com

一、安装Java环境:[[email protected]/204/205 src]#yum -y install jdk-8u191-linux-x64.rpm
二、安装zookeeper:[[email protected]/204/205 src]#wget http://mirror.bit.edu.cn/apache/zookeeper/zookeeper-3.4.14/zookeeper-3.4.14.tar.gz

[[email protected]/204/205 src]#tar xf zookeeper-3.4.14.tar.gz

三、制作zookeeper配置文件:

[[email protected]/204/205 src]#cd zookeeper-3.4.14/conf
[[email protected]/204/205 conf]#ll
total 12
-rw-rw-r--. 1 2002 2002 535 Mar 7 00:50 configuration.xsl
-rw-rw-r--. 1 2002 2002 2161 Mar 7 00:50 log4j.properties
-rw-rw-r--. 1 2002 2002 922 Mar 7 00:50 zoo_sample.cfg
[[email protected]/204/205 conf]#cp zoo_sample.cfg zoo.cfg #把模板cp成配置文件

四、修改配置文件并做软连接并创建数据存放目录:

[[email protected]/204/205 conf]#vim zoo.cfg
tickTime=2000
initLimit=10
syncLimit=5
dataDir=/usr/local/zookeeper/data
clientPort=2181
maxClientCnxns=4096
server.1=172.18.9.203:2888:3888
server.2=172.18.9.204:2888:3888
server.3=172.18.9.205:2888:3888
[[email protected]/204/205 conf]#mkdir /usr/local/zookeeper/data
[[email protected]/204/205 conf]#ln -s /usr/local/src/zookeeper-3.4.14 /usr/local/zookeeper

五、开启并查看状态:[[email protected] conf]#/usr/local/zookeeper/bin/zkServer.sh start

ZooKeeper JMX enabled by default
Using config: /usr/local/zookeeper/bin/../conf/zoo.cfg
Starting zookeeper ... STARTED
[[email protected] conf]#/usr/local/zookeeper/bin/zkServer.sh status
ZooKeeper JMX enabled by default
Using config: /usr/local/zookeeper/bin/../conf/zoo.cfg
Error contacting service. It is probably not running.
出现此错的原因是zookeeper的pid没有生成!

六、将server的编号写入myid文件:

[[email protected]/204/205 zookeeper-3.4.14]#echo 1 2 3 > /usr/local/zookeeper/data/myid
[[email protected]/204/205 zookeeper-3.4.14]#

七、重新开启服务并查看端口:

[[email protected]/204/205 zookeeper-3.4.14]#/usr/local/zookeeper/bin/zkServer.sh start
[[email protected]/204/205 zookeeper-3.4.14]#ss -ntl
State Recv-Q Send-Q Local Address:Port Peer Address:Port
LISTEN 0 50 :::2181 :::*

八、查看集群状态:leader/follower 一目了然:

[[email protected] zookeeper-3.4.14]#/usr/local/zookeeper/bin/zkServer.sh status
ZooKeeper JMX enabled by default
Using config: /usr/local/zookeeper/bin/../conf/zoo.cfg
Mode: follower
[[email protected] conf]#/usr/local/zookeeper/bin/zkServer.sh status
ZooKeeper JMX enabled by default
Using config: /usr/local/zookeeper/bin/../conf/zoo.cfg
Mode: leader
[[email protected] conf]#/usr/local/zookeeper/bin/zkServer.sh status
ZooKeeper JMX enabled by default
Using config: /usr/local/zookeeper/bin/../conf/zoo.cfg
Mode: follower

九、将开启服务命令写入脚本、令其开机自启:

[[email protected]/204/205 zookeeper-3.4.14]#vim /etc/rc.d/rc.local
/usr/local/zookeeper/bin/zkServer.sh start
此时,zookeeper已完成安装,它没有账号认证,任何普户都能用!

原文地址:https://blog.51cto.com/14128387/2385777

时间: 2024-10-12 15:53:08

20190426 部署Zookeeper集群的相关文章

单台服务器部署zookeeper集群

单台部署集群 不建议使用单台部署多台服务,因为并没有实现冗余.使用多台服务器部署zookeeper集群才是生产环境使用的方案. 系统环境 [[email protected] ~]# uname -rm 2.6.32-504.el6.x86_64 x86_64 [[email protected] ~]# cat/etc/redhat-release CentOS release 6.6 (Final) 设置java堆 交换会严重降低zookeeper的性能,所以设置java对大小非常重要.为了

Linux环境快速部署Zookeeper集群

一.部署前准备: 1.下载ZooKeeper的安装包:http://zookeeper.apache.org/releases.html 我下载的版本是zookeeper-3.4.9. 2.将下载的zookeeper-3.4.9包放到/opt目录下,目录结构如下图所示: 3.在/tmp目录下新建一个zookeeper目录,并在zookeeper目录下新建一个data目录. 4.三台linux系统的ip: ip1:10.43.98.6 ip2:10.43.98.8 ip3:10.43.98.18

ubuntu14.04 server 部署 zookeeper 集群服务器

zookeeper是什么? Apache ZooKeeper 是一个面向分布式应用程序的高性能协调服务器.它使用一个简单的接口暴露公共服务(比如命名和配置管理.同步和组服务),让用户不必从头开始编程.它为实现共识.组管理.领导者选举和到场协议(presence protocol)配备了现成的支持. 下面是我在ubuntu14.04 server中部署 zookeeper集群服务器的经验 zookeeper集群服务器的部署 1.安装jdk 之前安装jdk都是自己手动配置环境,这次为了偷懒就使用了a

单台机器部署zookeeper集群

做测试没有多台机器又不想做虚拟机, 通过单独配置zoo.conf实现单机器部署zookeeper集群. 1. 集群配置文件编写 zookeeper服务1: clientPort=2181 dataDir=/var/data/zookeeper/1.machine tickTime=2000 initLimit=5 syncLimit=2 server.1=127.0.0.1:20881:30881 server.2=127.0.0.1:20882:30882 server.3=127.0.0.1

部署Zookeeper集群

本文是针对大数据开发环境来写的,配置比较简单.zookeeper的介绍.工作原理.特点自行查阅某度百科,说的非常明白.再次需要强调一下,zookeeper集群中的机器节点数是2n-1(奇数)的. 准备工作: 下载 zookeeper-3.4.6.tar.gz http://mirror.bit.edu.cn/apache/zookeeper/zookeeper-3.4.6/zookeeper-3.4.6.tar.gz 虚拟机环境:(本文使用的配置) ip地址         hostname 1

3. linux centos6.8环境下部署zookeeper集群

安装3台机器来作为zookeeper集群,3台机器的ip分别是192.168.174.7,192.168.174.8,192.168.174.9.zookeeper由java编写,所以在安装zookeeper前先安装jdk环境. 3台机器上分别创建zookeeper的安装目录 mkdir -p /usr/local/software/zookeeper 官网下载tar包,3台机器上分别分别解压 tar -xvf zookeeper-3.4.11.tar.gz -C /usr/local/soft

Zookeeper集群的安装

三台机器 hadoo0 hadoop1 hadoop2 修改主机名 vi /etc/sysconfig/network 修改ip vi /etc/sysconfig/network-scripts/ifcfg-Auto_eth1 重启 reboot 复制一行  YY  粘贴 P HQuorumPeer Zookeeper进程 HMaster HBase主进程 HRegionServer http端口 60010端口 ========================================

zookeeper集群部署

选取172.16.110.17.172.16.110.137.172.16.110.138来部署zookeeper df -lh查看磁盘空间都够用 zookeeper源码下载(由于17上已部zookeeper,所以拷过去就行) 安装在/opt目录下 tar -xvf zookeeper-3.4.6.tar 修改配置文件vi /opt/zookeeper-3.4.6/conf/zoo.cfg 加入 server.1=172.16.110.17:2888:3888server.2=172.16.11

activemq+zookeeper 集群部署基于levedb

集群图 zookeeper集群,上一篇博客写了zookeeper集群的部署 Ip 服务注册端口 主机名 192.168.56.15 2181 zk01 192.168.56.16 2181 zk02 192.168.56.17 2181 zk03 activemq部署 IP 管控台端口 集群通讯端口 消息端口 192.168.56.15 8161 61621 51511 192.168.56.16 8162 61622 51512 192.168.56.17 8163 61623 51513 h