I am trying to create Hbase table using Java source code.
This is my source code
import java.io.IOException;
import org.apache.hadoop.hbase.HBaseConfiguration;
import org.apache.hadoop.hbase.HColumnDescriptor;
import org.apache.hadoop.hbase.HTableDescriptor;
import org.apache.hadoop.hbase.client.HBaseAdmin;
import org.apache.hadoop.hbase.TableName;
import org.apache.hadoop.conf.Configuration;
public class hbaseRelated {
public static void main(String[] args) throws IOException {
Configuration con = HBaseConfiguration.create();
HBaseAdmin admin = new HBaseAdmin(con);
HTableDescriptor tableDescriptor = new
HTableDescriptor(TableName.valueOf("z_utk_emp"));
tableDescriptor.addFamily(new HColumnDescriptor("personal"));
tableDescriptor.addFamily(new HColumnDescriptor("professional"));
admin.createTable(tableDescriptor);
System.out.println(" Table created ");
}
}
I compiled the program using these commands on the command line
javac -Xlint:overrides -cp "/usr/hdp/current/hadoop-client/*:/usr/hdp/current/hbase-client/lib/*" hbaseRelated.java
Then I made the program run by using the command:
java -cp ".:/usr/hdp/current/hadoop-client/*:/usr/hdp/current/hbase-client/lib/*" hbaseRelated
QUESTION:
I am not able to create the table using this method in HBase
The errors are
Exception in thread âmainâ org.apache.hadoop.hbase.client.RetriesExhaustedException: Failed after attempts=35, exceptions:
Caused by: org.apache.hadoop.hbase.MasterNotRunningException: java.io.IOException: Canât get master address from ZooKeeper; znode data == null
Caused by: java.io.IOException: Canât get master address from ZooKeeper; znode data == null
ANY SOLUTIONS?