kafka 出现错误问题

1. kafka创建topic出现:

Error while executing topic command org.apache.zookeeper.KeeperException$NoNodeException: KeeperErrorCode = NoNode for /brokers/ids

原因: 没有在kafka目录下创建zookeeper ,指定myid

解决:

cd /uardata10/chbtmp/package/kafka_2.10-0.8.2.1
mkdir zookeeper
cd zookeeper 
touch myid 
echo 0 > myid 
重新启动kafka就ok

1.1 、创建topic的paration大于可用的boker

创建topic 指定partitions 为5  而 borker只有一个
 ./bin/kafka-topics.sh -zookeeper idc007128:2181,idc007124:2181,idc007123:2181  -topic test -replication-factor 2 -partitions 5 -create 
 ##问题
Error while executing topic command replication factor: 2 larger than available brokers: 1

解决

 -replication-factor 1  副本数为1
[root@idc007130 kafka_2.10-0.8.2.1]# ./bin/kafka-topics.sh -zookeeper idc007128:2181,idc007124:2181,idc007123:2181  -topic test -replication-factor 1 -partitions 1 -create  
Created topic "test".

2、kafka的broker.id 重复导致出错

原因: 复制config/server.properties没有修改主机名和borker.id

[2017-06-14 18:07:55,583] FATAL Fatal error during KafkaServer startup. Prepare to shutdown (kafka.server.KafkaServer)
kafka.common.InconsistentBrokerIdException: Configured brokerId 0 doesn't match stored brokerId 1 in meta.properties
        at kafka.server.KafkaServer.getBrokerId(KafkaServer.scala:630)
        at kafka.server.KafkaServer.startup(KafkaServer.scala:175)
        at kafka.server.KafkaServerStartable.startup(KafkaServerStartable.scala:37)
        at kafka.Kafka$.main(Kafka.scala:67)
        at kafka.Kafka.main(Kafka.scala)

解决:

第一步: 修改config/server.properties中的boker.id 及主机名
第二步:删除log.dirs=/tmp/kafka-logs目录, 重新启动

你可能感兴趣的:(#,zookeeper,#,kafka)