1. Problem
Ubuntu 16, JDK 8. Kafka 1.0
使用单独的zookeeper. Started single-node zookeeper, zkCli works perfectly.
Created directory /tmp/kafka-logs
Started kafka with default configuration, no error pops. Not sure if the kafka is started.
Try to create a topic, error: replication factor larger than available brokers
2. Analysis and Solution
logging in to your Zookeepr console : bin/zkCli.sh -server localhost:2181 Run [zk: localhost:2181(CONNECTED) 2] ls /brokers/ids on the console. It must be not be showing up any brokers.
kafka没有启动成功. 因为启动的时候用了-daemon选项所以没看到报错.
kill掉zookeeper, 换用kafka自带zookeeper和default configuration, 启动zk成功
启动kafka终于见到报错了,原来是/tmp/kafka-logs没有写入权限, 通过chmod改一下后kafka启动成功,创建topic成功.