Windows10installkafka

编程

http://kafka.apache.org/

0. zookeeper is running on localhost or other server.

1.download & unzip

    D:devkafka_2.11-2.3.1

2.config

/conf/server.properties 

-- log.dir= D:devkafka_2.11-2.3.1kafka-logs

-- zookeeper.connect: 2181    # depends on your zookeeper

3. run 

.inwindowskafka-server-start.bat .configserver.properties

Now your Kafka Server is up and running

4. test

#创建topic

D:devkafka_2.11-2.3.1inwindows>.kafka-topics.bat --create --zookeeper localhost:2181 --replication-factor 1 --partitions 1 --topic test

Created topic test.

#查看

D:devkafka_2.11-2.3.1inwindows>.kafka-topics.bat --zookeeper localhost:2181 --describe --topic test

Topic:test PartitionCount:1 ReplicationFactor:1 Configs:

Topic: test Partition: 0 Leader: 0 Replicas: 0 Isr: 0

#publish消息

D:devkafka_2.11-2.3.1inwindows>.kafka-console-producer.bat --broker-list localhost:9092 --topic test

>test message 001

>test message 002

>^D

>^D

>;

>终止批处理操作吗(Y/N)? Y

# consumer

D:devkafka_2.11-2.3.1inwindows>.kafka-console-consumer.bat --zookeeper localhost:2181 --topic test --from-beginning

zookeeper is not a recognized option

# 测试失败, 没有--zookeeper这个选项.

# 不了了之

 

 

 

以上是 Windows10installkafka 的全部内容, 来源链接: utcz.com/z/510636.html

回到顶部