简体   繁体   English

Datastax Java驱动程序可以自动发现其连接池中特定数据中心的所有节点?

[英]Datastax Java driver to autodiscover all the nodes for specific datacenter in its connection pool?

I have recently started using Cassandra in our Production environment . 我最近开始在我们的Production environment使用Cassandra We have a 24 node cluster with replication factor of 4 . 我们有一个24 node cluster ,其replication factor of 4 Meaning 2 copies will be there in each datacenter . 意思是each datacenter2 copies So that means we have a single cross colo cluster with 24 nodes which means 12 nodes in SLC colo and 12 nodes in PHX colo . 因此,这意味着我们有一个带有24 nodes交叉colo群集,这意味着12 nodes in SLC colo 12 nodes in PHX colo

I am using Astyanax client currently to write the data in Cassandra database . 我目前正在使用Astyanax client将数据写入Cassandra database And I know Astyanax client has this feature to autodiscover all the nodes in PHX colo or SLC colo of cassandra in its connection pooling but not all of the nodes. 而且我知道Astyanax客户端具有此功能,可以在其连接池中自动发现cassandra的PHX colo或SLC colo中的所有节点,而不是所有节点。

In Astyanax we can use something like below - 在Astyanax中,我们可以使用以下内容-

setLocalDatacenter("DC1")

Now we are planning to use Datastax Java driver. 现在,我们计划使用Datastax Java驱动程序。 And I am not sure whether Datastax java driver has this feature or not to autodiscover all the cassandra nodes in its connection pool only for specific datacenter and not all the datacenters? 而且我不确定Datastax Java驱动程序是否具有此功能,是否仅针对特定数据中心而不是并非所有数据中心自动发现其连接池中的所有cassandra节点?

The driver will discover all the nodes in your cluster, you want to change your load balancing policy in your client code. 驱动程序将发现群集中的所有节点,您想在客户端代码中更改负载平衡策略。 Specifically you want to use the dc aware load balancing policy. 具体来说,您想使用直流感知负载平衡策略。

http://www.datastax.com/drivers/java/apidocs/com/datastax/driver/core/policies/DCAwareRoundRobinPolicy.html http://www.datastax.com/drivers/java/apidocs/com/datastax/driver/core/policies/DCAwareRoundRobinPolicy.html

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM