确保Java和Zookeeper安装配置完成之后,安装Kafka
官网下载 http://kafka.apache.org/downloads.html
#tar -zxf kafka_2.12-0.11.0.3.tar.gz
#mv kafka_2.12-0.11.0.3 /usr/local/kafka
#mkdir /tmp/kafka-logs
#export JAVA_HOME=/usr/java/jdk1.8
#/usr/local/kafka/bin/kafka-server-start.sh -daemon /usr/local/kafka/config/server.properties
通过创建测试主题验证一下
/usr/local/kafka/bin/kafka-topics.sh --create --zookeeper localhost:2181 --replication-factor 1 --partitions 1 --topic test
执行报错
ERROR org.apache.kafka.common.errors.InvalidReplicationFactorException: replication factor: 1 larger than available brokers: 0
需要启动broker:
bin/zookeeper-server-start.sh config/zookeeper.properties
bin/kafka-server-start.sh config/server.properties
网友评论