工作中需要修改已经使用表的TTL,遇到了一些问题,做下记录
首先,进入hbase shell
1.disable表是必须的
disable 'table'
2.输入alter 'table',shell弹出一堆提示
Here is some help for this command:
Alter column family schema; pass table name and a dictionary
specifying new column family schema. Dictionaries are described
on the main help command output. Dictionary must include name
of column family to alter. For example,
To change or add the 'f1' column family in table 't1' from defaults
to instead keep a maximum of 5 cell VERSIONS, do:
hbase> alter 't1', NAME => 'f1', VERSIONS => 5
To delete the 'f1' column family in table 't1', do:
hbase> alter 't1', NAME => 'f1', METHOD => 'delete'
or a shorter version:
hbase> alter 't1', 'delete' => 'f1'
You can also change table-scope attributes like MAX_FILESIZE
MEMSTORE_FLUSHSIZE, READONLY, and DEFERRED_LOG_FLUSH.
For example, to change the max size of a family to 128MB, do:
hbase> alter 't1', METHOD => 'table_att', MAX_FILESIZE => '134217728'
You can add one table coprocessor by setting a table coprocessor attribute:
hbase> alter 't1', METHOD => 'table_att',
'coprocessor'=>'hdfs:///foo.jar|com.foo.FooRegionObserver|1001|arg1=1,arg2=2'
Since you can have multiple coprocessors configured for a table, a
sequence number will be automatically appended to the attribute name
to uniquely identify it.
The coprocessor attribute must match the pattern below in order for
the framework to understand how to load the coprocessor classes:
[coprocessor jar file location] | class name | [priority] | [arguments]
You can also remove a table-scope attribute:
hbase> alter 't1', METHOD => 'table_att_unset', NAME => 'MAX_FILESIZE'
hbase> alter 't1', METHOD => 'table_att_unset', NAME => 'coprocessor$1'
There could be more than one alteration in one command:
hbase> alter 't1', {NAME => 'f1'}, {NAME => 'f2', METHOD => 'delete'}
3.首先按照提示中修改MAX_FILESIZE属性的方法修改:
hbase(main):017:0> alter 'test_ttl', METHOD => 'table_att',MAX_FILESIZE => '5000'
Updating all regions with the new schema...
6/6 regions updated.
Done.
0 row(s) in 1.1980 seconds
好像好了,但是看了下HBase的Web界面上表的schema没改,悲剧了。。。
静下来仔细看了下schema:
{NAME => 'test_ttl', MAX_FILESIZE => '5000', FAMILIES => [{NAME => 'cf', MIN_VERSIONS => '0', TTL => '500'}]} |
ttl是在cf的属性中的,ttl应该是cf的属性而不是table级别的属性,因此尝试修改cf属性
4.修改cf的ttl属性
hbase(main):018:0> alter 'test_ttl',NAME => 'cf', TTL => '500'
Updating all regions with the new schema...
6/6 regions updated.
Done.
0 row(s) in 1.3620 seconds
查看web,果然改了!
5.最后按照国际惯例,enable table
hbase(main):019:0> enable 'test_ttl'
0 row(s) in 2.0450 seconds
搞定
分享到:
相关推荐
一款强大的HBase表管理系统,目前系统集成的功能有,命名空间管理,表管理,列簇管理,标签机制,快照管理,以及一些常见的统计指标展示等,另外,系统还内置了HBaseSQL的功能,欢迎大家下载。 一款强大的HBase表...
最近看了hbase的源码根据源码写了一些scala调动hbase表的API,话不多说直接上代码!Hadoop的版本是2.7.3,scala版本是2.1.1,hbase的版本是1.1.2 如果版本不同可以修改pom的依赖项,但要注意版本冲突。 并且在scala...
hbase表结构设计,新建表,查询表语句,删除表数据,删除表的例子。
HBase – Hadoop Database,是一个高可靠性、高性能、面向列、可伸缩的分布式存储系统,利用HBase技术可在廉价PC Server上搭建起大规模结构化存储集群。 HBase是Google Bigtable的开源实现,类似Google Bigtable...
hbase表操作工具类.连接hbase数据库,根据rowkey删除单条记录,批量删除记录。获取某个字段的值,判断记录是否存在,向hbase表中插单条数据,批量插入到hbase表。 查询表,获取某个字段的值列表,hbase工具
从HBase表读取并写入HBase表的简单Spark Streaming项目 #Prereqs运行 创建一个要写入的hbase表:a)启动hbase shell $ hbase shell b)创建表create'/ user / chanumolu / sensor',{NAME =>'data'},{NAME =>'...
java代码将mysql表数据导入HBase表 + 样例mysql表和数据 + HBase表创建
HBaseManager,是一款强大的HBase表管理系统,目前系统集成的功能有,命名空间管理,表管理,列簇管理,标签机制,快照管理,以及一些常见的统计指标展示等,另外,系统还内置了HBaseSQL的功能
(1) 列出HBase所有的表的相关信息,例如表名、创建时间等;(2) 在终端打印出指定的表的所有记录数据;(3) 向已经创建好的表添加和删除指定的列族或列;(4) 清空指定的表的所有记录数据(5) 统计表的行数。2...
基于搭建好的hbase集群,将mysql(关系型数据库)的数据抽取到hbase表中。
HBase表结构.jpg
该文档是介绍HBase表的基本操作,贡献出来,给大家下载!
HBase建表关联关系,通过hive和其他的组件,关联数据表查询,将关系型数据库的数据表在分布式集群下的重建。
Java操作Hbase进行建表、删表以及对数据进行增删改查,条件查询
这里用图的方式详细分析了hbase的表结构。包括三张表等等
HBase表和RDB表的转化的Java源码资源
通过java api 接口 利用thrift读取hbase表中的数据 解压后包含两个文件 一个是实验步骤文档 一个是java 代码
HBase参数修改
Hbase笔记 —— 利用JavaAPI的方式操作Hbase数据库(往hbase的表中批量插入数据)
4.2.2 修改hbase-site.xml文件 4.3 Cygwin终端设置 4.4 启动hbase 4.5 进入shell 4.6 建表与插数据 5、HBase数据库 5.1 数据类型 5.2 HBase语法教程 6、eclipse下开发hbase 7、集群下开发HBase