Create a simple keyspace and table in Cassandra. Run the following statements in cqlsh
:
CREATE KEYSPACE spark_cassandra_test WITH replication = {'class': 'SimpleStrategy', 'replication_factor': 1 };
CREATE TABLE spark_cassandra_test.kv(key text PRIMARY KEY, value int);
Then insert some example data:
INSERT INTO spark_cassandra_test.kv(key, value) VALUES ('key1', 1);
INSERT INTO spark_cassandra_test.kv(key, value) VALUES ('key2', 2);
clean compile assembly:single
$SPARK_HOME/bin/spark-submit --verbose --class com.fuhu.server.test.spark.spark.cassandra.App /where/your/jar/spark-cassandra-0.0.1-SNAPSHOT-jar-with-dependencies.jar