You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@spark.apache.org by Gary Zhao <ga...@gmail.com> on 2014/08/08 07:18:20 UTC

How to use spark-cassandra-connector in spark-shell?

Hello

Is it possible to use spark-cassandra-connector in spark-shell?

Thanks
Gary

Re: How to use spark-cassandra-connector in spark-shell?

Posted by Thomas Nieborowski <or...@gmail.com>.
near bottom:
http://tobert.github.io/post/2014-07-15-installing-cassandra-spark-stack.html



On Fri, Aug 8, 2014 at 2:00 AM, chutium <te...@gmail.com> wrote:

> try to add following jars in classpath
>
>
> xxx/cassandra-all-2.0.6.jar:xxx/cassandra-thrift-2.0.6.jar:xxx/libthrift-0.9.1.jar:xxx/cassandra-driver-spark_2.10-1.0.0-SNAPSHOT.jar:xxx/cassandra-java-driver-2.0.2/cassandra-driver-core-2.0.2.jar:xxx/cassandra-java-driver-2.0.2/cassandra-driver-dse-2.0.2.jar
>
> then in spark-shell
>
> import org.apache.spark.{SparkConf, SparkContext}
> val conf = new SparkConf(true).set("cassandra.connection.host",
> "your-cassandra-host")
> val sc = new SparkContext("local[1]", "cassandra-driver", conf)
> import com.datastax.driver.spark._
> sc.cassandraTable("db1", "table1").select("key").count
>
>
>
>
> --
> View this message in context:
> http://apache-spark-user-list.1001560.n3.nabble.com/How-to-use-spark-cassandra-connector-in-spark-shell-tp11757p11781.html
> Sent from the Apache Spark User List mailing list archive at Nabble.com.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@spark.apache.org
> For additional commands, e-mail: user-help@spark.apache.org
>
>


-- 
Thomas Nieborowski
510-207-7049 mobile
510-339-1716 home

Re: How to use spark-cassandra-connector in spark-shell?

Posted by chutium <te...@gmail.com>.
try to add following jars in classpath

xxx/cassandra-all-2.0.6.jar:xxx/cassandra-thrift-2.0.6.jar:xxx/libthrift-0.9.1.jar:xxx/cassandra-driver-spark_2.10-1.0.0-SNAPSHOT.jar:xxx/cassandra-java-driver-2.0.2/cassandra-driver-core-2.0.2.jar:xxx/cassandra-java-driver-2.0.2/cassandra-driver-dse-2.0.2.jar

then in spark-shell

import org.apache.spark.{SparkConf, SparkContext}
val conf = new SparkConf(true).set("cassandra.connection.host",
"your-cassandra-host")
val sc = new SparkContext("local[1]", "cassandra-driver", conf)
import com.datastax.driver.spark._
sc.cassandraTable("db1", "table1").select("key").count




--
View this message in context: http://apache-spark-user-list.1001560.n3.nabble.com/How-to-use-spark-cassandra-connector-in-spark-shell-tp11757p11781.html
Sent from the Apache Spark User List mailing list archive at Nabble.com.

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@spark.apache.org
For additional commands, e-mail: user-help@spark.apache.org


Re: How to use spark-cassandra-connector in spark-shell?

Posted by Andrew Ash <an...@andrewash.com>.
I don't remember the details, but I think it just took adding the
spark-cassandra-connector jar to the spark shell's classpath with --jars or
maybe ADD_JARS and then it worked.


On Thu, Aug 7, 2014 at 10:24 PM, Gary Zhao <ga...@gmail.com> wrote:

> Thanks Andrew. How did you do it?
>
>
> On Thu, Aug 7, 2014 at 10:20 PM, Andrew Ash <an...@andrewash.com> wrote:
>
>> Yes, I've done it before.
>>
>>
>> On Thu, Aug 7, 2014 at 10:18 PM, Gary Zhao <ga...@gmail.com> wrote:
>>
>>> Hello
>>>
>>> Is it possible to use spark-cassandra-connector in spark-shell?
>>>
>>>  Thanks
>>> Gary
>>>
>>
>>
>

Re: How to use spark-cassandra-connector in spark-shell?

Posted by Gary Zhao <ga...@gmail.com>.
Thanks Andrew. How did you do it?


On Thu, Aug 7, 2014 at 10:20 PM, Andrew Ash <an...@andrewash.com> wrote:

> Yes, I've done it before.
>
>
> On Thu, Aug 7, 2014 at 10:18 PM, Gary Zhao <ga...@gmail.com> wrote:
>
>> Hello
>>
>> Is it possible to use spark-cassandra-connector in spark-shell?
>>
>>  Thanks
>> Gary
>>
>
>

Re: How to use spark-cassandra-connector in spark-shell?

Posted by Andrew Ash <an...@andrewash.com>.
Yes, I've done it before.


On Thu, Aug 7, 2014 at 10:18 PM, Gary Zhao <ga...@gmail.com> wrote:

> Hello
>
> Is it possible to use spark-cassandra-connector in spark-shell?
>
> Thanks
> Gary
>