问题描述
参考Github上 Event Hub的示例代码(Using Apache Flink with Event Hubs for Apache Kafka Ecosystems : https://github.com/Azure/azure-event-hubs-for-kafka/tree/master/tutorials/flink),使用Apache Flink kafka连接中国区的Azure Event Hub,遇到 Kafka error: No resolvable bootstrap urls
kafkashaded.org.apache.kafka.common.KafkaException: Failed to construct kafka consumer
Caused by: kafkashaded.org.apache.kafka.common.config.ConfigException: No resolvable bootstrap urls given in bootstrap.servers
根据文档只修改了下图中红色标记的部分:
问题解答
根据错误消息,知道是 bootstrap servers url 的配置错误,bootstrap.servers=mynamespace.servicebus.windows.net:9093, 因为Github上的示例代码以Global Azure的Event Hub服务的终结点为例,而当前使用的是中国区的Azure Event Hub。中国区正确的 Endpoint 为: bootstrap.servers=mynamespace. servicebus.chinacloudapi.cn:9093
This error message occurs when an invalid hostname or IP address is passed to the
kafka.bootstrap.servers
configuration, The Kafka bootstrap server is not running at the given hostname or IP address.
参考资料
Using Apache Flink with Event Hubs for Apache Kafka Ecosystems : https://github.com/Azure/azure-event-hubs-for-kafka/tree/master/tutorials/flink
Kafka error: No resolvable bootstrap urls:https://learn.microsoft.com/en-us/azure/databricks/kb/streaming/kafka-no-resolvable-bootstrap-urls