我是cassandra的新手所以我跟着this guide关于如何让Cassandra在EC2实例上设置。我已经把它全部设置好并准备好了但是由于某种原因我无法从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
答案 0 :(得分:1)
连接到Cassandra服务器的“源”在哪里?
您使用的安全组只会打开端口9160到 sg-xxxxxxxx 组中的实例。如果您尝试从其他任何地方(如外部世界)进行连接,您将无法成功。
答案 1 :(得分:0)
有两件事需要检查: