HBase Java API删除表失败
错误信息:org.apache.hadoop.hbase.TableNotDisabledException:staff
TableNotDisabledException:staff
table:表
not:没有
disabled:状态
Exception:异常
staff:表名
解读为:staff这个表的状态不是disabled
拿到错误信息,将该表状态改为disable即可,代码如下:
/**
* 删除表
* 删除表需要管理员权限,先获取管理员权限,再将表的状态设置为disable
* 先修改状态,再删除,若顺序不正确,也无法删除,因为代码的执行顺序是从上到下
* @throws IOException
*/
@Test
public void deleteTable() throws IOException {
//实例config对象
Configuration configuration = new Configuration();
//获取连接:Zookeeper
configuration.set("hbase.zookeeper.quorum", "node01:2181,node02:2181,node03:2181");
Connection connection = ConnectionFactory.createConnection(configuration);
//获取要操作的表
Table myuser2 =