kafka kubernetes:活动代理的数目“0”不符合偏移量主题所需的复制因子“1”

k0pti3hp  于 2021-06-04  发布在  Kafka
关注(0)|答案(1)|浏览(530)

我正试图在库伯内茨建立一个Kafka吊舱,但我一直得到这个错误:

[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上运行这个,如果可以的话。

wmomyfyw

wmomyfyw1#

kafka broker.id的更改可能会导致此问题。清理zk下的kafka元数据,deleteall/brokers。。。注:Kafka数据将丢失

相关问题