[英]Kafka Kubernetes: Number of alive brokers '0' does not meet the required replication factor '1' for the offsets topic
我正在尝试在 Kubernetes 中设置一个 Kafka pod,但我不断收到此错误:
[2020-08-30 11:23:39,354] ERROR [KafkaApi-0] Number of alive brokers '0' does not meet the required replication factor '1' for the offsets topic (configured via 'offsets.topic.replication.factor'). This error can be ignored if the cluster is starting up and not all brokers are up yet. (kafka.server.KafkaApis)
这是我的 Kafka 部署:
apiVersion: apps/v1
kind: Deployment
metadata:
name: kafka
namespace: instagnam
labels:
app: instagnam
service: kafka
spec:
replicas: 1
selector:
matchLabels:
app: instagnam
template:
metadata:
labels:
app: instagnam
service: kafka
id: "0"
spec:
containers:
- name: kafka
image: wurstmeister/kafka
imagePullPolicy: Always
ports:
- containerPort: 9092
name: kafka
env:
- name: KAFKA_PORT
value: "9092"
- name: KAFKA_ADVERTISED_PORT
value: "9092"
- name: KAFKA_ADVERTISED_HOST_NAME
value: kafka
- name: KAFKA_ZOOKEEPER_CONNECT
value: zookeeper:2181
- name: KAFKA_CREATE_TOPICS
value: connessioni:2:1,ricette:2:1
- name: KAFKA_BROKER_ID
value: "0"
这是我的 Kafka 服务:
apiVersion: v1
kind: Service
metadata:
name: kafka
namespace: instagnam
labels:
app: instagnam
service: kafka
spec:
selector:
app: instagnam
service: kafka
id: "0"
type: LoadBalancer
ports:
- name: kafka
protocol: TCP
port: 9092
这是我的 Zookeeper 部署:
apiVersion: apps/v1
kind: Deployment
metadata:
name: zookeeper
namespace: instagnam
labels:
app: instagnam
service: zookeeper
spec:
replicas: 1
selector:
matchLabels:
app: instagnam
service: zookeeper
template:
metadata:
labels:
app: instagnam
service: zookeeper
spec:
containers:
- image: wurstmeister/zookeeper
name: zookeeper
imagePullPolicy: Always
ports:
- containerPort: 2181
env:
- name: ZOOKEEPER_ID
value: "1"
- name: ZOOKEEPER_SERVER_1
value: zookeeper
这是我的 Zookeeper 服务:apiVersion: v1
kind: Service
metadata:
name: zookeeper
namespace: instagnam
spec:
selector:
app: instagnam
service: zookeeper
ports:
- name: client
protocol: TCP
port: 2181
- name: follower
protocol: TCP
port: 2888
- name: leader
protocol: TCP
port: 3888
我在这里做错了什么?
如果你需要完整的 Kafka 日志,这里是: https://pastebin.com/eBu8JB8A
如果你也需要的话,还有 Zookeper 日志: https://pastebin.com/gtnxSftW
编辑:如果有帮助,我将在 minikube 上运行它。
Kafka broker.id 更改可能会导致此问题。 清理zk下的kafka metadata,deleteall /brokers...注意:kafka数据会丢失
假设您在同一个 Kafka 图像上。 为我解决问题的解决方案是:
替换已弃用的KAFKA_ADVERTISED_PORT
和KAFKA_ADVERTISED_HOST_NAME
设置,详见 docker 映像 README 参见当前文档(或README commit pinned )。 使用KAFKA_ADVERTISED_LISTENERS
和KAFKA_LISTENERS
,我必须在其上添加“内部”和“外部”配置。
总结自https://github.com/wurstmeister/kafka-docker/issues/218#issuecomment-362327563
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.