hbase-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Rabin Banerjee <dev.rabin.baner...@gmail.com>
Subject Re: How to set NameSpace while storing from Spark to HBase using saveAsNewAPIHadoopDataSet
Date Mon, 19 Dec 2016 12:38:07 GMT
Thanks , It worked !!

On Mon, Dec 19, 2016 at 5:55 PM, Dhaval Modi <dhavalmodi24@gmail.com> wrote:

>
> Replace <output_table_name> with "<namespace>:<output_table_name>"
>
> Regards,
> Dhaval Modi
>
> On 19 December 2016 at 13:10, Rabin Banerjee <dev.rabin.banerjee@gmail.com
> > 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 =&gt; {
>>   val conf = HBaseConfiguration.create()
>>   conf.set(TableOutputFormat.OUTPUT_TABLE, "stream_count")
>>   conf.set("hbase.zookeeper.quorum", "localhost:2181")
>>   conf.set("hbase.master", "localhost:60000");
>>   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
>>
>
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message