_覓 | 覦覈襦 | 豕蠏手 | 殊螳 | 譯殊碁 |
FrontPage › KafkaQuickStart
|
|
Windows 10 ろ
[edit]
1 れ 覦 ろ #1. れ企 覦 豢 伎( D:\kafka_2.12-2.5.0)
2. 覈轟綾 れ螻 螳 譯狩ろ ろ d: cd D:\kafka_2.12-2.5.0\bin\windows zookeeper-server-start.bat D:\kafka_2.12-2.5.0\config\zookeeper.properties 3. 覈轟綾 襯 郁, れ螻 螳 豺危豺 ろ
d: cd D:\kafka_2.12-2.5.0\bin\windows kafka-server-start.bat D:\kafka_2.12-2.5.0\config/server.properties 4. 覈轟綾 襯 郁, 曙 襷.
d: cd D:\kafka_2.12-2.5.0\bin\windows kafka-topics.bat --create --bootstrap-server localhost:9092 --replication-factor 1 --partitions 1 --topic test kafka-topics.bat --list --bootstrap-server localhost:9092 5. 覈轟綾 襯 郁, れ ろ
producer d: cd D:\kafka_2.12-2.5.0\bin\windows kafka-console-producer.bat --bootstrap-server localhost:9092 --topic testctrl+c襯 襯企 螳, 蠏碁 . 6. 覈轟綾 襯 郁, れ ろ
consumer d: cd D:\kafka_2.12-2.5.0\bin\windows kafka-console-consumer.bat --bootstrap-server localhost:9092 --topic test --from-beginning 蠏碁
[edit]
2 伎 #pip install kafka-python from kafka import KafkaConsumer import sys bootstrap_servers = ["localhost:9092"] topicName = 'test' consumer = KafkaConsumer(topicName, group_id='group1', bootstrap_servers=bootstrap_servers, auto_offset_reset='earliest') for message in consumer: print(message.value) ''' try: for message in consumer: #print ("%s:%d:%d: key=%s value=%s" % (message.topic, message.partition,message.offset, message.key,message.value)) print(message.value) except KeyboardInterrupt: sys.exit() ''' るゼ ろ覃 producer螳 覃讌襯 讌 襷 豢ル 蟆 覲 .
鏤
|
朱襦 讌螻 覈旧企. (誤 覯) |