bin/kafka-topics.sh --create --zookeeper es1:2181 --replication-factor 1 --partitions 1 --topic topic1
kafka创建会话,报Error while executing topic command : Replication factor: 1 larger than available brokers: 0.
首先贴出来 kafka的配置文件
broker.id=0
advertised.listeners=PLAINTEXT://es1:9092
num.network.threads=3
num.io.threads=8
socket.send.buffer.bytes=102400
socket.receive.buffer.bytes=102400
socket.request.max.bytes=104857600
log.dirs=/tmp/kafka-logs
num.partitions=1
num.recovery.threads.per.data.dir=1
offsets.topic.replication.factor=1
transaction.state.log.replication.factor=1
transaction.state.log.min.isr=1
log.retention.hours=168
log.segment.bytes=1073741824
log.retention.check.interval.ms=300000
zookeeper.connect=localhost:2181/kafka #针对局域网向公网IP端口暴露的话,这修改配置文件,加入以下配置: 新版本0.10.x broker配置弃用了advertised.host.name和 advertised.port这两个个配置项,就配置advertised.listeners就可以
zookeeper.connection.timeout.ms=6000
group.initial.rebalance.delay.ms=0
只需要修改
bin/kafka-topics.sh --create --zookeeper es1:2181/kafka --replication-factor 1 --partitions 1 --topic topic1
pasting