我是 cassandra 的新手,所以我按照本指南了解如何在 EC2 实例上设置 Cassandra。我已经把它全部设置好并准备好了,但由于某种原因我无法从 ruby 连接。这是我一直在尝试的:
require 'cassandra'
client = Cassandra.new('PERSON', 'ec2-xx-xx-xxx-xxx.compute-1.amazonaws.com:9160')
# =>
# <Cassandra:0x100cda3b0
# @auto_discover_nodes = true,
# @column_name_class = {},
# @column_name_maker = {},
# @is_super = {},
# @sub_column_name_class = {},
# @sub_column_name_maker = {},
# attr_accessor :keyspace = "PERSON",
# attr_reader :servers = [
# [0] "ec2-xx-xx-xxx-xxx.compute-1.amazonaws.com:9160"
# ],
# attr_reader :thrift_client_class = ThriftClient < AbstractThriftClient,
# attr_reader :thrift_client_options = {
# :transport_wrapper => Thrift::FramedTransport < Thrift::BaseTransport,
# :thrift_client_class => ThriftClient < AbstractThriftClient,
# :protocol => Thrift::BinaryProtocolAccelerated < Thrift::BinaryProtocol
# }
# >
然后,当我尝试使用客户端时,出现此错误:
client.keyspaces
#=> ThriftClient::NoServersAvailable: No live servers in [ec2-xx-xx-xxx-xxx.compute-1.amazonaws.com:9160].
我可以通过 SSH 连接,所以我不确定我在这里做错了什么。
更新:
我的安全组包括:
端口:9160
协议:tcp
来源:sg-xxxxxxxx