这里我尝试使用 hbase 创建表。这里会出现org.apache.hadoop.hbase.MasterNotRunningException。
HBaseConfiguration hbaseConfiguration = new HBaseConfiguration(new Configuration());
HTableDescriptor htable = new HTableDescriptor("Test");
htable.addFamily(new HColumnDescriptor("Id"));
htable.addFamily(new HColumnDescriptor("Name"));
HBaseAdmin hbaseAdmin = new HBaseAdmin(hbaseConfiguration);
hbaseAdmin.createTable(htable);
最佳答案
如果您能够从 hbase shell 创建 hbase 表,那么 hbase 运行良好,您必须通过在代码中指定 Zookeeper 仲裁来修改代码。
Configuration hbaseConfiguration = HBaseConfiguration.create();
hbaseConfiguration.addResource("<HBASE_CONF_DIR_PATH>/hbase-site.xml");
或
Configuration hbaseConfiguration = HBaseConfiguration.create();
hbaseConfiguration.set("hbase.zookeeper.quorum","<ZK-QUORUM>");
关于java - org.apache.hadoop.hbase.MasterNotRunningException,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/22759795/