I’m trying to connect to an HBase standalone instance using the Java API, but I’m encountering the following error:
21:58:06.527 [ReadOnlyZKClient-192.168.142.129:2181@0x7bb58ca3-SendThread(192.168.142.129:2181)] DEBUG org.apache.zookeeper.ClientCnxn - Got ping response for sessionid: 0x192b47ed5110005 after 1ms
21:58:13.231 [ReadOnlyZKClient-192.168.142.129:2181@0x7bb58ca3-SendThread(192.168.142.129:2181)] DEBUG org.apache.zookeeper.ClientCnxn - Reading reply sessionid:0x192b47ed5110005, packet:: clientPath:/hbase serverPath:/hbase finished:false header:: 47,8 replyHeader:: 47,105,0 request:: '/hbase,F response:: v{'running,'rs,'splitWAL,'backup-masters,'flush-table-proc,'draining,'master-maintenance,'online-snapshot,'hbaseid,'table,'switch,'master}
21:58:13.232 [main] DEBUG org.apache.hadoop.hbase.client.RpcRetryingCallerImpl - Call exception, tries=13, retries=16, started=88564 ms ago, cancelled=false, msg=No meta znode available, details=row 'test_table' on table 'hbase:meta' at null, see https://s.apache.org/timeout, exception=java.io.IOException: No meta znode available
at org.apache.hadoop.hbase.client.ZKConnectionRegistry.getMetaRegionLocation(ZKConnectionRegistry.java:144)
...
When I run the Java API, the code successfully connects to HBase and creates the table test_table
, but it throws the error No meta znode available
.
Could someone help me figure out why this error occurs when the test_table
is successfully created in HBase? Any help would be greatly appreciated!
Here’s the Java code I’m using to connect:
public static void main(String[] args) throws IOException {
Configuration config = HBaseConfiguration.create();
config.set("hbase.defaults.for.version.skip", "true");
config.set("hbase.zookeeper.quorum", "192.168.142.129");
config.set("hbase.zookeeper.property.clientPort", "2181");
config.set("hbase.master", "192.168.142.129:60010"); // HBase Master address
try (Connection connection = ConnectionFactory.createConnection(config);
Admin admin = connection.getAdmin()) {
TableName tableName = TableName.valueOf("test_table");
String columnFamily = "cf";
if (!admin.tableExists(tableName)) {
HTableDescriptor tableDescriptor = new HTableDescriptor(tableName);
tableDescriptor.addFamily(new HColumnDescriptor(columnFamily));
admin.createTable(tableDescriptor);
System.out.println("Table created successfully.");
} else {
System.out.println("Table already exists.");
}
You need to sign in to view this answers
Leave feedback about this