当前位置: 首页 > 知识库问答 >
问题:

Kafka模式注册表-在容器中通告动态端口

连志义
2023-03-14
PORT is deprecated. Please use SCHEMA_REGISTRY_LISTENERS instead.
[2019-10-25 11:55:47,813] INFO Finished rebalance with master election result: Assignment{version=1, error=0, master='sr-1-7a9a403a-63cc-4fed-b548-10ea440863d5', masterIdentity=version=1,host=10.135.124.179,port=29932,scheme=http,masterEligibility=true} (io.confluent.kafka.schemaregistry.masterelector.kafka.KafkaGroupMasterElector)
/**
   * A Schema Registry instance's identity is in part the port it listens on. Currently the port can
   * either be configured via the deprecated `port` configuration, or via the `listeners`
   * configuration.
   *
   * <p>This method uses `Application.parseListeners()` from `rest-utils` to get a list of
   * listeners, and returns the port of the first listener to be used for the instance's identity.
   *
   * <p></p>In theory, any port from any listener would be sufficient. Choosing the first, instead
   * of say the last, is arbitrary.
   */
  // TODO: once RestConfig.PORT_CONFIG is deprecated, remove the port parameter.
  static SchemeAndPort getSchemeAndPortForIdentity(int port, List<String> configuredListeners,
                                                   String requestedScheme)

(https://github.com/confluentinc/schema-registry/blob/5af0ca3be1138fe483d0f90f4ccfd4f02f158334/core/src/main/java/io/confluent/kafka/schemaregistry/storage/kafkaschemaregistry.java#l211-l223)

因此,通告端口的唯一方法是使用侦听器设置它,这可能很烦人(但作为一种解决方案仍然可行)。

共有1个答案

尹小云
2023-03-14

Listeners接受绑定地址和端口,正如您发现的那样,是用于实例标识的第一个侦听器的端口

通过HTTP或HTTPS侦听API请求的侦听器列表,以逗号分隔。如果侦听器使用HTTPS,则还需要设置适当的SSL配置参数

模式注册表标识存储在ZooKeeper中,由主机名和端口组成。如果配置了多个侦听器,则使用第一个侦听器的端口作为其标识。

 类似资料:
  • 我试图运行Kafka服务与Zookeper,Kafdrop和模式注册表,我使它的工作安装Kafka,Zookeper和Kadrop在一个容器,然后安装合流模式注册表在另一个(与自己的Kafka,Zoowatch,Ksql服务器和Rest代理),然而尝试要使kafdrop读取模式注册表不工作,所以现在我想只安装一个容器与Kafka,Zoowatch,Kafdrop和模式注册表,即使一切都成功安装,模

  • 我有多个主题A、B和C,我正在使用Kafka Streams将它们扇形成主题X。主题A、B和C使用默认主题名称策略在模式注册表中注册为主题。流式传输非常愚蠢,因为它只是将消息扇形,而不确保它们符合注册表中的模式,但它会在消息中添加一个ORIGINAL_TOPIC_NAME标头以指示它来自主题A、B或C。 然后,我让Kafka消费者从主题X中消费。该主题未在模式注册表中注册。Kafka消费者是我使用

  • 我有一个Kafka主题,我想用AVRO数据(目前是JSON)来填充它。我知道“正确”的方法是使用模式注册表,但出于测试目的,我想让它在没有它的情况下工作。 因此,我将AVRO数据作为数组[字节]发送,而不是常规的Json对象: 模式是在每个数据中启动的;我如何使它与kafka-connect一起工作?kafka-connect配置目前表现出以下属性(数据作为json.gz文件写入s3),我想编写P

  • 我试图用函数编程(和spring cloud stream)转换来自输入主题的输入AVRO消息,并在输出主题上发布新消息。下面是我的转换函数: 我的spring boot应用程序是以这种方式声明的,并激活了模式注册表客户机: 谢谢你能给我带来的任何帮助。 视CG

  • 我试图从REST代理发布json模式,但遇到异常 curl-k-x post-h“content-type:application/vnd.schemaregistry.v1+json”--数据“{”schema“:”{“type”:“object”,“properties”:{“firstname”:{“type”:“string”},“lastname”:{“type”:“string”},“

  • 我使用的是Azure HDInsight的托管Apache Kafka解决方案,因为不幸的是Azure上没有托管汇流Kafka解决方案。是否可以运行汇合模式注册表并将其连接到HDInsight Apache Kafka集群的代理? 我希望只在单个VM上安装模式注册表,然后使用schema-registry.properties文件中的这一行,将其指向HDInsight集群的代理列表: kafkas