【问题标题】:Protocol error when executing cpp-driver datastax执行 cpp-driver datastax 时出现协议错误
【发布时间】:2020-07-29 17:09:55
【问题描述】:

我目前正在研究 C 中的 datastax cpp-driver,并且在遇到一个非常微不足道的问题时正在解决一些示例。在尝试在这里执行Basic Authentication Script 时,我发现此错误出现并且代码执行卡住了。

错误:

1587040775.210 [ERROR] (cluster_connector.cpp:192:void datastax::internal::core::ClusterConnector::on_connect(datastax::internal::core::ControlConnector*)): Unable to establish a control connection to host 127.0.0.3 because of the following error: Underlying connection error: Connect error 'connection refused'
1587040775.210 [ERROR] (cluster_connector.cpp:192:void datastax::internal::core::ClusterConnector::on_connect(datastax::internal::core::ControlConnector*)): Unable to establish a control connection to host 127.0.0.2 because of the following error: Underlying connection error: Connect error 'connection refused'
1587040775.211 [ERROR] (cluster_connector.cpp:192:void datastax::internal::core::ClusterConnector::on_connect(datastax::internal::core::ControlConnector*)): Unable to establish a control connection to host 127.0.0.1 because of the following error: Underlying connection error: Received error response 'Invalid or unsupported protocol version (66); supported versions are (3/v3, 4/v4, 5/v5-beta)' (0x0200000A)
1587040775.211 [WARN] (cluster_connector.cpp:289:void datastax::internal::core::ClusterConnector::on_connect(datastax::internal::core::ControlConnector*)): Host 127.0.0.1 does not support protocol version DSEv2. Trying protocol version DSEv1...
1587040775.212 [ERROR] (cluster_connector.cpp:192:void datastax::internal::core::ClusterConnector::on_connect(datastax::internal::core::ControlConnector*)): Unable to establish a control connection to host 127.0.0.1 because of the following error: Underlying connection error: Received error response 'Invalid or unsupported protocol version (65); supported versions are (3/v3, 4/v4, 5/v5-beta)' (0x0200000A)
1587040775.212 [WARN] (cluster_connector.cpp:289:void datastax::internal::core::ClusterConnector::on_connect(datastax::internal::core::ControlConnector*)): Host 127.0.0.1 does not support protocol version DSEv1. Trying protocol version v4...

我的机器不支持哪些协议?此外,在到达最后一个警告trying protocol v4 之后,它就会卡住。 我正在使用 Casssandra 3.10+,Cpp-driver 2.13。

任何有解决方法或解决方案的人都会有很大帮助。提前致谢

【问题讨论】:

  • 错误消息似乎足够冗长和连续(Unable to establish a control connection to host 127.0.0.3 because of the following error: Underlying connection error: Connect error 'connection refused' 字面解释是您无法连接。确保您引用了正确的地址,并传递了正确的凭据,并有足够的权限获得连接。
  • @ryyker 好的,所以看起来我们在这里有点不确定。我已经提供了所用脚本的链接。如您所见,它已经在使用 localhost 进行连接。这正是我正在做的。此外,凭据是正确的,一切都是正确的。我猜你没有阅读整个错误。后来它说这里有一个不受支持的协议问题。到没有拒绝连接又名127.0.0.1 的主机。如果连接被拒绝是我的问题,我就不会在标题中写一个微不足道的错误和协议错误,先生。

标签: c cassandra datastax


【解决方案1】:

我查看了一堆文档来支持这一点,但我找不到任何文档,所以这部分是推测性的。似乎服务器版本 3 使用协议 V3。看起来服务器版本 4(仍处于测试阶段)将使用协议 V4。我怀疑 V5 是一个正在计划中的未来迭代,但还没有一成不变(以及为什么它在警告中被标记为 beta)。

这部分不是推测。 如果在连接到集群之前将其添加到代码中:

cass_cluster_set_protocol_version(cluster, CASS_PROTOCOL_VERSION_V3);

所有关于降级到不同协议的警告都应该消失。

【讨论】:

  • 有效!默认情况下,驱动程序似乎使用 CASS_PROTOCOL_VERSION_DSEV1 = 0x41 和 CASS_PROTOCOL_VERSION_DSEV2 = 0x42,即:“仅在将 DSE 驱动程序与 DataStax Enterprise 一起使用时才支持”
猜你喜欢
  • 2014-08-25
  • 1970-01-01
  • 1970-01-01
  • 2020-06-03
  • 2013-09-12
  • 1970-01-01
  • 2013-04-14
  • 2019-05-08
  • 1970-01-01
相关资源
最近更新 更多