java- join到hbase时出错


0

我正在尝试与配置为非分布式模式的HBase建立远程 join。

    // Instantiating a configuration class
    Configuration hbaseConfiguration = HBaseConfiguration.create();
    try {
        Configuration newConfig = new Configuration(hbaseConfiguration);
        newConfig.set("hbase.zookeeper.quorum", "77.154.69.181");
        newConfig.set("hbase.zookeper.property.clientPort", "2181");
        HConnection connection = HConnectionManager
                .getConnection(newConfig);
       HBaseAdmin hBaseAdmin = new HBaseAdmin(connection);
        if (!hBaseAdmin.isMasterRunning())
            throw new Exception("Hbase is not running");
    } catch (Exception e) {
        e.printStackTrace();
    }

我得到以下错误:

    [error] org.apache.hadoop.hbase.MasterNotRunningException: com.google.protobuf.ServiceException: org.apache.hadoop.net.ConnectTimeoutException: 10000 millis timeout while waiting for channel to be ready for connect. ch : java.nio.channels.SocketChannel[connection-pending remote=vm-77446.localdomain/77.154.69.181:37027]
[error]     at org.apache.hadoop.hbase.client.ConnectionManager$HConnectionImplementation$StubMaker.makeStub(ConnectionManager.java:1485)
[error]     at org.apache.hadoop.hbase.client.ConnectionManager$HConnectionImplementation$MasterServiceStubMaker.makeStub(ConnectionManager.java:1505)
[error]     at org.apache.hadoop.hbase.client.ConnectionManager$HConnectionImplementation.getKeepAliveMasterService(ConnectionManager.java:1711)
[error]     at org.apache.hadoop.hbase.client.ConnectionManager$HConnectionImplementation.isMasterRunning(ConnectionManager.java:876)
[error]     at org.apache.hadoop.hbase.client.HBaseAdmin.isMasterRunning(HBaseAdmin.java:271)
[error]     at controllers.Application.index(Application.java:29)
[error]     at router.Routes$$anonfun$routes$1$$anonfun$applyOrElse$1$$anonfun$apply$1.apply(Routes.scala:95)
[error]     at router.Routes$$anonfun$routes$1$$anonfun$applyOrElse$1$$anonfun$apply$1.apply(Routes.scala:95)
[error]     at play.core.routing.HandlerInvokerFactory$$anon$4.resultCall(HandlerInvoker.scala:136)
[error]     at play.core.routing.HandlerInvokerFactory$JavaActionInvokerFactory$$anon$14$$anon$3$$anon$1.invocation(HandlerInvoker.scala:127)
[error]     at play.core.j.JavaAction$$anon$1.call(JavaAction.scala:70)
[error]     at play.http.DefaultHttpRequestHandler$1.call(DefaultHttpRequestHandler.java:20)
[error]     at play.core.j.JavaAction$$anonfun$7.apply(JavaAction.scala:94)
[error]     at play.core.j.JavaAction$$anonfun$7.apply(JavaAction.scala:94)
[error]     at scala.concurrent.impl.Future$PromiseCompletingRunnable.liftedTree1$1(Future.scala:24)
[error]     at scala.concurrent.impl.Future$PromiseCompletingRunnable.run(Future.scala:24)
[error]     at play.core.j.HttpExecutionContext$$anon$2.run(HttpExecutionContext.scala:40)
[error]     at play.api.libs.iteratee.Execution$trampoline$.execute(Execution.scala:70)
[error]     at play.core.j.HttpExecutionContext.execute(HttpExecutionContext.scala:32)
[error]     at scala.concurrent.impl.Future$.apply(Future.scala:31)
[error]     at scala.concurrent.Future$.apply(Future.scala:492)
[error]     at play.core.j.JavaAction.apply(JavaAction.scala:94)
[error]     at play.api.mvc.Action$$anonfun$apply$1$$anonfun$apply$4$$anonfun$apply$5.apply(Action.scala:105)
[error]     at play.api.mvc.Action$$anonfun$apply$1$$anonfun$apply$4$$anonfun$apply$5.apply(Action.scala:105)
[error]     at play.utils.Threads$.withContextClassLoader(Threads.scala:21)
[error]     at play.api.mvc.Action$$anonfun$apply$1$$anonfun$apply$4.apply(Action.scala:104)
[error]     at play.api.mvc.Action$$anonfun$apply$1$$anonfun$apply$4.apply(Action.scala:103)
[error]     at scala.Option.map(Option.scala:146)
[error]     at play.api.mvc.Action$$anonfun$apply$1.apply(Action.scala:103)
[error]     at play.api.mvc.Action$$anonfun$apply$1.apply(Action.scala:96)
[error]     at play.api.libs.iteratee.Iteratee$$anonfun$mapM$1.apply(Iteratee.scala:524)
[error]     at play.api.libs.iteratee.Iteratee$$anonfun$mapM$1.apply(Iteratee.scala:524)
[error]     at play.api.libs.iteratee.Iteratee$$anonfun$flatMapM$1.apply(Iteratee.scala:560)
[error]     at play.api.libs.iteratee.Iteratee$$anonfun$flatMapM$1.apply(Iteratee.scala:560)
[error]     at play.api.libs.iteratee.Iteratee$$anonfun$flatMap$1$$anonfun$apply$13.apply(Iteratee.scala:536)
[error]     at play.api.libs.iteratee.Iteratee$$anonfun$flatMap$1$$anonfun$apply$13.apply(Iteratee.scala:536)
[error]     at scala.concurrent.impl.Future$PromiseCompletingRunnable.liftedTree1$1(Future.scala:24)
[error]     at scala.concurrent.impl.Future$PromiseCompletingRunnable.run(Future.scala:24)
[error]     at akka.dispatch.TaskInvocation.run(AbstractDispatcher.scala:40)
[error]     at akka.dispatch.ForkJoinExecutorConfigurator$AkkaForkJoinTask.exec(AbstractDispatcher.scala:397)
[error]     at scala.concurrent.forkjoin.ForkJoinTask.doExec(ForkJoinTask.java:260)
[error]     at scala.concurrent.forkjoin.ForkJoinPool$WorkQueue.runTask(ForkJoinPool.java:1339)
[error]     at scala.concurrent.forkjoin.ForkJoinPool.runWorker(ForkJoinPool.java:1979)
[error]     at scala.concurrent.forkjoin.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:107)

2 答案


0
    newConfig.set("hbase.zookeper.property.clientPort", "2181");

应该是

    newConfig.set("hbase.zookeeper.property.clientPort", "2181");

你的代码有一个输入错误。


0

从这个”org.apache.hadoop下载.hbase.MasterNotRunningException异常,您的hbase主机(HMaster)没有运行。试着打开http://MasterIp:60010,并检查您的母版是否正在运行(应列出带有表名的Hbase母版页)。

如果主机正在运行,则添加

    newConfig.set("hbase.master","MasterIP:60000");

就在下面

   newConfig.set("hbase.zookeeper.property.clientPort", "2181");

我来回答

写文章

提问题

面试题