在 Debian 上查看 Kafka 配置,通常要看安装方式和配置文件位置。下面按常见情况说明。
Kafka 的配置主要在 config/ 目录下(如果你是用官方 tar 包安装):
/opt/kafka/config/
/usr/local/kafka/config/
常见配置文件:
server.properties —— 最核心的 Kafka 配置producer.propertiesconsumer.propertieszookeeper.properties(如果用内置 ZooKeeper)示例查看:
cat /opt/kafka/config/server.properties
如果是通过 Debian 包管理安装的(有些第三方源):
dpkg -L kafka
通常配置在:
/etc/kafka/
查看:
ls /etc/kafka/
cat /etc/kafka/server.properties
ps -ef | grep kafka
你会看到类似:
kafka-server-start.sh /opt/kafka/config/server.properties
/opt/kafka/bin/kafka-configs.sh \
--bootstrap-server localhost:9092 \
--entity-type brokers \
--entity-defaults \
--describe
查看某个 broker:
kafka-configs.sh \
--bootstrap-server localhost:9092 \
--entity-type brokers \
--entity-name 0 \
--describe
kafka-topics.sh \
--bootstrap-server localhost:9092 \
--describe \
--topic your_topic
systemctl status kafka
# 或
jps | grep Kafka
broker.id=0
listeners=PLAINTEXT://:9092
log.dirs=/var/lib/kafka/logs
zookeeper.connect=localhost:2181
num.partitions=3
default.replication.factor=1
如果你愿意,可以告诉我:
我可以给你更精确的命令。