1

I want to store spark RDD to Cassandra table but it's not working. My RDD is in the form

{"id":"04bBGJpwUh","date":"2018-03-26 05:28:25","temp":37,"press":16}
{"id":"pi4Axn3iOd","date":"2018-03-26 05:28:27","temp":49,"press":17}

My cassandra table is

CREATE TABLE mydata.stations(id text primary key,date text,temp int,press int);

Can anyone please help me how to do it? I have tried few examples given but none of them is working.

Horia
  • 2,942
  • 7
  • 14
huny
  • 81
  • 2
  • 9
  • Can you please post what you've tried and describe how it's failing? – ernest_k Mar 28 '18 at 15:54
  • 1
    @ErnestKiwele I have tried val lines = KafkaUtils.createStream(ssc, "localhost:2181", "spark-streaming-consumer-group", Map("hello" -> 5)) val cass=sparkConf.set("spark.cassandra.connection.host","127.0.1.1") val data=lines.map(_._2) val ndata=data.map(Tuple1()) ndata.saveToCassandra("mydata","stations") data rdd is like {"id":"04bBGJpwUh","date":"2018-03-26 05:28:25","temp":37,"press":16} – huny Mar 28 '18 at 17:29
  • And nothing is updating in table. I have tried with SomeColumns as well – huny Mar 28 '18 at 17:32

0 Answers0