This post explains - How to Build & Run Spark Cassandra Application. You can get the Spark Cassandra Sample Code from my this post. Please follow the step by step process to create and execute your Spark Cassandra application.
CREATE KEYSPACE Key\_Space WITH replication = {'class': 'SimpleStrategy', 'replication\_factor' : 1};
CREATE TABLE Key\_Space.Word\_Count\_table (
Word TEXT,
Word\_Count INT,
Timestamp TIMESTAMP
PRIMARY KEY(Word)
);
mkdir test-project // Can be any name
cd test-project // if you named it got-battles
mkdir src
mkdir src/main
mkdir src/main/scala
mkdir src/main/scala/com
mkdir src/main/scala/com/sparkcassprojet
mkdir project
name := "Spark-Cassandra-App"
version := "1.0"
scalaVersion := "2.11.8"
libraryDependencies ++= Seq(
"org.apache.spark" %% "spark-core" % "2.0.0" % "provided",
"org.apache.spark" %% "spark-streaming" % "2.0.0" % "provided",
"org.apache.spark" %% "spark-sql" % "2.0.0",
"com.datastax.spark" %% "spark-cassandra-connector" % "2.0.0-RC1",
"com.datastax.cassandra" % "cassandra-driver-core" % "3.0.0",
("org.apache.spark" %% "spark-streaming-kafka" % "1.6.0").
exclude("org.spark-project.spark", "unused")
)
For version compatibility , please refer - https://github.com/datastax/spark-cassandra-connector
**sbt assembly**
from command-line to produce a Spark deployable jar.
$ SPARK\_DIRECTORY/bin/spark-submit
--class "com.gankrin.AppSparkCassandra"
--master GIVE\_THE\_SPARK\_HOST\_NAME\_OR\_IP:PORT\_NO
/target/scala-2.11.8/Spark-Cassandra-App-assembly-1.0.jar
Hope this helps .