window环境搭建zookeeper,kafka集群

本文是对在window环境下如何搭建zookeeper集群和kafka集群的研究,如果你正在查找相关此类资料,希望本文能对你有所帮助。

网上很多资料关于"kafka集群"几乎都是一个模样,写得东西很类似,而且很多细节没有注明,需要在不断的测试过程中推敲才能得到理想的结果。本篇文章力求能尽量说明每一个细节每一个步骤,达到只要认真看过本文者都能自己搭建一个基于window的kafka集群环境,当然这里仅代表学习心得,不具备任何商业用途的说明。

话不多说,实践才是硬道理。在进行搭建之前需要说明几点,为了能更好的了解本文的相关内容,推荐您先认真查阅kafka入门这篇文章,这能作为基础能让你更顺利看懂本篇文章。为了演示集群的效果,这里准备了一台虚拟机(window server 2008),在虚拟机中搭建了单IP多节点的zookeeper集群(多IP节点的也是同理的),并且在本机(win 10)和虚拟机中都安装了kafka。简言之需要准备的东西如下:

1.三台zookeeper服务器,都安装在同一台虚拟机中。

2.本机win10,和虚拟机分别安装一台kafka服务器。

一:虚拟机和本机网络环境

1.将虚拟机的网络模式调整为桥接模式,将虚拟机的防火墙功能关闭;

2.将主机的防火墙也关闭。

3.互相ping,测试是否能正常连接.

1)查看主机或者虚拟机中的ip:

   在cmd中输入ipconfig,找到IP4地址。这就是机子的ip地址。

   主机win10:

   

   虚拟机winserver2008:

   

2)使用ping ip地址  测试网络是否连接

   在两台机子的cmd中相互输入ping一下对方的ip:

   主机win10:

   

  winserver2008:

   

二 虚拟机中搭建zookeeper集群

  相对来说,zookeeper集群的搭建是很容易的,只需要注意一下配置文件。

  首先准备三份zookeeper程序,这里命名为server1,server2,server3.三台zookeeper服务器不同点在于它们各自的配置文件:

  

  server1的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.
# do not use /tmp for storage, /tmp here is just 
# example sakes.
#dataDir=/tmp/zookeeper
dataDir=C:\\Users\\Administrator\\Desktop\\server1\\zookeeper-3.4.8\\zkdata
dataLogDir=C:\\Users\\Administrator\\Desktop\\server1\\zookeeper-3.4.8\\zkdatalog
# the port at which the clients will connect
clientPort=3181
# the maximum number of client connections.
# increase this if you need to handle more clients
#maxClientCnxns=60
#
# 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=3
# Purge task interval in hours
# Set to "
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值