0

I Recently started learning cassandra and going through online tutorials for cassandra with DataStax Java Drivers. I am simply trying to connect a localhost node on my laptop.

Setup Details -

OS - Windows 7

Cassandra Version - Cassandra version: 2.1-SNAPSHOT

DataStax java driver version - 3.1.0

I could able to connect to local node by using CQLSH and cassandra-cli clients. I can also see the default keyspace system and system_traces. Below is the cassandra server log

INFO  12:12:51 Node localhost/127.0.0.1 state jump to normal
INFO  12:12:51 Startup completed! Now serving reads.
INFO  12:12:51 Starting listening for CQL clients on /0.0.0.0:9042...
INFO  12:12:51 Binding thrift service to /0.0.0.0:9160
INFO  12:12:51 Using TFramedTransport with a max frame size of 15728640 bytes.
INFO  12:12:51 Using synchronous/threadpool thrift server on 0.0.0.0 : 9160
INFO  12:12:51 Listening for thrift clients...

I am trying below simple code -

        Cluster cluster = Cluster.builder().addContactPoint("127.0.0.1").build();
        Metadata metadata = cluster.getMetadata();

This code throws below exception - Part of the Trace

com.datastax.driver.core.exceptions.NoHostAvailableException: All host(s) tried for query failed (tried: /127.0.0.1:9042 (com.datastax.driver.core.exceptions.InvalidQueryException: unconfigured columnfamily schema_usertypes))
at com.datastax.driver.core.ControlConnection.reconnectInternal(ControlConnection.java:233)

I have been through all the previously asked question. Most of answers suggests changing the configuration in cassandra.yaml file.

My cassandra.yaml configuration is -

start_native_transport: true
native_transport_port: 9042
listen_address: localhost
rpc_address: 0.0.0.0
rpc_port: 9160

Most of the answers suggests to use actual IP address of machine at rpc_address, which I tried but did not worked.

Here are the Questions I been through - Question One, Question two ,Question three, Topic ,Connection requirement, Question four.

This page lists compatibility of Java DataStax drivers with cassandra versions, so I changed the driver version to 2.1.1 (As I am using cassandra 2.1), but it did not worked.

Please suggest what could be wrong.

Community
  • 1
  • 1
Gunwant
  • 949
  • 1
  • 14
  • 29

1 Answers1

1

The error with schema_usertypes seems like the driver is trying to look for a table that isn't there maybe related to this Jira.

You say you are running a 2.1-SNAPSHOT of Cassandra? Try Cassandra 2.1.15. Something seems off on your Cassandra node, the driver is able to talk to your cluster since it trys to look up data inside schema_usertypes.

Jeff Beck
  • 3,944
  • 3
  • 28
  • 45
  • Worked with Cassandra-2.1.15. Working with both versions of drivers - 3.1.0 and 2.1.1 – Gunwant Oct 15 '16 at 04:38
  • I have similar problem connecting to cluster spring.data.cassandra.contact-points=10.202.82.25,10.180.19.157,10.180.12.222......... getting error All host(s) tried for query failed (tried: localhost/0:0:0:0:0:0:0:1:9042 (com.datastax.driver.core.exceptions.TransportException: [localhost/0:0:0:0:0:0:0:1:9042] Cannot connect), localhost/127.0.0.1:9042 (com.datastax.driver.core.exceptions.TransportException: [localhost/127.0.0.1:9042] Cannot connect)) ...where am i getting this 127.0.0.1 host ? plz let me know what am i making wrong here ? – BdEngineer Sep 21 '18 at 10:27