Bringing together the Apache Cassandra experts from the community and DataStax.

Want to learn? Have a question? Want to share your expertise? You are in the right place!

Not sure where to begin? Getting Started

 

question

Deepak avatar image
Deepak asked Erick Ramirez edited

Spark app returning "Unable to get Token Metadata" connecting to Cosmos DB

Hi

I am connecting to Cassandra cluster (Microsoft Azure) from my spark program using the "com.datastax.spark.spark-cassandra-connector-2.5.1" driver. However i am getting the below error in the executor and eventually everything stops

java.lang.IllegalArgumentException: Unable to get Token Metadata at com.datastax.spark.connector.cql.LocalNodeFirstLoadBalancingPolicy$$anonfun$tokenMap$1.apply(LocalNodeFirstLoadBalancingPolicy.scala:86) at com.datastax.spark.connector.cql.LocalNodeFirstLoadBalancingPolicy$$anonfun$tokenMap$1.apply(LocalNodeFirstLoadBalancingPolicy.scala:86) at scala.Option.orElse(Option.scala:289)

spark-cassandra-connectorcosmos dbunsupported
10 |1000 characters needed characters left characters exceeded

Up to 8 attachments (including images) can be used with a maximum of 1.0 MiB each and 10.0 MiB total.

1 Answer

Erick Ramirez avatar image
Erick Ramirez answered

That exception indicates that the embedded Java driver which the Spark connector uses is not able to connect to the cluster. As I understand it, Cosmos DB provides a CQL-like API to users but it isn't a full-fledged Apache Cassandra database and we don't test the Spark connector against it so I'm afraid we can't troubleshoot your problem.

If you need a managed Cassandra service running on the cloud, I'd suggest you try Astra DB instead. You can deploy a cluster on your choice of public clouds including Azure. Cheers!

Share
10 |1000 characters needed characters left characters exceeded

Up to 8 attachments (including images) can be used with a maximum of 1.0 MiB each and 10.0 MiB total.