简体   繁体   English

使用Cassandra Ruby客户端连接到Cassandra节点集群

[英]Connecting to a cluster of cassandra nodes using Cassandra Ruby client

I am using Twitter's Cassandra client https://github.com/twitter/cassandra for my Ruby on Rails application. 我在我的Ruby on Rails应用程序中使用Twitter的Cassandra客户端https://github.com/twitter/cassandra

What's the best way to connect to a cluster vs a single node? 连接到群集而不是单个节点的最佳方法是什么? The getting started documentation has the following sample code: 入门文档具有以下示例代码:

client = Cassandra.new('Twitter', '127.0.0.1:9160')

That's fine and all in a single node setup, but what does a connection string look like when you have a cluster? 很好,并且所有操作都在单节点设置中进行,但是当您拥有集群时,连接字符串是什么样的? What if a node goes down, is the client smart enough to discontinue speaking to nodes that are up and running? 如果某个节点出现故障,客户端是否足够聪明,可以不与正在运行的节点对话?

Checking into the sourcecode, the initializer seems to accept an array of server:port strings 检入源代码后,初始化程序似乎接受一个server:port字符串数组

client = Cassandra.new('Twitter', ['127.0.0.1:9160', '127.0.0.1:9161', '127.0.0.1:9162'])

Not sure about Cassandras behavior, when a node dies 节点死亡时不确定Cassandras的行为

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

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