Cassandra Python驱动程序:强制使用单个节点 [英] Cassandra Python driver: force using a single node

查看:49
本文介绍了Cassandra Python驱动程序:强制使用单个节点的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否可以强制Python驱动程序连接到单个指定节点(而不与其他节点创建收集池和/或不识别令牌)?

Is it possible to force the Python driver to connect to a single specified node (and not create a collection pool with the other nodes and/or be token aware)?

在我的特定情况下,除了一台看到"两个网络的机器之外,我有两个彼此看不见的网络.

In my specific case, I have two distinct networks that can't see each other, except for one machine that "sees" both networks.

在某些情况下,我想从外部"网络连接到Cassandra,从而使用该特殊机器.我看到两个问题:我可以使该机器成为环的一部分,但不保存任何数据吗?是否可以强制Python驱动程序仅连接到该计算机?

In some cases I'd like to connect to Cassandra from the "outside" network, and thus using that special machine. I see two problems: can I make that machine part of the ring but not holding any data? Is it possible to force the Python driver to only connect to that machine?

推荐答案

是否可以强制Python驱动程序仅连接到该计算机?

Is it possible to force the Python driver to only connect to that machine?

将机器粘贴在其自己的数据中心中可以正常工作的同时,还有另一种也许更简单的解决方案.您可以使用白名单策略,并仅向其提供您希望与之通信的一个节点.

While sticking the machine in it's own datacenter would work there is another, and perhaps simpler solution. You could use a whitelist policy and only provide it the one node you wish to communicate with.

 cluster = Cluster(contact_points=contact_points, load_balancing_policy=WhiteListRoundRobinPolicy(contact_points))

通过这样做,您可以限制驱动程序并使它仅与一个节点接触.但是,我会警告您,如果该节点发生故障,您的应用程序也会发生故障,因为它无法与网络中的任何其他人进行通信.

By doing this you can restrict the the driver and have it only contact one node. I would warn you however that if that node goes down your application will go down, as it won't be able to talk to anyone else in the ring.

这篇关于Cassandra Python驱动程序:强制使用单个节点的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆