您的位置:首页 > 其它

kafka集群+zookeeper集群常见问题与命令

2016-06-30 21:35 381 查看

常见疑问

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
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息