【问题标题】:Kafka Connect "worker_id" set to loopback "127.0.1.1:8083"?Kafka Connect“worker_id”设置为环回“127.0.1.1:8083”?
【发布时间】:2018-08-29 07:09:26
【问题描述】:

我有一个三节点 Confluent Kafka 集群。每个节点都在运行 zookeeper、kafka broker、schema-registry 和 kafka connect。

我已经配置了一个 S3 接收器。它似乎正在运行,但 worker_id 设置为环回 IP 地址而不是唯一 IP,这看起来是错误的:

curl "localhost:8083/connectors/my-s3-sink/status" | jq '.'

{
  "name": "my-s3-sink",
  "connector": {
    "state": "RUNNING",
    "worker_id": "127.0.1.1:8083"
  },
  "tasks": [
    {
      "state": "RUNNING",
      "id": 0,
      "worker_id": "127.0.1.1:8083"
    }
  ],
  "type": "sink"
}

Kafka Connect 如何获取127.0.1.1:8083 环回地址?我认为这对于生产三节点集群是不正确的。

如何检查我的集群配置以找出问题所在?

我通过 systemd 通过/usr/bin/connect-distributed /etc/kafka/connect-distributed.propertiesbootstrap.servers 启动 Kafka Connect,在该属性文件中设置为三个不解析为环回 IP 的节点 IP。 (我x出于隐私考虑出实际IP值)

bootstrap.servers=172.x.x.x:9092,172.x.x.x:9092,172.x.x.x:9092

我的 Kafka 代理配置了 /etc/kafka/server.properties 设置:

listeners=PLAINTEXT://0.0.0.0:9092
# EC2 public hostname
advertised.listeners=PLAINTEXT://ec2-34-x-x-x.us-west-2.compute.amazonaws.com:9092
# EC2 internal/private hostnames. localhost entry will resolve to 127.0.1.1
zookeeper.connect=ip-172-x-x-x.us-west-2.compute.internal:2181,ip-172-x-x-x.us-west-2.compute.internal:2181,ip-172-x-x-x.us-west-2.compute.internal:2181

/etc/kafka/zookeeper.properties 配置为:

server.1=172.x.x.x:2888:3888
server.2=172.x.x.x:2888:3888
server.3=172.x.x.x:2888:3888

【问题讨论】:

  • 看看/etc/hosts,但你真的不应该在每台机器上运行所有这些服务。
  • 有什么理由不应该在每个 kafka 节点上运行所有四个 kafka 服务吗?有您推荐的最佳做法指南吗?
  • 在连接器文档的某处,它说不要与经纪人摩擦。 zookeeper 更喜欢 SSD,但 Kafka 代理、连接服务器和模式注册表不喜欢。如果你打算横向扩展,你真的最多只需要三个registries,不建议超过三五个Zookeeper,大型Kafka部署只需要5个......我的观点是Kafka应该有很大的,分配给堆的大量内存的专用磁盘。 Zookeeper 将所有状态存储在内存中,并且应该能够快速响应。Connect 集群应该能够单独扩展
  • 不过,Kafka 和 Zookeeper 数据和日志目录至少安装在不同的物理磁盘上

标签: apache-kafka apache-kafka-connect confluent-platform


【解决方案1】:

rest.host.name 属性需要配置为connect-distributed.properties 中每个实例的 IP 或主机名。集群领导者使用 rest api 来平衡集群中的任务,因此如果您不使用 8083,也请更新 rest.host.port

# Hostname & Port for the REST API to listen on. If this is set, 
# it will bind to the interface used to listen to requests.
#rest.host.name=
#rest.port=8083

【讨论】:

  • 仅供参考,我想更改rest.advertised.host.namerest.host.name 是默认监听地址。
猜你喜欢
  • 2019-08-19
  • 1970-01-01
  • 1970-01-01
  • 2017-03-24
  • 1970-01-01
  • 2021-01-30
  • 2017-06-13
  • 2022-01-10
  • 2018-10-11
相关资源
最近更新 更多