简体   繁体   中英

Hbase table is not listing

i have created a sample java program to create a table in the HBase, It showing successfully created the table. But when i open my HBase terminal and use the command list , the created table is not present.Why this is happening? My code follows

    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);

Where 192.168.1.47:60000 is the place where Hbase is presnt.

After Edit:

I tried tis also now its giving me an error,

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)

You haven't created the table in the above code, you have only provided name and schema information.

Please add following line before you print "Created Success fully" -

hbase.createTable(desc);

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM