Hi, all

I wrote a program to get HBaseConfiguration object in Spark. But after I 
printed the content of this hbase-conf object, I found they were wrong. For 
example, the property "hbase.zookeeper.quorum" should be 
"bgdt01.dev.hrb,bgdt02.dev.hrb,bgdt03.hrb". But the printed value is 
"localhost".

Could anybody tell me how to set up the HBase Configuration in Spark? No matter 
it should be set in a configuration file or be set by a Spark API.  Many Thanks!

The code of my program is listed below:
object TestHBaseConf {
 def main(args: Array[String]) {
   val conf = new SparkConf()
   val sc = new SparkContext(conf)
   val hbConf = HBaseConfiguration.create()
   hbConf.addResource("""file:///etc/hbase/conf/hbase-site.xml""")
   val it = hbConf.iterator()
   while(it.hasNext) {
     val e = it.next()
     println("Key="+ e.getKey +" Value="+e.getValue)
   }

   val rdd = sc.parallelize(Array(1,2,3,4,5,6,7,8,9))
   val result = rdd.sum()
   println("result="+result)
   sc.stop()
 }
}

Reply via email to