表格存储服务 CloudTable
表格存储服务 CloudTable
- 最新动态
- 产品介绍
- 计费说明
- 快速入门
-
用户指南
- HBase用户指南
- Doris用户指南
- ClickHouse用户指南
- 权限管理
- 审计日志
- 集群日志管理
- 最佳实践
- 开发指南
- API参考
- SDK参考
-
常见问题
-
通用类
- CloudTable集群能够提供什么服务?
- 为什么要选择CloudTable服务?
- 创建CloudTable HBase集群要准备什么?
- 使用CloudTable服务时需要关注什么?
- CloudTable HBase集群支持哪些压缩算法?
- 能停止CloudTable服务吗?
- CloudTable中的HBase外部接口支持哪些编程语言?
- 故障RegionServer个数怎么判断?
- CloudTable HBase支持的特殊符号?
- CloudTable数据进行删除,导致索引表和数据表不对应查询异常处理办法?
- python通过thrift访问cloudtable,多个任务并行缓慢
- 如何查看HBase shell的TTL属性?
- 服务器资源为什么会被释放?
- 资源停止服务或逾期释放说明
- 哪些场景会影响数据均衡?
- 如何调整数据均衡的灵敏度,调整后有哪些影响?
- Doris集群回收站数据处理
- 连接访问类
- 数据读写类
- 数据导入
- 网络配置
- 计费类
-
通用类
- 文档下载
- 通用参考
链接复制成功!
修改表
功能简介
HBase通过org.apache.hadoop.hbase.client.Admin的modifyTable方法修改表信息。
代码样例
public void testModifyTable() { LOG.info("Entering testModifyTable."); // Specify the column family name. byte[] familyName = Bytes.toBytes("education"); Admin admin = null; try { // Instantiate an Admin object. admin = conn.getAdmin(); // Obtain the table descriptor. HTableDescriptor htd = admin.getTableDescriptor(tableName); // Check whether the column family is specified before modification. if (!htd.hasFamily(familyName)) { // Create the column descriptor. HColumnDescriptor hcd = new HColumnDescriptor(familyName); htd.addFamily(hcd); // Disable the table to get the table offline before modifying // the table. admin.disableTable(tableName); // Submit a modifyTable request. admin.modifyTable(tableName, htd); //注[1] // Enable the table to get the table online after modifying the // table. admin.enableTable(tableName); } LOG.info("Modify table successfully."); } catch (IOException e) { LOG.error("Modify table failed " ,e); } finally { if (admin != null) { try { // Close the Admin object. admin.close(); } catch (IOException e) { LOG.error("Close admin failed " ,e); } } } LOG.info("Exiting testModifyTable."); }
注意事项
注[1] 只有在调用disableTable接口后, 再调用modifyTable接口才能将表修改成功。之后,请调用enableTable接口重新启用表。
父主题: 样例代码说明