dataDir=/data/zookeeper_data # the port at which the clients will connect clientPort=2181 # disable the per-ip limit on the number of connections since this is a non-production config maxClientCnxns=0 # Disable the adminserver by default to avoid port conflicts. # Set the port to something non-conflicting if choosing to enable this admin.enableServer=false # admin.serverPort=8080
如果报错: kafka.common.InconsistentClusterIdException: The Cluster ID C4wRULTzSGqNoEAInvubIw doesn’t match stored clusterId Some(eA5rD8rZSUm3EXr2glib2w) in meta.properties. The broker is trying tojoin the wrong cluster. Configured zookeeper.connect may be wrong.
这个时候需要删除 kafka 的 log 目录,让程序重新生成
创建 systemd 配置文件
vim /etc/systemd/system/kafka.service
1 2 3 4 5 6 7 8 9 10 11 12 13 14
[Unit] Description=Apache Kafka server (broker) After=network.target zookeeper.service