Hi,
I am trying to fetch data from astradb into pyspark dataframe. However, I a getting errors in doing so.
Code:
df = spark.read.format("org.apache.spark.sql.cassandra")\ .options(table="emp", keyspace="kafka").load() display(df)
Error:
java.io.IOException: Failed to open native connection to Cassandra at {localhost:9042} :: Could not reach any contact point, make sure you've provided valid addresses (showing first 1 nodes, use getAllErrors() for more): Node(endPoint=localhost/127.0.0.1:9042, hostId=null, hashCode=286743cc): [com.datastax.oss.driver.api.core.connection.ConnectionInitException: [s0|control|connecting...] Protocol initialization request, step 1 (OPTIONS): failed to send request (com.datastax.oss.driver.shaded.netty.channel.StacklessClosedChannelException)]
I have installed com.datastax.spark:spark-cassandra-connector-assembly_2.12:3.2.0 in the libraries.
Also, in the cluster config, I have provided the below details:
spark.databricks.delta.preview.enabled true
spark.cassandra.auth.username <>
spark.cassandra.auth.password AstraCS:CO....
spark.files dbfs:/FileStore/tables/secure_connect_kafka.zip
Cluster config:
(includes Apache Spark 3.2.1, Scala 2.12)
Can you please help here?
Thanks
Narayana