Window上安装配置Zookeeper和Kafka

版权声明:RemainderTime https://blog.csdn.net/qq_39818325/article/details/82932998

安装配置Zookeeper

下载zookeeper安装包 :http://zookeeper.apache.org/doc/r3.5.4-beta/

解压后可以看到:

将conf下的zoo-sample.cfg更名为zoo.cfg,因为刚下下来的bin/zkEnv.cmd里面指定的配置文件就是zoo.cfg 

conf/zoo.cfg

dataDir=D:\\zookeeper\\data
dataLogDir=D:\\zookeeper\\log
# the port at which the clients will connect
clientPort=2181
# the maximum number of client connections.
# increase this if you need to handle more clients
#maxClientCnxns=60

通过zkServer.cmd成功启动zookeeper 

注:也可在本地配置zookeeper环境变量

打开命令行输入:zkserver 直接启动zookeeper

安装配置Kafka

1.下载https://www.apache.org/dyn/closer.cgi?path=/kafka/2.0.0/kafka_2.12-2.0.0.tgz ,解压为kafka_2.12-2.0.0

2.进入Kafka配置目录,kafka_2.12-2.0.0\config ,编辑文件“server.properties” 添加自己的日记目录:log.dirs=...   同时打开注释 listeners=PLAINTEXT://:9092。如果Zookeeper在某些其他的机器或集群上运行,可以将“zookeeper.connect:2181”修改为自定义IP与端口。在这里使用了同一个机器,所以没其他做修改。文件中的Kafka端口和broker.id也是可以配置的。默认设置不变。

注:日志文件夹自己新建,我这里是建在d盘上的

3.先运行zookeeper服务,再运行Kafka服务 
进入Kafka安装目录,D:\Kafka\kafka_2.12
切换到命令行窗口,运行kafka。 

.\bin\windows\kafka-server-start.bat .\config\server.properties

运行成功

 

运行成功,会有log文件的输出,连接zk的2181端口,启动默认的9092端口

 

猜你喜欢

转载自blog.csdn.net/qq_39818325/article/details/82932998
今日推荐