org.apache.hadoop.hbase.MasterNotRunningException

时间:2014-03-31 10:56:28

标签: java hadoop hbase

这里我尝试使用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); 

1 个答案:

答案 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>");