1

After few self tests, I thought I'm having a telnet problem. So I am recreating a shorter version of this question

I have two machines:

  1. cassandra is running on one machine using IP 172.17.1.XX.
  2. ???

My java program is:

 public static void main(String a[])
 {
   System.out.println("I am in");
   Client client = new Client();
   client.connect("172.17.1.XX");
   client.close();
 }

 public static void connect(String node)
 {
    cluster = Cluster.builder().addContactPoint(node).withPort(9160).build();
    Metadata metadata = cluster.getMetadata();
 }

If I run this program in the cassandra machine, it works. If I run the same program from my second machine, the output is:

Exception in thread "main" com.datastax.driver.core.exceptions.NoHostAvailableException: 
All host(s) tried for query failed (tried: /172.17.1.XX:9160 (com.datastax.driver.core.TransportException: [/172.17.1.XX:9160] Cannot connect)) 
at com.datastax.driver.core.ControlConnection.reconnectInternal(ControlConnection.java:196) 
at com.datastax.driver.core.ControlConnection.connect(ControlConnection.java:80)
at com.datastax.driver.core.Cluster$Manager.init(Cluster.java:1145)
at com.datastax.driver.core.Cluster.getMetadata(Cluster.java:313)
at com.example.cassandra.Client.connect(Client.java:18)
at com.example.cassandra.Client.main(Client.java:74)

Using netstat -plten on the cassandra machine returns

`9160 port is open for all. 0.0.0.0:9160`

If I use: telnet 172.17.1.XX 9160 ???on what machine??? and type something and hit enter, the output is:

Connection closed by foreign agent

I tried the same telnet in the cassandra system with ip and localhost, i am getting the same behaviour.

telnet localhost 9160

accepts 3 inputs and says connection closed by foreign agent whereas ip accepts only two inputs. What is it?

I have three questions:

  1. Why am I getting this error?
  2. Does cassandra not a service which accepts data from telnet?
  3. How do I solve this?
  • Welcome to Ask Ubuntu! ;-) We're sorry but Ask Ubuntu is not a forum but a Question&Answer site: It works best if you ask one question, so you can receive one answer. When you ask multiple questions, you need to find one expert versed in multiple areas which becomes more unlikely the more questions you put into... well, one question! ;-) So please, split up your question into multiple questions and drop me a comment so I can answer one of your questions. – Fabby Mar 4 '15 at 12:44
  • Very complicated question, will try it later. – Faizan Akram Dar Mar 4 '15 at 13:06
  • Are you guys kidding me? If so, i 'll delete the qs @ubuntu99 and Fabby thanks for your comment. What is ??? in your edit means? Another machine is for checking purpose where no process related to cassandra is running – Gops AB Mar 4 '15 at 13:37

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Browse other questions tagged or ask your own question.