“处理组件 pubsub 错误:组件 pubsub 的初始化超时超过 5 秒”

Posted

技术标签:

【中文标题】“处理组件 pubsub 错误:组件 pubsub 的初始化超时超过 5 秒”【英文标题】:"process component pubsub error: init timeout for component pubsub exceeded after 5s" 【发布时间】:2021-07-07 07:56:32 【问题描述】:

我在我的 .net 核心微服务中使用 DAPR 和 Docker。 我在 docker-compose.yml 中进行了以下配置来运行代理和 dapr pubsub 配置。

PUBSUB.yml

apiVersion: dapr.io/v1alpha1
kind: Component
metadata:
  name: pubsub
  namespace: default
spec:
  type: pubsub.kafka
  version: v1
  metadata:
      # Kafka broker connection setting
    - name: brokers
      value: local:9092
    - name: authRequired
      value: "false"
    - name: maxMessageBytes
      value: 1024

和 Dockercompose.yml

  zookeeper:
     image: confluentinc/cp-zookeeper:6.1.1
     ports:
      - "2181:2181"
     environment:
      ZOOKEEPER_CLIENT_PORT: 2181
  broker:
    image: confluentinc/cp-kafka:6.1.1
    hostname: broker
    container_name: broker
    depends_on:
      - zookeeper
    ports:
      - "29092:29092"
      - "9092:9092"
      - "9101:9101"
      - "9090:9090"
    environment:
      KAFKA_BROKER_ID: 1
      KAFKA_ZOOKEEPER_CONNECT: 'zookeeper:2181'
      KAFKA_LISTENER_SECURITY_PROTOCOL_MAP: PLAINTEXT:PLAINTEXT,PLAINTEXT_HOST:PLAINTEXT
      KAFKA_ADVERTISED_LISTENERS: PLAINTEXT://broker:29092,PLAINTEXT_HOST://localhost:9092
      KAFKA_OFFSETS_TOPIC_REPLICATION_FACTOR: 1
      KAFKA_TRANSACTION_STATE_LOG_MIN_ISR: 1
      KAFKA_TRANSACTION_STATE_LOG_REPLICATION_FACTOR: 1
      KAFKA_GROUP_INITIAL_REBALANCE_DELAY_MS: 0
      KAFKA_JMX_PORT: 9101
      KAFKA_JMX_HOSTNAME: localhost

我的 dapr 车没有在本地环境中初始化,它的抛出错误如下

图片

错误:


time="2021-04-12T07:05:26.9278616Z" level=info msg="starting Dapr Runtime -- version 1.0.0 -- commit 6314733" app_id=monitoringapi instance=43a8c7996e98 scope=dapr.runtime type=log ver=1.0.0

time="2021-04-12T07:05:26.9282174Z" level=info msg="log level set to: info" app_id=monitoringapi instance=43a8c7996e98 scope=dapr.runtime type=log ver=1.0.0

time="2021-04-12T07:05:26.9317538Z" level=info msg="metrics server started on :9090/" app_id=monitoringapi instance=43a8c7996e98 scope=dapr.metrics type=log ver=1.0.0

time="2021-04-12T07:05:26.9339347Z" level=info msg="loading default configuration" app_id=monitoringapi instance=43a8c7996e98 scope=dapr.runtime type=log ver=1.0.0

time="2021-04-12T07:05:26.9349457Z" level=info msg="standalone mode configured" app_id=monitoringapi instance=43a8c7996e98 scope=dapr.runtime type=log ver=1.0.0

time="2021-04-12T07:05:26.9350359Z" level=info msg="app id: monitoringapi" app_id=monitoringapi instance=43a8c7996e98 scope=dapr.runtime type=log ver=1.0.0

time="2021-04-12T07:05:26.9354469Z" level=info msg="mTLS is disabled. Skipping certificate request and tls validation" app_id=monitoringapi instance=43a8c7996e98 scope=dapr.runtime type=log ver=1.0.0

time="2021-04-12T07:05:26.9384313Z" level=info msg="local service entry announced: monitoringapi -> 172.28.0.11:37301" app_id=monitoringapi instance=43a8c7996e98 scope=dapr.contrib type=log ver=1.0.0

time="2021-04-12T07:05:26.9385462Z" level=info msg="Initialized name resolution to standalone" app_id=monitoringapi instance=43a8c7996e98 scope=dapr.runtime type=log ver=1.0.0

time="2021-04-12T07:05:32.3047616Z" level=fatal msg="process component pubsub error: init timeout for component pubsub exceeded after 5s" app_id=monitoringapi instance=43a8c7996e98 scope=dapr.runtime type=log ver=1.0.0

请帮我解决这个问题

【问题讨论】:

嗨伙计,我也有同样的问题。解决了吗?谢谢。 问题的标题没有说明正在发生的事情。更改它,以便您有更多机会收到答案。它需要更直观。 【参考方案1】:

通过简单的配置解决了这个问题

【讨论】:

以上是关于“处理组件 pubsub 错误:组件 pubsub 的初始化超时超过 5 秒”的主要内容,如果未能解决你的问题,请参考以下文章