0

您好我正在运行 hbase VMWare 沙箱 MapR-Sandbox-For-Hadoop-3.1.0_VM。我没有对沙箱进行任何更改。我可以通过浏览器访问控制面板。在另一个 linux VM 上,我安装了 eclipse 和 hbase 客户端。我有一个 java 程序,我想在其中创建一个 hbase 表,但我无法连接。请帮忙

正如您在下面看到的,我收到一个错误

错误 client.HConnectionManager$HConnectionImplementation:检查“zookeeper.znode.parent”中配置的值。可能与主服务器中配置的不匹配。

接着

timesorg.apache.hadoop.hbase.MasterNotRunningException:重试 1 次

(请参阅下面的完整堆栈跟踪)。

我的应用程序使用

System.setProperty("java.library.path", "/opt/mapr/lib");
conf = HBaseConfiguration.create();  
conf.set("zookeeper.znode.parent", "/maprdemo");
conf.set("hbase.zookeeper.quorum", "16.49.150.79");
conf.set("hbase.zookeeper.property.clientPort", "5181");
conf.set("hbase.client.retries.number", "2");
admin = new HBaseAdmin(conf); 
System.out.println(admin.isMasterRunning());

POM 包括

<dependency>
    <groupId>org.apache.hbase</groupId>
    <artifactId>hbase</artifactId>
    <version>0.94.13-mapr-1401-m7-3.1.0</version>
</dependency>

堆栈跟踪

14/06/09 15:28:11 INFO zookeeper.ClientCnxn: Opening socket connection to server mapr.sandbox.com/16.49.150.79:5181. Will attempt to SASL-authenticate using Login Context section 'Client_simple'
14/06/09 15:28:11 INFO zookeeper.ClientCnxn: Socket connection established to mapr.sandbox.com/16.49.150.79:5181, initiating session
14/06/09 15:28:11 INFO zookeeper.ClientCnxn: Session establishment complete on server mapr.sandbox.com/16.49.150.79:5181, sessionid = 0x146807e8acc0090, negotiated timeout = 40000
14/06/09 15:28:11 ERROR client.HConnectionManager$HConnectionImplementation: Check the value configured in 'zookeeper.znode.parent'. There could be a mismatch with the one configured in the master.
14/06/09 15:28:11 INFO client.HConnectionManager$HConnectionImplementation: Closed zookeeper sessionid=0x146807e8acc0090
14/06/09 15:28:11 INFO zookeeper.ZooKeeper: Session: 0x146807e8acc0090 closed
14/06/09 15:28:11 INFO zookeeper.ClientCnxn: EventThread shut down
Retried 1 timesorg.apache.hadoop.hbase.MasterNotRunningException: Retried 1 times
    at org.apache.hadoop.hbase.client.HBaseAdmin.connectWithConfiguration(HBaseAdmin.java:184)
    at org.apache.hadoop.hbase.client.HBaseAdmin$1.connect(HBaseAdmin.java:153)
    at org.apache.hadoop.hbase.client.HBaseAdmin.ensureConnectedToHBase(HBaseAdmin.java:272)
    at org.apache.hadoop.hbase.client.HBaseAdmin.ensureConnectedToHBase(HBaseAdmin.java:247)
    at org.apache.hadoop.hbase.client.HBaseAdmin.isMasterRunning(HBaseAdmin.java:439)
    at com.hp.spark.hbase.test.HBaseTest.testCreateSchema(HBaseTest.java:72)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:606)
    at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:47)
    at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
    at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:44)
    at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)
    at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:26)
    at org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:27)
    at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:271)
    at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:70)
    at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:50)
    at org.junit.runners.ParentRunner$3.run(ParentRunner.java:238)
    at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:63)
    at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:236)
    at org.junit.runners.ParentRunner.access$000(ParentRunner.java:53)
    at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:229)
    at org.junit.runners.ParentRunner.run(ParentRunner.java:309)
    at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:50)
    at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
    at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:467)
    at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:683)
    at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:390)
    at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:197)
4

2 回答 2

2

看起来您正在尝试访问 M7 mapr 本机表(这是 HBase API 的不同实现)

zookeeper znodes 在 M7 中是无关紧要的。所以下面的行没有任何区别。

conf.set("zookeeper.znode.parent", "/maprdemo");
conf.set("hbase.zookeeper.quorum", "16.49.150.79");
conf.set("hbase.zookeeper.property.clientPort", "5181");

它也不需要运行 hbase 主服务器和区域服务。因此,您将找不到在沙箱上运行的主服务。它虽然安装在节点上。

maprcli node services -nodes `cat /opt/mapr/hostname` -hbmaster restart

您可以手动启动它并重新运行您的应用程序。

于 2014-06-27T14:19:22.033 回答
0

您可以使用属性
conf.set("mapr.hbase.default.db", );更改访问方式

当您按照 Nabeel 的建议使用 HBase 时,您必须设置 znode 父级等。

请注意,这仅适用于映射表的二进制表。对于 JSON Mapr db 表,您可以使用 OJAI API。

于 2017-09-25T18:17:42.700 回答