Connecting to Casandra from remote machine

May 27, 2016 6.4k views
DigitalOcean Articles One-Click Install Apps DigitalOcean NoSQL

Hi All,

I want to ask for your help on how i can connect to my cassandra DB on my droplet from remote machine. I did everything that is written in this article: Install Cassandra but when I try to connect from my C# code:

            cluster = Cassandra.Cluster.Builder().WithCredentials("abc", "abc")
             .AddContactPoints(new[] { "12.34.56.78" })
             .WithPort(9168)
             .Build();

            var session = cluster.Connect();
            var keyspace = "Test";
            session.CreateKeyspaceIfNotExists(keyspace);
            session.ChangeKeyspace(keyspace);

I'm getting-> Exception thrown: 'Cassandra.NoHostAvailableException' in Cassandra.dll

Additional information: None of the hosts tried for query are available (tried: 12.34.56.78:9168)

I also tried from other Cassandra GUI Clients like DBeaver but I;m getting the same error.

My Droplet is Ubuntu 14.04. From localhost I have no problem with Casandra my only problem is from remote.

Thank you in advance.

2 Answers

Hi @fstafai,

It sounds like either your local droplet firewall rules, or your cassandra configuration are blocking this. The easiest way to check is to look in your cassandra configuration for the listenaddress, or listeninterface directives (as described in : https://docs.datastax.com/en/cassandra/2.1/cassandra/configuration/configCassandra_yaml_r.html) and confirm that it's listening on the right interface, and the right address.

Not ready to Connect to a Cassandra Remote Server? Contact to Cassandra Database Consulting and Support *

The capacities of Cassandra database are astonishing in light of the fact that Cassandra can deal with vast measure of database with no multifaceted nature. In the mean time we get loads of inquiries and issues in regards to those clients who face issue with respect to Cassandra remote server since they are not ready to associate with Cassandra remote server. To dispose of these specialized hiccups we give full help by means of Cognegic's Cassandra Technical Support or Cassandra Database Support. Get in touch with us through this number 1-800-450-8670 and settle everything Cassandra related issues.
*For More Info: https://cognegicsystems.com/
Contact Number: 1-800-450-8670
Email Address- info@cognegicsystems.com
Company’s Address- 507 Copper Square Drive Bethel Connecticut (USA) 06801
*

Have another answer? Share your knowledge.