gpt4 book ai didi

apache-kafka - Kafka的日志目录应仅包含Kafka主题数据

转载 作者:行者123 更新时间:2023-12-02 11:58:34 30 4
gpt4 key购买 nike

我正在尝试在kubernetes环境和面对中运行融合的kafka图像

FATAL [KafkaServer id=0] Fatal error during KafkaServer startup. Prepare to shutdown (kafka.server.KafkaServer)
kafka.common.KafkaException: Found directory /var/lib/kafka/data, 'data' is not in the form of topic-partition or topic-partition.uniqueId-delete (if marked for deletion).
Kafka's log directories (and children) should only contain Kafka topic data.

我的部署配置:
apiVersion: apps/v1beta2 # for versions before 1.9.0 use apps/v1beta2
kind: Deployment
metadata:
name: kafka-confluent
labels:
app: kafka-confluent
spec:
replicas: 1
selector:
matchLabels:
app: kafka-confluent
template:
metadata:
labels:
app: kafka-confluent
spec:
containers:
- name: zookeeper-kafka
image: zookeeper:3.5
ports:
- containerPort: 2181
- name: kafka-confluent
image: confluentinc/cp-kafka:4.0.0
ports:
- containerPort: 9092
command:
- sh
- -c
- "exec kafka-server-start /etc/kafka/server.properties \
--override reserved.broker.max.id=2147483647 \
--override zookeeper.connect=localhost:2181 \
--override listeners=PLAINTEXT://:9092 \
"

为了解决这个问题,我尝试安装一些临时卷,如下所示。
volumes:
- name: kafka-data
emptyDir: {}
...
volumeMounts:
- mountPath: /var/lib/kafka/data
name: kafka-data

并使用初始化容器清除 data目录:
containers:
- name: cleaner
image: busybox
command: ['rm', '-rf', '/var/lib/kafka/data/*']

两次尝试均失败,结果相同。

另外,如果我运行图像并列出数据 /var/lib/kafka/data/看起来目录是空的。
docker run --rm -it confluentinc/cp-kafka:4.0.0 bash
root@35087653f43a:/# ls /var/lib/kafka/data/ -al
total 8
drwxrwxrwx 2 root root 4096 Apr 16 09:59 .
drwxr-xr-x 3 root root 4096 Jan 3 19:20 ..

最佳答案

我有这个工作配置:

volumeMounts:
- name: data
mountPath: /var/lib/kafka

并在命令中覆盖 log.dirs
kafka-server-start /etc/kafka/server.properties \
--override log.dirs=/var/lib/kafka

关于apache-kafka - Kafka的日志目录应仅包含Kafka主题数据,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/49854532/

30 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com