1
Failed to connect to the Cassandra cluster: Could not reach any contact point, \
  make sure you've provided valid addresses (showing first 1 nodes, use getAllErrors() for more): \
  Node(endPoint=/192.168.60.24:9042, hostId=null, hashCode=2b19536d): \
  [com.datastax.oss.driver.api.core.connection.ConnectionInitException: \
  [s0|control|connecting...] Protocol initialization request, step 1 (OPTIONS): failed to send request

i have test with postman tool to connect with cassandra with springboot Method. But i'm unable to connect. this is the url i'm trying from postman: http://localhost:8080/migration/test/cassandra?cassandraHost=localhost&cassandraUsername=cassandra&cassandraPassword=cassandra

Erick Ramirez
  • 13,964
  • 1
  • 18
  • 23
Balaji4you
  • 21
  • 1

2 Answers2

0

It appears your driver cannot connect to Cassandra at all. If everything is configured correctly, start by checking the network to ensure you have a route to the host you are connecting to. Also check to see if client encryption is enabled in Cassandra and if you need this for the driver. Ensure Cassandra is listening on port 9042 as well. If you can't get it working, show your driver config.

Paul
  • 351
  • 1
  • 5
  • assuming that cassandraHost is set to 192.168.60.24, this seems fine Can you telnet or nc to port 9042 from your driver host and get connectivity? – Paul Apr 27 '23 at 14:03
  • i can able to connect cassandra cluster on my local machine: WARNING: console codepage must be set to cp65001 to support utf-8 encoding on Windows platforms. If you experience encoding problems, change your console codepage with 'chcp 65001' before starting cqlsh. Connected to Test Cluster at 192.168.60.24:9042. – Balaji4you Apr 27 '23 at 14:35
  • If you have connectivity, then what version of Cassandra and what driver version are in use? are they compatible? Do you have client auth set up in Cassandra? do you use authorization? is the user/password correct? Does the user have permission to connect? – Paul Apr 27 '23 at 14:53
0

The error you posted indicates that the Cassandra Java driver used by your Spring Boot app is unable to reach the Cassandra node on IP 192.168.60.24 on CQL client port 9042.

You need to verify the following:

  1. Cassandra is running.
  2. Cassandra is listening for client connections on IP 192.168.60.24 and port 9042.
  3. There is network connectivity between your app and the Cassandra node(s).

One thing I noted is that you've specified the Cassandra host as localhost in your Postman URL --

http://localhost:8080/migration/test/cassandra?cassandraHost=localhost&cassandraUsername=cassandra&cassandraPassword=cassandra

If the C* instance is listening for connections on 192.168.60.24, you cannot use localhost (127.0.0.1). You need to instead use 192.168.60.24. Cheers!

Erick Ramirez
  • 13,964
  • 1
  • 18
  • 23