【问题标题】:Unable to connect to Azure Event Hub using the Confluent .Net client无法使用 Confluent .Net 客户端连接到 Azure 事件中心
【发布时间】:2020-12-08 20:58:28
【问题描述】:

我正在尝试使用 Confluent .Net 客户端 (1.5.2) 连接到 Azure 事件中心,但我不断收到 SSL 握手失败错误。

我的 Confluent ProducerConfig 如下所示:

var config = new ProducerConfig
{
    BootstrapServers = "ehNamespace.servicebus.windows.net:9093",
    SecurityProtocol = SecurityProtocol.SaslSsl,
    SaslMechanism = SaslMechanism.Plain,
    SaslUsername = "$ConnectionString",
    SaslPassword = "Endpoint=sb://ehNamespace.servicebus.windows.net/;SharedAccessKeyName=accessKeyName;SharedAccessKey=accessKey;EntityPath=eventHubName",
    SslCaLocation = "cacert.pem",
    Debug = "security,broker,protocol"
};

当我构建 ProducerClient 时,由于 SSL 握手失败而无法连接:

%7|1607458909.957|SASL|rdkafka#producer-1| [thrd:app]: Selected provider PLAIN (builtin) for SASL mechanism PLAIN
%7|1607458909.958|OPENSSL|rdkafka#producer-1| [thrd:app]: librdkafka built with OpenSSL version 0x1000211f
%7|1607458910.231|SSL|rdkafka#producer-1| [thrd:app]: Loading CA certificate(s) from file cacert.pem
%7|1607458910.241|BRKMAIN|rdkafka#producer-1| [thrd::0/internal]: :0/internal: Enter main broker thread
%7|1607458910.241|BROKER|rdkafka#producer-1| [thrd:app]: sasl_ssl://ehNamespace.servicebus.windows.net:9093/bootstrap: Added new broker with NodeId -1
%7|1607458910.242|CONNECT|rdkafka#producer-1| [thrd:app]: sasl_ssl://ehNamespace.servicebus.windows.net:9093/bootstrap: Selected for cluster connection: bootstrap servers added (broker has 0 connection attempt(s))
%7|1607458910.242|BRKMAIN|rdkafka#producer-1| [thrd:sasl_ssl://ehNamespace.servicebus.windows.net:9093/bootstrap]: sasl_ssl://ehNamespace.servicebus.windows.net:9093/bootstrap: Enter main broker thread
%7|1607458910.242|INIT|rdkafka#producer-1| [thrd:app]: librdkafka v1.5.2 (0x10502ff) rdkafka#producer-1 initialized (builtin.features gzip,snappy,ssl,sasl,regex,lz4,sasl_gssapi,sasl_plain,sasl_scram,plugins,zstd,sasl_oauthbearer, SSL ZLIB SNAPPY SASL_SCRAM PLUGINS HDRHISTOGRAM, debug 0x282)
%7|1607458910.242|CONNECT|rdkafka#producer-1| [thrd:sasl_ssl://ehNamespace.servicebus.windows.net:9093/bootstrap]: sasl_ssl://ehNamespace.servicebus.windows.net:9093/bootstrap: Received CONNECT op
%7|1607458910.243|STATE|rdkafka#producer-1| [thrd:sasl_ssl://ehNamespace.servicebus.windows.net:9093/bootstrap]: sasl_ssl://ehNamespace.servicebus.windows.net:9093/bootstrap: Broker changed state INIT -> TRY_CONNECT
%7|1607458910.243|CONNECT|rdkafka#producer-1| [thrd:sasl_ssl://ehNamespace.servicebus.windows.net:9093/bootstrap]: sasl_ssl://ehNamespace.servicebus.windows.net:9093/bootstrap: broker in state TRY_CONNECT connecting
%7|1607458910.243|STATE|rdkafka#producer-1| [thrd:sasl_ssl://ehNamespace.servicebus.windows.net:9093/bootstrap]: sasl_ssl://ehNamespace.servicebus.windows.net:9093/bootstrap: Broker changed state TRY_CONNECT -> CONNECT
%7|1607458910.273|CONNECT|rdkafka#producer-1| [thrd:sasl_ssl://ehNamespace.servicebus.windows.net:9093/bootstrap]: sasl_ssl://ehNamespace.servicebus.windows.net:9093/bootstrap: Connecting to ipv4#40.71.10.149:9093 (sasl_ssl) with socket 1168
%7|1607458910.297|CONNECT|rdkafka#producer-1| [thrd:sasl_ssl://ehNamespace.servicebus.windows.net:9093/bootstrap]: sasl_ssl://ehNamespace.servicebus.windows.net:9093/bootstrap: Connected to ipv4#40.71.10.149:9093
%7|1607458910.327|FAIL|rdkafka#producer-1| [thrd:sasl_ssl://ehNamespace.servicebus.windows.net:9093/bootstrap]: sasl_ssl://ehNamespace.servicebus.windows.net:9093/bootstrap: SSL handshake failed: SSL transport error: Unknown error (after 84ms in state CONNECT) (_SSL)
%3|1607458910.327|FAIL|rdkafka#producer-1| [thrd:sasl_ssl://ehNamespace.servicebus.windows.net:9093/bootstrap]: sasl_ssl://ehNamespace.servicebus.windows.net:9093/bootstrap: SSL handshake failed: SSL transport error: Unknown error (after 84ms in state CONNECT)
%7|1607458910.329|STATE|rdkafka#producer-1| [thrd:sasl_ssl://ehNamespace.servicebus.windows.net:9093/bootstrap]: sasl_ssl://ehNamespace.servicebus.windows.net:9093/bootstrap: Broker changed state CONNECT -> DOWN
%3|1607458910.330|ERROR|rdkafka#producer-1| [thrd:sasl_ssl://ehNamespace.servicebus.windows.net:9093/bootstrap]: 1/1 brokers are down

我已经用两个不同的事件中心尝试过这个,但没有成功。有人可以帮我理解为什么会失败以及我可以做些什么来让它工作吗?

谢谢!

【问题讨论】:

  • 您可以尝试从连接字符串中删除 entityPath 吗?
  • 删除 EntityPath 会产生相同的 SSL 错误。
  • @C.Wheeler,您可以尝试使用命名空间级别的连接字符串吗?我正在使用stand tier eventthub,并没有看到这样的错误。
  • 请尝试关注这篇文章,github.com/dbarkol/functions-eventhubs-kafka,它可能对你有用。
  • @IvanYang,删除 EntityPath 仍然会导致 SSL 失败,这表明这不是身份验证问题,而是较低级别的 SSL 连接问题。问题是:我不知道如何进一步解决这个问题并解决它。

标签: c# azure apache-kafka azure-eventhub confluent-kafka-dotnet


【解决方案1】:

你好,你试试这个链接https://github.com/Azure/azure-event-hubs-for-kafka/tree/master/quickstart/dotnet 还要确保您的连接字符串处于命名空间级别(如果您的连接字符串以“EntityPath=”结尾,那么它是一个 EventHub 级别的连接字符串并且将不起作用)并确保您的主题名称是事件中心的名称存在于您的命名空间中

【讨论】:

    猜你喜欢
    • 2017-08-03
    • 1970-01-01
    • 1970-01-01
    • 2020-01-27
    • 1970-01-01
    • 2012-03-06
    • 2017-10-27
    • 2013-06-06
    • 2022-10-20
    相关资源
    最近更新 更多