定位过程

通过server.log查询broker1有如有下错误：

[2016-04-24 17:55:09,703] FATAL (kafka.Kafka$)
java.lang.NumberFormatException: For input string: "1 "
at java.lang.NumberFormatException.forInputString(NumberFormatException.java:65)
at java.lang.Integer.parseInt(Integer.java:492)
at java.lang.Integer.parseInt(Integer.java:527)
at scala.collection.immutable.StringLike$class.toInt(StringLike.scala:247)
at scala.collection.immutable.StringOps.toInt(StringOps.scala:30)
at kafka.utils.VerifiableProperties.getIntInRange(VerifiableProperties.scala:75)
at kafka.utils.VerifiableProperties.getIntInRange(VerifiableProperties.scala:48)
at kafka.server.KafkaConfig.<init>(KafkaConfig.scala:75)
at kafka.server.KafkaConfig.<init>(KafkaConfig.scala:31)
at kafka.Kafka$.main(Kafka.scala:35)
at kafka.Kafka.main(Kafka.scala)

原来是因为broker1的server.properties中broker.id参数的值"1"后面多了一个空格。

1
2
3

# The id of the broker. This must be set to a unique integer for each broker.#此处1后面多了一个空格broker.id=1