Zookeeper与Kafka集群搭建
一 :环境准备:
- 物理机window7 64位
- vmware 3个虚拟机 centos6.8 IP为:192.168.17.[129 -131]
- JDK1.7安装配置
- 各虚拟机之间配置免密登录
- 安装clustershell用于集群各节点统一操作配置
1 :在此说明一下免密和clustershell的操作和使用方式
1.1 :配置免密登录(各集群节点间,互相操作对方时,只需要输入对方ip或者host即可,不需要输入密码,即:免密登录)
1.1.2 :生成密钥文件和私钥文件 命令
ssh-keygen -t rsa
1.1.3 :查看生成秘钥文件
ls /root/.ssh
1.1.4 : 将秘钥拷贝到对方机器
ssh-copy-id -i /root/.ssh/id_rsa.pub 192.168.17.129
ssh-copy-id -i /root/.ssh/id_rsa.pub 192.168.17.130
ssh-copy-id -i /root/.ssh/id_rsa.pub 192.168.17.131
1.1.5 :测试互相是否连接上
可以分别在不同节点间互相登录操作一下
ssh root@192.168.17.130
hostname
1.2 : clustershell的安装
备注一下,我是安装的centos6.6 mini无界面版本,通过yun install clustershell安装时,会提示no package ,原因yum源中的包长期没有更新,所以使用来epel-release
安装命令:
sudo yum install epel-release
然后在yum install clustershell 就可以通过epel来安装了
1.2.2 : 配置cluster groups
vim /etc/clustershell/groups
添加一个组名:服务器IP或者host
kafka:192.168.17.129 192.168.17.130 192.168.17.131
二 :Zookeeper和Kafka下载
本文使用的zookeeper和kafka版本分别为:3.4.8 , 0.10.0.0
1 :首先到官网进行下载:
将压缩包放在自己指定的目录下,我这里放在了/opt/kafka 目录下
然后,通过clush 将压缩包copy到其它几个服务节点中
clush -g kafka -c /opt/kafka
2 :通过clush来解压缩所有节点的zk和kafka压缩包
clush -g kafka tar zxvf /opt/kafka/zookeeper-3.4.8
clush -g kafka tar zxvf /opt/kafka/kafka_2.11-0.10.1.0
3 : 将zoo_sample.cfg 拷贝一份为zoo.cfg (默认的zookeeper配置文件)
修改配置,zoo.cfg文件
# The number of milliseconds of each tick
tickTime=
# The number of ticks that the initial
# synchronization phase can take
initLimit=
# The number of ticks that can pass between
# sending a request and getting an acknowledgement
syncLimit=
# the directory where the snapshot is stored.
# do not use /tmp for storage, /tmp here is just
# example sakes.
dataDir=/tmp/zookeeper
# the port at which the clients will connect
clientPort= ## zk 默认端口 ## 节点IP和端口
server.=192.168.17.129::
server.=192.168.17.130::
server.=192.168.17.131:: # the maximum number of client connections.
# increase this if you need to handle more clients
#maxClientCnxns=
#
# 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=
# Purge task interval in hours
# Set to "" to disable auto purge feature
#autopurge.purgeInterval=
3 : 创建tmp/zookeeper 用来存储zk信息
mkdir /tmp/zookeeper
4 : 为每个tmp/zookeeper 设置一个myid的文件,内容为节点id 1 or 2 or 3
echo "1" > myid
clush -g kafka "service iptables status"clush -g kafka "service iptables stop"
clush -g kafka /opt/kafka/zookeeper/bin/zkServer.sh start /opt/kafka/zookeeper/conf/zoo.cfg
clush -g kafka lsof -i:2181

bin/zkCli.sh -server 192.168.17.130:2181create /test hello


三 :Kafka安装部署
zookeeper.connect=192.168.17.129:2181,192.168.17.130:2181,192.168.17.131:2181
/opt/kafka/kafka_2.11-0.10.1.0/bin/kafka-server-start.sh -daemon /opt/kafka/kafka_2.11-0.10.1.0/config/server.properties
bin/kafka-topics.sh --zookeeper 192.168.17.129:2181 -topic topicTest --create --partition 3 --replication-factor 2
[root@Kafka01 kafka_2.11-0.10.1.0]# bin/kafka-topics.sh --zookeeper 192.168.17.129:2181 -topic topicTest --describe

bin/kafka-console-consumer.sh --zookeeper 192.168.17.130:2181 --topic topicTest
bin/kafka-console-producer.sh --broker-list kafka02:9092 --topic topicTest



Zookeeper与Kafka集群搭建的更多相关文章
- zookeeper及kafka集群搭建
zookeeper及kafka集群搭建 1.有关zookeeper的介绍可参考:http://www.cnblogs.com/wuxl360/p/5817471.html 2.zookeeper安装 ...
- zookeeper与Kafka集群搭建及python代码测试
Kafka初识 1.Kafka使用背景 在我们大量使用分布式数据库.分布式计算集群的时候,是否会遇到这样的一些问题: 我们想分析下用户行为(pageviews),以便我们设计出更好的广告位 我想对用户 ...
- CentOS 7 Zookeeper 和 Kafka 集群搭建
环境 CentOS 7.4 Zookeeper-3.6.1 Kafka_2.13-2.4.1 Kafka-manager-2.0.0.2 本次安装的软件全部在 /home/javateam 目录下. ...
- Zookeeper + Kafka 集群搭建
第一步:准备 1. 操作系统 CentOS-7-x86_64-Everything-1511 2. 安装包 kafka_2.12-0.10.2.0.tgz zookeeper-3.4.9.tar.gz ...
- 搭建zookeeper和Kafka集群
搭建zookeeper和Kafka集群: 本实验拥有3个节点,均为CentOS 7系统,分别对应IP为10.211.55.11.10.211.55.13.10.211.55.14,且均有相同用户名 ( ...
- Docker快速搭建Zookeeper和kafka集群
使用Docker快速搭建Zookeeper和kafka集群 镜像选择 Zookeeper和Kafka集群分别运行在不同的容器中zookeeper官方镜像,版本3.4kafka采用wurstmeiste ...
- 使用Docker快速搭建Zookeeper和kafka集群
使用Docker快速搭建Zookeeper和kafka集群 镜像选择 Zookeeper和Kafka集群分别运行在不同的容器中zookeeper官方镜像,版本3.4kafka采用wurstmeiste ...
- CentOS 7搭建Zookeeper和Kafka集群
环境 CentOS 7.4 Zookeeper-3.6.1 Kafka_2.13-2.4.1 Kafka-manager-2.0.0.2 本次安装的软件全部在 /home/javateam 目录下. ...
- zookeeper集群及kafka集群搭建
1.zookeeper集群搭建 1.1 上传安装包 官网推荐至少3个节点,我们这里也用三个节点192.169.2.18 192.169.1.82 192.169.1.95 准备好安装包,zooke ...
随机推荐
- C语言的位运算的优势
位运算加速技巧1. 如果乘上一个2的倍数数值,可以改用左移运算(Left Shift) 加速 300% x = x * 2;x = x * 64;//改为:x = x << 1; // 2 ...
- DataTimePicker
日期时间控件 DataTimePicker 功能:拾取系统时间.日期,并以对应格式输出 重要属性: a. date,拾取的时间. b. Time,拾取的系统时间 举例如:button2.Captio ...
- because of many connection errors; unblock with 'mysqladmin flush-hosts
环境:linux,mysql5.5.37 错误:Host is blocked because of many connection errors; unblock with 'mysqladmin ...
- Spark算子总结及案例
spark算子大致上可分三大类算子: 1.Value数据类型的Transformation算子,这种变换不触发提交作业,针对处理的数据项是Value型的数据. 2.Key-Value数据类型的Tran ...
- win8 64位+Oracle 11g 64位下使用PL/SQL Developer 的解决办法
1)安装Oracle 11g 64位2)安装32位的Oracle客户端( instantclient-basic-win32-11.2.0.1.0)下载 instantclient-basic-win ...
- Firebug及YSlow简介与使用图文详解
Firebug本是Firefox浏览器下一个出色的网页设计插件,随着浏览器的发展,Firebug也推出了支持IE.Opera.Chrome的Firebug Lite.凭借Firebug的出色代码调试功 ...
- 算法一之N皇后问题
(写这篇文章主要是明天就要考试了,算法考试,今天不想再复习了,xiang着今天也开通了博客,于是在这个平台上进行复习,应该会更高效.最后祝愿我明天考个好成绩.嘻嘻...) n皇后问题,主要是应用到回溯 ...
- html标签大全(1)
http标签详解及讲解 1.基础标签 <!DOCTYPE html> <!--表示文本类型--> <html> <!--<html> ...
- css基础详解(1)
css讲解 声明 1:这里的文字都是我从我自己csdn账号拷贝过来,是本人学习总结的结晶,所以请尊重本作品.2:如要要转载本文章,则要说明文字的出处.3:如有哪里不对或者哪里还不够完善欢迎大家指出. ...
- 基于Xcode8插件开发~一键检测处理头文件引用
Xcode8开放了新的一个Extension:Xcode Source Editor Extension,目的是让开发者可以正规的自主为IDE编写插件,虽然说系统现提供的功能还比较拮据,但是不妨碍我们 ...