1.安裝zookeeper
?解壓apache-zookeeper-3.8.0-bin.tar.gz到指定目錄,復(fù)制conf目錄下zoo_sample.cfg到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=/data/etl/zookeeper-3.8.0-bin/data
clientPort=2181
maxClientCnxns=60
進(jìn)入bin目錄,啟動(dòng)zookeeper
./zkServer.sh?start
2.安裝Kafka
解壓kafka_2.12-3.0.0.tgz到指定目錄。
進(jìn)入到config目錄,修改server.properties配置
#?允許外部端口連接???
listeners=PLAINTEXT://0.0.0.0:9092
#?外部代理地址
advertised.listeners=PLAINTEXT://10.16.60.62:9092
log.dirs=/data/etl/kafka_2.12-3.0.0/log
zookeeper.connect=10.16.60.62:2181
advertised.listeners才是真正的對外代理地址,listeners的作用不是對外提供服務(wù)代理,而是監(jiān)聽!
啟動(dòng)kafka
./kafka-server-start.sh?-daemon?../config/server.properties
3.使用測試
創(chuàng)建主題topic
./kafka-topics.sh?--create?--topic?myevents?--partitions?10?--replication-factor?1?--bootstrap-server?localhost:9092
查看主題文章來源:http://www.zghlxwxcb.cn/news/detail-730430.html
./kafka-topics.sh?--describe?--topic?myevents?--bootstrap-server?localhost:9092
Topic:?myevents?TopicId:?68wbesvHSmmYSTRu-odyeQ?PartitionCount:?20??????ReplicationFactor:?1????Configs:?segment.bytes=1073741824
????????Topic:?myevents?Partition:?0????Leader:?0???????Replicas:?0?????Isr:?0
????????Topic:?myevents?Partition:?1????Leader:?0???????Replicas:?0?????Isr:?0
????????Topic:?myevents?Partition:?2????Leader:?0???????Replicas:?0?????Isr:?0
????????Topic:?myevents?Partition:?3????Leader:?0???????Replicas:?0?????Isr:?0
????????Topic:?myevents?Partition:?4????Leader:?0???????Replicas:?0?????Isr:?0
????????Topic:?myevents?Partition:?5????Leader:?0???????Replicas:?0?????Isr:?0
????????Topic:?myevents?Partition:?6????Leader:?0???????Replicas:?0?????Isr:?0
????????Topic:?myevents?Partition:?7????Leader:?0???????Replicas:?0?????Isr:?0
????????Topic:?myevents?Partition:?8????Leader:?0???????Replicas:?0?????Isr:?0
????????Topic:?myevents?Partition:?9????Leader:?0???????Replicas:?0?????Isr:?0
????????Topic:?myevents?Partition:?10???Leader:?0???????Replicas:?0?????Isr:?0
刪除主題文章來源地址http://www.zghlxwxcb.cn/news/detail-730430.html
./kafka-topics.sh?--bootstrap-server?localhost:9092?--delete?--topic?myevents
到了這里,關(guān)于史上最簡單的Kafka安裝教程的文章就介紹完了。如果您還想了解更多內(nèi)容,請?jiān)谟疑辖撬阉鱐OY模板網(wǎng)以前的文章或繼續(xù)瀏覽下面的相關(guān)文章,希望大家以后多多支持TOY模板網(wǎng)!