先做个记录,监控数据量过大时可以设置表的数据过期时间来清理数据。

1. 查找本地数据表大小

[root@ZWZF-CWY-LZY-12 ~]# cd /home/pinpoint/hbase/data/default/
[root@ZWZF-CWY-LZY-12 default]# du -sh *
16K AgentEvent
64K AgentInfo
16K AgentLifeCycle
72K AgentStat
632K AgentStatV2
40K ApiMetaData
16K ApplicationIndex
72K ApplicationMapStatisticsCallee_Ver2
72K ApplicationMapStatisticsCaller_Ver2
80K ApplicationMapStatisticsSelf_Ver2
72K ApplicationTraceIndex
20K HostApplicationMap_Ver2
72K SqlMetaData_Ver2
40K StringMetaData
264K Traces
1.1M TraceV2

2. 设置表的数据过期时间

2.1  查看hbase表:list

[root@monitor default]# cd /home/pinpoint/hbase-1.7.1/bin/
[root@monitor bin]# ./hbase shell
2022-10-19 15:03:48,097 WARN [main] util.NativeCodeLoader: Unable to load native-hadoop library for your platform... using builtin-java classes where applicable
HBase Shell
Use "help" to get list of supported commands.
Use "exit" to quit this interactive shell.
Version 1.7.1, r2d9273667e418e7023f9104a830cdcb8233b6f25, Fri Jul 16 00:20:26 PDT 2021 hbase(main):001:0>list
TABLE
AgentEvent
AgentInfo
AgentLifeCycle
AgentStatV2
ApiMetaData
ApplicationIndex
ApplicationMapStatisticsCallee_Ver2
ApplicationMapStatisticsCaller_Ver2
ApplicationMapStatisticsSelf_Ver2
ApplicationStatAggre
ApplicationTraceIndex
HostApplicationMap_Ver2
SqlMetaData_Ver2
StringMetaData
TraceV2
15 row(s) in 0.1740 seconds => ["AgentEvent", "AgentInfo", "AgentLifeCycle", "AgentStatV2", "ApiMetaData", "ApplicationIndex", "ApplicationMapStatisticsCallee_Ver2", "ApplicationMapStatisticsCaller_Ver2", "ApplicationMapStatisticsSelf_Ver2", "ApplicationStatAggre", "ApplicationTraceIndex", "HostApplicationMap_Ver2", "SqlMetaData_Ver2", "StringMetaData", "TraceV2"]

2.2 查看表描述:desc 'table_name'

hbase(main):002:0>  desc 'AgentInfo'
Table AgentInfo is ENABLED
AgentInfo
COLUMN FAMILIES DESCRIPTION
{NAME => 'Info', BLOOMFILTER => 'ROW', VERSIONS => '1', IN_MEMORY => 'false', KEEP_DELETED_CELLS => 'FALSE', DATA_BLOCK_ENCODING => 'PREFIX', TTL
=> '31536000 SECONDS (365 DAYS)', COMPRESSION => 'NONE', MIN_VERSIONS => '0', BLOCKCACHE => 'true', BLOCKSIZE => '65536', REPLICATION_SCOPE => '
0'}
1 row(s) in 0.1760 seconds

2.3 修改表信息

  将AgentInfo表的过期时间(TTL)修改为180天(TTL单位:秒)。

2.3.1 停用表:disable 'table_name'

hbase(main):003:0> disable 'AgentInfo'
0 row(s) in 2.3130 seconds

2.3.2 修改表信息:alter 'table_name' , {NAME=>'xxx',TTL=>'xxx'}

hbase(main):004:0> alter 'AgentInfo', {NAME=>'Info',TTL=>'15552000'}
Updating all regions with the new schema...
1/1 regions updated.
Done.
0 row(s) in 1.9670 seconds

2.3.3 启用表:enable 'table_name'

hbase(main):005:0> enable 'AgentInfo'
0 row(s) in 1.3030 seconds

2.3.4 查看表信息(确认修改结果)

hbase(main):006:0> desc 'AgentInfo'
Table AgentInfo is DISABLED
AgentInfo
COLUMN FAMILIES DESCRIPTION
{NAME => 'Info', BLOOMFILTER => 'ROW', VERSIONS => '1', IN_MEMORY => 'false', KEEP_DELETED_CELLS => 'FALSE', DATA_BLOCK_ENCODING => 'PREFIX', TTL
=> '15552000 SECONDS (180 DAYS)', COMPRESSION => 'NONE', MIN_VERSIONS => '0', BLOCKCACHE => 'true', BLOCKSIZE => '65536', REPLICATION_SCOPE => '
0'}
1 row(s) in 0.0310 seconds

3. 修改表过期时间后,清除过期数据:major_compact 'table_name'

  定期运行一次Major Compact(通过crontab 任务),用来删除早于给定TTL值的所有数据。

  注意:如果只设置TTL而不定期运行 major_compact,只是标记删除,并不会真正从磁盘上删除。

hbase(main):007:0> major_compact 'AgentInfo'
0 row(s) in 0.4290 seconds

pinpoint:查看hbase表和修改数据过期时间的更多相关文章

  1. 利用闪回查看Oracle表历史时刻数据

    利用闪回查看Oracle表历史时刻数据 1.查看表历史时刻数据 select * from tab_test AS OF TIMESTAMP to_timestamp('20140917 10:00: ...

  2. Oracle查看所有表空间的数据使用情况

    -- 查看所有表空间的数据使用情况 SELECT Upper(F.TABLESPACE_NAME) "表空间名", D.TOT_GROOTTE_MB "表空间大小(M)& ...

  3. mapreduce 只使用Mapper往多个hbase表中写数据

    只使用Mapper不使用reduce会大大减少mapreduce程序的运行时间. 有时候程序会往多张hbase表写数据. 所以有如题的需求. 下面给出的代码,不是可以运行的代码,只是展示driver中 ...

  4. Mapreduce读取Hbase表,写数据到多个Hbase表中

    Job端的变化: 通过设置conf,配置输出表,在reduce中获取输出表名字 Configuration conf = job.getConfiguration(); //输出表1 conf.set ...

  5. php表单修改数据

    (接前面写的) 第一个页面xiugai.php <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" ...

  6. hbase数据导出和恢复 设置双master + 查看hbase表占用磁盘大小

    1.备份TETST111hbase org.apache.hadoop.hbase.mapreduce.Export TEST111 /do1/hh2.drop 掉test111表  -- 只能dro ...

  7. 【查看数据占用空间】查看hbase表占用的磁盘情况

    使用命令:hdfs dfs -du /apps/hbase/data/data/default/

  8. 怎么查看HBase表的创建时间

    前几天HBase出现了RIT告警,忽然发现发出告警的Region所属的表并不是我创建出来的,于是就想看看这些表是怎么来的. 一时也没什么头绪,就先看看这些表是什么时候创建出来的吧,然后再根据时间点看看 ...

  9. Mapreduce读取Hbase表,写数据到一个Hbase表中

    public class LabelJob { public static void main(String[] args) throws Exception { Job job = Job.getI ...

随机推荐

  1. 2022年NISP考试时间|NISP一级考试时间|NISP|网安伴|NISP管理中心

    NISP一级~~国家信息安全水平考试一级证书 NISP一级证书是由中国信息安全测评中心颁发的国家级认证证书.面向全社会各行各业通用的信息安全意识普及和信息安全保护知识培训,是在任何单位和工作中都应具备 ...

  2. Clickhouse基准测试实践

    1.概述 本篇博客将对MySQL.InfluxDB.Clickhouse在写入时间.聚合查询时间.磁盘使用等方面的性能指标来进行比较. 2.内容 比较的数据集,是使用的Clickhouse官网提供的6 ...

  3. UE 实现镜头平移,旋转和缩放

    0x00 引 在数字孪生三维场景中,通过键盘和鼠标来控制镜头的移动,缩放是很常见的行为,也是很必要的行为,用户正是通过这些操作,达到对整个三维场景的观看和控制. 0x01 键盘控制镜头前后左右移动 通 ...

  4. mybatis_config xml配置

    <?xml version="1.0" encoding="UTF-8" ?> <!DOCTYPE configuration PUBLIC ...

  5. HDFS 分布式环境搭建

    HDFS 分布式环境搭建 作者:Grey 原文地址: 博客园:HDFS 分布式环境搭建 CSDN:HDFS 分布式环境搭建 准备四个Linux实例 每个实例对应的 host 和 ip 地址如下 nod ...

  6. gem5 使用记录,对例子中helloobject的理解

    gem5中有一个 hello的例子,不是hello world那个,在src/learning-gem5/part2里面,这是虽然是个简单的例子但包含的要素挺多挺全. 整个结构是src下面有一个hel ...

  7. C语言输入输出格式符

    C语言输入输出格式符 printf函数(格式输出函数) 1.一般格式 printf(格式控制,输出表列) 例如:printf("i=%d,ch=%c\n",i,ch); 说明: ( ...

  8. flink-cdc同步mysql数据到hbase

    本文首发于我的个人博客网站 等待下一个秋-Flink 什么是CDC? CDC是(Change Data Capture 变更数据获取)的简称.核心思想是,监测并捕获数据库的变动(包括数据 或 数据表的 ...

  9. thinkphp5.1 cookie跨域、thinkphp5.1 session跨域、tp5.1cookie跨域

    cookie跨域: //config/cookie.php return [ //... //仅7.3.0及以上适用 'samesite' => 'None', //是否加密cookie值,fa ...

  10. 使用kubeoperator安装k8s集群时自带的traefik-ingress-controller

    前提 承接上一篇文章:https://www.cnblogs.com/sanduzxcvbnm/p/15740596.html traefik-ingress-controller和nginx-ing ...