这里我尝试使用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);
答案 0 :(得分:1)
如果你能够从hbase shell创建hbase表,那么hbase运行良好,你必须通过在代码中指定zookeeper quorum来修改你的代码。
Configuration hbaseConfiguration = HBaseConfiguration.create();
hbaseConfiguration.addResource("<HBASE_CONF_DIR_PATH>/hbase-site.xml");
或
Configuration hbaseConfiguration = HBaseConfiguration.create();
hbaseConfiguration.set("hbase.zookeeper.quorum","<ZK-QUORUM>");