python cassandra驱动程序:尝试重新连接时出错
我使用python cassandra驱动程序,cassandra集群位于AWS。 远程连接时会出现很多警告。有人有同样的问题吗 进口卡桑德拉 从cassandra.cluster导入集群 ... 在[3]中:卡桑德拉。版本 Out[3]:'2.5.1'python cassandra驱动程序:尝试重新连接时出错,cassandra,Cassandra,我使用python cassandra驱动程序,cassandra集群位于AWS。 远程连接时会出现很多警告。有人有同样的问题吗 进口卡桑德拉 从cassandra.cluster导入集群 ... 在[3]中:卡桑德拉。版本 Out[3]:'2.5.1' 警告:cassandra.pool:尝试重新连接到172.31.24.108时出错,计划在128.0秒后重试:连接到172.31.24.108时超时我认为这是因为您无法直接连接到172.31.24.108(专用网络?)。在我的情况下,我只能连接
警告:cassandra.pool:尝试重新连接到172.31.24.108时出错,计划在128.0秒后重试:连接到172.31.24.108时超时我认为这是因为您无法直接连接到172.31.24.108(专用网络?)。在我的情况下,我只能连接到部分群集节点。 因此,我要做的是遵循的文档并创建自己的过滤器
from cassandra.policies import HostFilterPolicy, RoundRobinPolicy
CONN_HOSTS = ['172.235.33.32', '172.235.32.155']
whitelist_filter_policy = HostFilterPolicy(
child_policy=RoundRobinPolicy(),
predicate=lambda host: host.address in CONN_HOSTS)
# ...
cluster = Cluster(
contact_points=CONN_HOSTS,
load_balancing_policy=whitelist_filter_policy,
cql_version="3.2.1",
protocol_version=3,
ssl_options=ssl_options,
port=9042,
auth_provider=auth_provider)