Re: How to set NameSpace while storing from Spark to HBase using saveAsNewAPIHadoopDataSet

2016-12-19 Thread Rabin Banerjee
Thanks , It worked !!

On Mon, Dec 19, 2016 at 5:55 PM, Dhaval Modi  wrote:

>
> Replace  with ":"
>
> Regards,
> Dhaval Modi
>
> On 19 December 2016 at 13:10, Rabin Banerjee  > wrote:
>
>> HI All,
>>
>>   I am trying to save data from Spark into HBase using saveHadoopDataSet
>> API . Please refer the below code . Code is working fine .But the table is
>> getting stored in the default namespace.how to set the NameSpace in the
>> below code?
>>
>>
>>
>>
>> wordCounts.foreachRDD ( rdd => {
>>   val conf = HBaseConfiguration.create()
>>   conf.set(TableOutputFormat.OUTPUT_TABLE, "stream_count")
>>   conf.set("hbase.zookeeper.quorum", "localhost:2181")
>>   conf.set("hbase.master", "localhost:6");
>>   conf.set("hbase.rootdir", "file:///tmp/hbase")
>>
>>   val jobConf = new Configuration(conf)
>>   jobConf.set("mapreduce.job.output.key.class", classOf[Text].getName)
>>   jobConf.set("mapreduce.job.output.value.class", classOf[LongWritable].
>> getName)
>>   jobConf.set("mapreduce.outputformat.class", classOf[TableOutputFormat[
>> Text]].getName)
>>
>>   rdd.saveAsNewAPIHadoopDataset(jobConf)
>> })
>>
>> Regards,
>> R Banerjee
>>
>
>


Re: How to set NameSpace while storing from Spark to HBase using saveAsNewAPIHadoopDataSet

2016-12-19 Thread Dhaval Modi
Replace  with ":"

Regards,
Dhaval Modi

On 19 December 2016 at 13:10, Rabin Banerjee 
wrote:

> HI All,
>
>   I am trying to save data from Spark into HBase using saveHadoopDataSet
> API . Please refer the below code . Code is working fine .But the table is
> getting stored in the default namespace.how to set the NameSpace in the
> below code?
>
>
>
>
> wordCounts.foreachRDD ( rdd => {
>   val conf = HBaseConfiguration.create()
>   conf.set(TableOutputFormat.OUTPUT_TABLE, "stream_count")
>   conf.set("hbase.zookeeper.quorum", "localhost:2181")
>   conf.set("hbase.master", "localhost:6");
>   conf.set("hbase.rootdir", "file:///tmp/hbase")
>
>   val jobConf = new Configuration(conf)
>   jobConf.set("mapreduce.job.output.key.class", classOf[Text].getName)
>   jobConf.set("mapreduce.job.output.value.class", classOf[LongWritable].
> getName)
>   jobConf.set("mapreduce.outputformat.class", classOf[TableOutputFormat[
> Text]].getName)
>
>   rdd.saveAsNewAPIHadoopDataset(jobConf)
> })
>
> Regards,
> R Banerjee
>


How to set NameSpace while storing from Spark to HBase using saveAsNewAPIHadoopDataSet

2016-12-19 Thread Rabin Banerjee
HI All,

  I am trying to save data from Spark into HBase using saveHadoopDataSet
API . Please refer the below code . Code is working fine .But the table is
getting stored in the default namespace.how to set the NameSpace in the
below code?




wordCounts.foreachRDD ( rdd => {
  val conf = HBaseConfiguration.create()
  conf.set(TableOutputFormat.OUTPUT_TABLE, "stream_count")
  conf.set("hbase.zookeeper.quorum", "localhost:2181")
  conf.set("hbase.master", "localhost:6");
  conf.set("hbase.rootdir", "file:///tmp/hbase")

  val jobConf = new Configuration(conf)
  jobConf.set("mapreduce.job.output.key.class", classOf[Text].getName)
  jobConf.set("mapreduce.job.output.value.class", classOf[LongWritable].
getName)
  jobConf.set("mapreduce.outputformat.class", classOf[TableOutputFormat[Text
]].getName)

  rdd.saveAsNewAPIHadoopDataset(jobConf)
})

Regards,
R Banerjee