I am new to cassandra so I followed this guide on how to get Cassandra set up on an EC2 instance. I have gotten it all set up and ready to go but for some reason I'm not able to connect from ruby. Here is what I have been trying:
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
# }
# >
Then when I tried to use the client, I get this error:
client.keyspaces
#=> ThriftClient::NoServersAvailable: No live servers in [ec2-xx-xx-xxx-xxx.compute-1.amazonaws.com:9160].
I am able to connect via SSH so I'm not sure what I'm doing wrong here.
Update:
My security group includes:
port: 9160
protocol: tcp
source: sg-xxxxxxxx
Where is the "source" of the connection into the Cassandra server?
The security group you are using only opens up port 9160 to instances in the group sg-xxxxxxxx . If you are trying to connect from anywhere else (like the outside world) you will not be successful.
There are two things to check:
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.