How to load Spark Cassandra Connector in the shell?

前端 未结 6 1442
长情又很酷
长情又很酷 2020-12-07 16:16

I am trying to use Spark Cassandra Connector in Spark 1.1.0.

I have successfully built the jar file from the master branch on GitHub and have gotten the included dem

6条回答
  •  予麋鹿
    予麋鹿 (楼主)
    2020-12-07 16:38

    To access Cassandra from the spark-shell, I've built an assembly out of the cassandra-spark-driver with all dependencies (an "uberjar"). Providing it to the spark-shell using the --jars option like this:

    spark-shell --jars spark-cassandra-assembly-1.0.0-SNAPSHOT-jar-with-dependencies.jar
    

    I was facing the same issue described here and this method is both simple and convenient (instead of loading the long list of dependencies)

    I've created a gist with the POM file that you can download. Using the pom to create the uberjar you should do:

    mvn package
    

    If you're using sbt, look into the sbt-assembly plugin.

提交回复
热议问题