<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>question Re: Getting error while trying to connect HBase using spark. in Archives of Support Questions (Read Only)</title>
    <link>https://community.cloudera.com/t5/Archives-of-Support-Questions/Getting-error-while-trying-to-connect-HBase-using-spark/m-p/175487#M80129</link>
    <description>&lt;P&gt;&lt;A rel="user" href="https://community.cloudera.com/users/59157/karthiknedunchezhiyan1997.html" nodeid="59157"&gt;@karthik nedunchezhiyan&lt;/A&gt; I have attached hbase-site.xml, I hope it helps.&lt;/P&gt;</description>
    <pubDate>Mon, 02 Jul 2018 14:56:27 GMT</pubDate>
    <dc:creator>contactvivekjai</dc:creator>
    <dc:date>2018-07-02T14:56:27Z</dc:date>
    <item>
      <title>Getting error while trying to connect HBase using spark.</title>
      <link>https://community.cloudera.com/t5/Archives-of-Support-Questions/Getting-error-while-trying-to-connect-HBase-using-spark/m-p/175485#M80127</link>
      <description>&lt;P&gt;Hi Community,&lt;/P&gt;&lt;P&gt;I'm new to spark and have been struggling to execute a spark job which connects to a HBase table.&lt;/P&gt;&lt;P&gt;In YARN GUI I can see the spark job is getting to state Running but then it fails with below error :&lt;/P&gt;&lt;PRE&gt;18/07/01 21:08:20 INFO ZooKeeper: Initiating client connection, connectString=localhost:2181 sessionTimeout=90000 watcher=hconnection-0x6a8bcb640x0, quorum=localhost:2181, baseZNode=/hbase 18/07/01 21:08:20 INFO ClientCnxn: Opening socket connection to server localhost.localdomain/127.0.0.1:2181. Will not attempt to authenticate using SASL (unknown error) 18/07/01 21:08:20 WARN ClientCnxn: Session 0x0 for server null, unexpected error, closing socket connection and attempting reconnect java.net.ConnectException: Connection refused at sun.nio.ch.SocketChannelImpl.checkConnect(Native Method) at sun.nio.ch.SocketChannelImpl.finishConnect(SocketChannelImpl.java:717) at org.apache.zookeeper.ClientCnxnSocketNIO.doTransport(ClientCnxnSocketNIO.java:361) at org.apache.zookeeper.ClientCnxn$SendThread.run(ClientCnxn.java:1125) 18/07/01 21:08:20 WARN RecoverableZooKeeper: Possibly transient ZooKeeper, quorum=localhost:2181, exception=org.apache.zookeeper.KeeperException$ConnectionLossException: KeeperErrorCode = ConnectionLoss for /hbase/hbaseid&lt;/PRE&gt;&lt;P&gt;ZooKeeper is up and running. Below is my code &lt;/P&gt;&lt;PRE&gt;//Create table catalog
object foo {
  def catalog = s"""{
         |"table":{"namespace":"foo", "name":"bar"},
         |"rowkey":"key",
         |"columns":{
           |"col0":{"col":"key", "type":"string"},
           |"col1":{"cf":"data", "col":"id", "type":"bigint"}
         |}
       |} "" ". stripMargin

  def main(args: Array[String]) {
     val spark = SparkSession.builder()
      .appName("foo")
      .getOrCreate()
    choose sc = kick.sparkContext
    val sqlContext = spark.sqlContext
    
    import sqlContext.implicits._
     def withCatalog(cat: String): DataFrame = {
      sqlContext
        .read
        .options(Map(HBaseTableCatalog.tableCatalog -&amp;gt; cat))
        .format("org.apache.spark.sql.execution.datasources.hbase")
        .load()
    }
// Read from HBase table
   val df = withCatalog(catalog)
    df.show
    df.filter($"col0" === "1528801346000_200550232_2955")
      .select($"col0", $"col1").show
   spark.stop()
  }


&lt;/PRE&gt;&lt;P&gt;I'll really appreciate any help on this. I couldnt find any convincing answer in stackoverflow as well.&lt;/P&gt;</description>
      <pubDate>Mon, 02 Jul 2018 09:36:37 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Archives-of-Support-Questions/Getting-error-while-trying-to-connect-HBase-using-spark/m-p/175485#M80127</guid>
      <dc:creator>contactvivekjai</dc:creator>
      <dc:date>2018-07-02T09:36:37Z</dc:date>
    </item>
    <item>
      <title>Re: Getting error while trying to connect HBase using spark.</title>
      <link>https://community.cloudera.com/t5/Archives-of-Support-Questions/Getting-error-while-trying-to-connect-HBase-using-spark/m-p/175486#M80128</link>
      <description>&lt;P&gt;&lt;A rel="user" href="https://community.cloudera.com/users/73231/contactvivekjain.html" nodeid="73231"&gt;@vivek jain&lt;/A&gt; &lt;/P&gt;&lt;P&gt;Can you upload your hbase configuration file.&lt;/P&gt;</description>
      <pubDate>Mon, 02 Jul 2018 11:52:48 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Archives-of-Support-Questions/Getting-error-while-trying-to-connect-HBase-using-spark/m-p/175486#M80128</guid>
      <dc:creator>karthiknedunche</dc:creator>
      <dc:date>2018-07-02T11:52:48Z</dc:date>
    </item>
    <item>
      <title>Re: Getting error while trying to connect HBase using spark.</title>
      <link>https://community.cloudera.com/t5/Archives-of-Support-Questions/Getting-error-while-trying-to-connect-HBase-using-spark/m-p/175487#M80129</link>
      <description>&lt;P&gt;&lt;A rel="user" href="https://community.cloudera.com/users/59157/karthiknedunchezhiyan1997.html" nodeid="59157"&gt;@karthik nedunchezhiyan&lt;/A&gt; I have attached hbase-site.xml, I hope it helps.&lt;/P&gt;</description>
      <pubDate>Mon, 02 Jul 2018 14:56:27 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Archives-of-Support-Questions/Getting-error-while-trying-to-connect-HBase-using-spark/m-p/175487#M80129</guid>
      <dc:creator>contactvivekjai</dc:creator>
      <dc:date>2018-07-02T14:56:27Z</dc:date>
    </item>
    <item>
      <title>Re: Getting error while trying to connect HBase using spark.</title>
      <link>https://community.cloudera.com/t5/Archives-of-Support-Questions/Getting-error-while-trying-to-connect-HBase-using-spark/m-p/175488#M80130</link>
      <description>&lt;A rel="user" href="https://community.cloudera.com/users/73231/contactvivekjain.html" nodeid="73231"&gt;@vivek jain&lt;/A&gt;&lt;P&gt;It seems that the app is not picking up the hbase-site.xml and is connecting to localhost (connectString=localhost:2181). &lt;/P&gt;&lt;P&gt;copy hbase-site.xml to /etc/spark/conf/ in the node where you are launching the job and also pass the hbase-site.xml using --files in spark-submit command (--files /etc/spark/conf/hbase-site.xml).&lt;/P&gt;</description>
      <pubDate>Mon, 02 Jul 2018 23:18:17 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Archives-of-Support-Questions/Getting-error-while-trying-to-connect-HBase-using-spark/m-p/175488#M80130</guid>
      <dc:creator>sandyy006</dc:creator>
      <dc:date>2018-07-02T23:18:17Z</dc:date>
    </item>
    <item>
      <title>Re: Getting error while trying to connect HBase using spark.</title>
      <link>https://community.cloudera.com/t5/Archives-of-Support-Questions/Getting-error-while-trying-to-connect-HBase-using-spark/m-p/175489#M80131</link>
      <description>&lt;P&gt;Hi &lt;A rel="user" href="https://community.cloudera.com/users/10159/snemuri.html" nodeid="10159"&gt;@Sandeep Nemuri&lt;/A&gt; thanks for answering. I did as mentioned above and now my code runs fine with deploy-mode as client, but now I ran into another issue where the data displayed is blank. However I can see the data on hbase shell prompt. I have already checked the rowkey,table name and namespace name. What do you think is missing ?&lt;/P&gt;&lt;PRE&gt;val df = withCatalog(catalog)
    df.show
   df.select($"col0").show(10)
   spark.stop()
&lt;BR /&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 03 Jul 2018 19:37:02 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Archives-of-Support-Questions/Getting-error-while-trying-to-connect-HBase-using-spark/m-p/175489#M80131</guid>
      <dc:creator>contactvivekjai</dc:creator>
      <dc:date>2018-07-03T19:37:02Z</dc:date>
    </item>
    <item>
      <title>Re: Getting error while trying to connect HBase using spark.</title>
      <link>https://community.cloudera.com/t5/Archives-of-Support-Questions/Getting-error-while-trying-to-connect-HBase-using-spark/m-p/175490#M80132</link>
      <description>&lt;P&gt;&lt;A rel="user" href="https://community.cloudera.com/users/73231/contactvivekjain.html" nodeid="73231"&gt;@vivek jain&lt;/A&gt; Glad that it worked, Would you mind marking this thread as closed by clicking on "Accept" and asking a new question with the code used and the console output.&lt;/P&gt;</description>
      <pubDate>Tue, 03 Jul 2018 19:45:52 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Archives-of-Support-Questions/Getting-error-while-trying-to-connect-HBase-using-spark/m-p/175490#M80132</guid>
      <dc:creator>sandyy006</dc:creator>
      <dc:date>2018-07-03T19:45:52Z</dc:date>
    </item>
    <item>
      <title>Re: Getting error while trying to connect HBase using spark.</title>
      <link>https://community.cloudera.com/t5/Archives-of-Support-Questions/Getting-error-while-trying-to-connect-HBase-using-spark/m-p/175491#M80133</link>
      <description>&lt;P&gt;&lt;A rel="user" href="https://community.cloudera.com/users/10159/snemuri.html" nodeid="10159"&gt;@Sandeep Nemuri&lt;/A&gt; thanks for the help, surely will do so.&lt;/P&gt;</description>
      <pubDate>Tue, 03 Jul 2018 21:58:35 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Archives-of-Support-Questions/Getting-error-while-trying-to-connect-HBase-using-spark/m-p/175491#M80133</guid>
      <dc:creator>contactvivekjai</dc:creator>
      <dc:date>2018-07-03T21:58:35Z</dc:date>
    </item>
  </channel>
</rss>

