kafka集羣+zookeeper集羣常見問題與命令

常見疑問

1、生產者無法產生消息
kafka.common.FailedToSendMessageException: Failed to send messages after 3 tries.
將slf4j-nop-1.7.21.jar上傳到kafka的lib包下
參考文章:http://stackoverflow.com/questions/23903843/apache-kafka-example-error-failed-to-send-message-after-3-tries

常用命令

zk啓動

[root@localhost bin]# ./zkServer.sh start

kafka啓動

[root@localhost bin]# ./kafka-server-start.sh -daemon ../config/server.properties

創建topic

[root@localhost bin]# ./kafka-topics.sh –create –zookeeper 192.168.21.49:12181 –replication-factor 1 –partitions 1 –topic test

查看當前集羣的可用topic

[root@localhost bin]# ./kafka-topics.sh –list –zookeeper 192.168.21.14:12181
SLF4J: Class path contains multiple SLF4J bindings.
SLF4J: Found binding in [jar:file:/root/kafka/kafka_2.10-0.10.0.0/libs/slf4j-log4j12-1.7.21.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: Found binding in [jar:file:/root/kafka/kafka_2.10-0.10.0.0/libs/slf4j-nop-1.7.21.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: See http://www.slf4j.org/codes.html#multiple_bindings for an explanation.
SLF4J: Actual binding is of type [org.slf4j.impl.Log4jLoggerFactory]
TEST-TOPIC
test
wangdan
wangdan1
wangdan2

查看每個topic的運行情況

[root@localhost bin]# ./kafka-topics.sh –list –zookeeper 192.168.21.14:12181
SLF4J: Class path contains multiple SLF4J bindings.
SLF4J: Found binding in [jar:file:/root/kafka/kafka_2.10-0.10.0.0/libs/slf4j-log4j12-1.7.21.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: Found binding in [jar:file:/root/kafka/kafka_2.10-0.10.0.0/libs/slf4j-nop-1.7.21.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: See http://www.slf4j.org/codes.html#multiple_bindings for an explanation.
SLF4J: Actual binding is of type [org.slf4j.impl.Log4jLoggerFactory]
TEST-TOPIC
test
wangdan
wangdan1
wangdan2

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章