Support Questions

Find answers, ask questions, and share your expertise

The node /hbase is not in ZooKeeper. It should have been written by the master.

avatar
Contributor

I am trying to connect to HBase from Spark via Phoenix (using the official plugin described here).

Here is my scala Spark code:

package com.zachk

import org.apache.spark.SparkContext
import org.apache.spark.sql.SQLContext
import org.apache.phoenix.spark._
import org.apache.spark.rdd.RDD

object App {
  def main(args : Array[String]) {
    val sc = new SparkContext()
    val rdd: RDD[Map[String, AnyRef]] = sc.phoenixTableAsRDD(
      //"TABLE1", Seq("ID", "COL1"), zkUrl = Some("zk1-titanu:2181/hbase-unsecure")
      //"TABLE1", Seq("ID", "COL1"), zkUrl = Some("zk1-titanu:2181/hbase-secure")
      "TABLE1", Seq("ID", "COL1"), zkUrl = Some("zk1-titanu:2181")
    )
    println(rdd.count())
}

I am compiling with Maven.

I am running with this spark-submit command:

/usr/bin/spark-submit --class com.zachk.App --master local[*] target/phoenix-hbase-test-0.0.1-jar-with-dependencies.jar

When I run, I get this error continually: ERROR ConnectionManager$HConnectionImplementation: The node /hbase is not in ZooKeeper. It should have been written by the master. Check the value configured in 'zookeeper.znode.parent'. There could be a mismatch with the one configured in the master.

As shown in the comments above, I have already tried the suggestion in this similarly-named post. I would appreciate any help!

1 ACCEPTED SOLUTION

avatar
Super Collaborator

The problem is in missing colons in the URLs you tried. It's supposed to be "zk1-titanu:2181:/hbase-unsecure"

View solution in original post

4 REPLIES 4

avatar
Super Guru

The zkUrl you provided the first time should be correct:

"zk1-titanu:2181/hbase-unsecure"

By default, HBase on HDP will use /hbase-unsecure. If you enable Kerberos authentication, it will use /hbase-secure instead.

avatar

You're missing a ':' after 2181

avatar
Super Collaborator

The problem is in missing colons in the URLs you tried. It's supposed to be "zk1-titanu:2181:/hbase-unsecure"

avatar
Master Collaborator

The functions `phoenixTableAsDataFrame`, `phoenixTableAsRDD` and `saveToPhoenix` all support optionally specifying a `conf` Hadoop configuration parameter with custom Phoenix client settings, as well as an optional `zkUrl` parameter for the Phoenix connection URL.

val configuration = new Configuration()

// set zookeeper.znode.parent and hbase.zookeeper.quorum in the conf

"TABLE1", Seq("ID", "COL1"), conf = configuration