gpt4 book ai didi

java - Hbase表未列出

转载 作者:行者123 更新时间:2023-12-02 21:41:59 25 4
gpt4 key购买 nike

我已经创建了一个示例Java程序来在HBase中创建一个表,它显示成功创建了该表。但是当我打开HBase终端并使用list命令时,创建的表不存在。为什么会这样?我的代码如下

    Configuration config = HBaseConfiguration.create();
conf.set("hbase.master","192.168.1.47:60000");
Configuration config = HBaseConfiguration.create();
config.set("hbase.zookeeper.quorum", "192.168.1.47");
config.set("hbase.zookeeper.property.clientPort", "2181");
config.set("hbase.master", "192.168.1.47:60000");
config.set("zookeeper.znode.parent", "/hbase-unsecure");
HBaseAdmin hbase = new HBaseAdmin(conf);

HTableDescriptor desc = new HTableDescriptor("sample");
HColumnDescriptor meta = new ColumnDescriptor("samplecolumn1".getBytes());
desc.addFamily(meta);
System.out.println( "Created Success fully..." );
hbase.createTable(desc);
192.168.1.47:60000是Hbase所在的位置。

编辑后:

我也尝试了一下,这给了我一个错误,
Eception in thread "main" org.apache.hadoop.hbase.MasterNotRunningException: com.google.protobuf.ServiceException: java.net.UnknownHostException: unknown host: sandbox.hortonworks.com
at org.apache.hadoop.hbase.client.HConnectionManager$HConnectionImplementation$StubMaker.makeStub(HConnectionManager.java:1651)
at org.apache.hadoop.hbase.client.HConnectionManager$HConnectionImplementation$MasterServiceStubMaker.makeStub(HConnectionManager.java:1677)
at org.apache.hadoop.hbase.client.HConnectionManager$HConnectionImplementation.getKeepAliveMasterService(HConnectionManager.java:1884)
at org.apache.hadoop.hbase.client.HConnectionManager$HConnectionImplementation.listTables(HConnectionManager.java:2589)
at org.apache.hadoop.hbase.client.HBaseAdmin.listTables(HBaseAdmin.java:307)
at org.HBaseJDBC.HBaseClient.main(HBaseClient.java:53)Caused by: com.google.protobuf.ServiceException: java.net.UnknownHostException: unknown host: sandbox.hortonworks.com
at org.apache.hadoop.hbase.ipc.RpcClient.callBlockingMethod(RpcClient.java:1673)
at org.apache.hadoop.hbase.ipc.RpcClient$BlockingRpcChannelImplementation.callBlockingMethod(RpcClient.java:1714)
at org.apache.hadoop.hbase.protobuf.generated.MasterProtos$MasterService$BlockingStub.isMasterRunning(MasterProtos.java:42561)
at org.apache.hadoop.hbase.client.HConnectionManager$HConnectionImplementation$MasterServiceStubMaker.isMasterRunning(HConnectionManager.java:1688)
at org.apache.hadoop.hbase.client.HConnectionManager$HConnectionImplementation$StubMaker.makeStubNoRetries(HConnectionManager.java:1597)
at org.apache.hadoop.hbase.client.HConnectionManager$HConnectionImplementation$StubMaker.makeStub(HConnectionManager.java:1623)

最佳答案

您尚未在上面的代码中创建表,仅提供了名称和架构信息。

在添加“完全创建成功”之前,请添加以下行-

hbase.createTable(desc);

关于java - Hbase表未列出,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/28084087/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com