您好我正在运行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)
答案 0 :(得分:2)
看起来您正在尝试访问M7映射器本机表(这是HBase API的不同实现)
动物园管理员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
您可以手动启动它并重新运行您的应用程序。
答案 1 :(得分:0)
您可以使用属性更改您的访问方式 conf.set(&#34; mapr.hbase.default.db&#34;,);
当你使用HBase作为Nabeel建议时,你必须设置znode父等。
请注意,这仅适用于mapr表的二进制表。 对于JSON Mapr数据库表,您可以使用OJAI API。