pinpoint 修改hbase表TTL值

参考文档

https://greatwqs.iteye.com/blog/1741330

缘起
Pinpoint接入业务监控后数据量大涨,平均每天Hbase数据增量20G左右,数据量太大,需要对数据进行定期清理,否则监控可用性降低,由于之前环境是由docker-compose部署,查到hbase可以修改表的ttl来清理数据,目前进入pinpoint-hbase容器操作,如果能在hbase表格生成时就修改ttl效果会更佳,该方法需要熟悉docker-compose里面pinpoint-web及pinpoint-hbase部署方法,后期跟进

操作步骤
查找出数据大的hbase表

[email protected]:/opt/hbase/hbase-1.2.6# ls
CHANGES.txt  LICENSE.txt  README.txt  conf  hbase-webapps  logs
LEGAL        NOTICE.txt   bin         docs  lib
[email protected]:/opt/hbase/hbase-1.2.6# cd bin/
[email protected]:/opt/hbase/hbase-1.2.6/bin# ls
draining_servers.rb   hbase-jruby         rolling-restart.sh
get-active-master.rb  hbase.cmd           shutdown_regionserver.rb
graceful_stop.sh      hirb.rb             start-hbase.cmd
hbase             local-master-backup.sh  start-hbase.sh
hbase-cleanup.sh      local-regionservers.sh  stop-hbase.cmd
hbase-common.sh       master-backup.sh        stop-hbase.sh
hbase-config.cmd      region_mover.rb         test
hbase-config.sh       region_status.rb        thread-pool.rb
hbase-daemon.sh       regionservers.sh        zookeepers.sh
hbase-daemons.sh      replication

[email protected]:/home/pinpoint/hbase/data/default# ls
AgentEvent  AgentStatV2   ApplicationMapStatisticsCallee_Ver2  ApplicationStatAggre SqlMetaData_Ver2
AgentInfo   ApiMetaData   ApplicationMapStatisticsCaller_Ver2  ApplicationTraceIndex    StringMetaData
AgentLifeCycle  ApplicationIndex  ApplicationMapStatisticsSelf_Ver2    HostApplicationMap_Ver2  TraceV2

[email protected]:/home/pinpoint/hbase/data/default# du -h |grep G
17G ./TraceV2
2.2G    ./ApplicationTraceIndex
19G .

24小时产生数据大概20G,发现其中TraceV2及ApplicationTraceIndex数据比较大,设置TTL分别为7Day及14Day

进入hbase修改表ttl

[email protected]:/opt/hbase/hbase-1.2.6/bin# ./hbase shell
2019-04-26 12:31:44,071 WARN  [main] util.NativeCodeLoader: Unable to load native-hadoop library for your platform... using builtin-java classes where applicable
HBase Shell; enter ‘help<RETURN>‘ for list of supported commands.
Type "exit<RETURN>" to leave the HBase Shell
Version 1.2.6, rUnknown, Mon May 29 02:25:32 CDT 2017

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.1750 seconds

=> ["AgentEvent", "AgentInfo", "AgentLifeCycle", "AgentStatV2", "ApiMetaData", "ApplicationIndex", "ApplicationMapStatisticsCallee_Ver2", "ApplicationMapStatisticsCaller_Ver2", "ApplicationMapStatisticsSelf_Ver2", "ApplicationStatAggre", "ApplicationTraceIndex", "HostApplicationMap_Ver2", "SqlMetaData_Ver2", "StringMetaData", "TraceV2"]

hbase(main):002:0> describe ‘TraceV2‘
Table TraceV2 is ENABLED
TraceV2
COLUMN FAMILIES DESCRIPTION
{NAME => ‘S‘, BLOOMFILTER => ‘ROW‘, VERSIONS => ‘1‘, IN_MEMORY => ‘false‘, KEEP_DELETED_CELLS => ‘FALSE‘, DATA_BLOCK_ENCODING => ‘PREFIX‘, TTL => ‘5184000 SECONDS (60 DAYS)‘, COMPRESSION => ‘NONE‘, MIN_VERSIONS => ‘0‘, BLOCKCACHE => ‘true‘, BLOCKSIZE => ‘65536‘, REPLICATION_SCOPE => ‘0‘}
1 row(s) in 0.1000 seconds

hbase(main):003:0> disable ‘TraceV2‘
0 row(s) in 8.3610 seconds

hbase(main):004:0> alter ‘TraceV2‘ , {NAME=>‘S‘,TTL=>‘604800‘}
Updating all regions with the new schema...
256/256 regions updated.
Done.
0 row(s) in 1.9750 seconds

hbase(main):001:0>
hbase(main):002:0* enable ‘TraceV2‘
0 row(s) in 28.5440 seconds

hbase(main):003:0> describe  ‘TraceV2‘
Table TraceV2 is ENABLED
TraceV2
COLUMN FAMILIES DESCRIPTION
{NAME => ‘S‘, BLOOMFILTER => ‘ROW‘, VERSIONS => ‘1‘, IN_MEMORY => ‘false‘, KEEP_DELETED_CELLS => ‘FALSE‘, DATA_BLOCK_ENCODING => ‘PREFIX‘, TTL => ‘604800 SECONDS (7 DAYS)‘, COMPRESSION => ‘NONE‘, MIN_VERSIONS => ‘0‘, BLOCKCACHE => ‘true‘, BLOCKSIZE => ‘65536‘, REPLICATION_SCOPE => ‘0‘}
1 row(s) in 0.2410 seconds

设置ApplicationTraceIndex的TTL为 14天
hbase(main):004:0> describe  ‘ApplicationTraceIndex‘
Table ApplicationTraceIndex is ENABLED
ApplicationTraceIndex
COLUMN FAMILIES DESCRIPTION
{NAME => ‘I‘, BLOOMFILTER => ‘ROW‘, VERSIONS => ‘1‘, IN_MEMORY => ‘false‘, KEEP_DELETED_CELLS => ‘FALSE‘, DATA_BLOCK_ENCODING => ‘PREFIX‘, TTL => ‘5184000 SECONDS (60 DAYS)‘, COMPRESSION => ‘NONE‘, MIN_VERSIONS => ‘0‘, BLOCKCACHE => ‘true‘, BLOCKSIZE => ‘65536‘, REPLICATION_SCOPE => ‘0‘}
1 row(s) in 0.0240 seconds

hbase(main):007:0> disable ‘ApplicationTraceIndex‘
0 row(s) in 2.2970 seconds

hbase(main):008:0> alter ‘ApplicationTraceIndex‘ , {NAME=>‘I‘,TTL=>‘1209600‘}
Updating all regions with the new schema...
16/16 regions updated.
Done.
0 row(s) in 1.9250 seconds

hbase(main):009:0> enable ‘ApplicationTraceIndex‘
0 row(s) in 2.2350 seconds

hbase(main):010:0> describe  ‘ApplicationTraceIndex‘
Table ApplicationTraceIndex is ENABLED
ApplicationTraceIndex
COLUMN FAMILIES DESCRIPTION
{NAME => ‘I‘, BLOOMFILTER => ‘ROW‘, VERSIONS => ‘1‘, IN_MEMORY => ‘false‘, KEEP_DELETED_CELLS => ‘FALSE‘, DATA_BLOCK_ENCODING => ‘PREFIX‘, TTL => ‘1209600 SECONDS (14 DAYS)‘, COMPRESSION => ‘NONE‘, MIN_VERSIONS => ‘0‘, BLOCKCACHE => ‘true‘, BLOCKSIZE => ‘65536‘, REPLICATION_SCOPE => ‘0‘}
1 row(s) in 0.0290 seconds

hbase(main):012:0> major_compact  ‘ApplicationTraceIndex‘
0 row(s) in 0.3740 seconds

备注

major_compact的操作目的
合并文件
清除删除、过期、多余版本的数据
提高读写数据的效率

604800  7day
describe  ‘TraceV2‘
disable ‘TraceV2‘
alter ‘TraceV2‘ , {NAME=>‘S‘,TTL=>‘604800‘}
enable ‘TraceV2‘
disable ‘TraceV2‘
major_compact  ‘TraceV2‘

1209600  14day
describe  ‘ApplicationTraceIndex‘
disable ‘ApplicationTraceIndex‘
alter ‘ApplicationTraceIndex‘ , {NAME=>‘I‘,TTL=>‘1209600‘}
enable ‘ApplicationTraceIndex‘
disable ‘ApplicationTraceIndex‘
major_compact  ‘ApplicationTraceIndex‘

原文地址:https://blog.51cto.com/jerrymin/2386757

时间: 2024-11-14 10:58:32

pinpoint 修改hbase表TTL值的相关文章

sql update from 修改一个表的值来自另一个表

假设有桌子表名 icate_table_set(table_id,table_name,table_state_id,store_id), 桌子状态表名icate_table_state(state_id,state_name,state_attr状态属性如空桌,使用中等,store_id) store_id假设是分店ID  各分店的状态名可能一样可能不一样但是属性是一样的 现在要把所有桌子改为对应如空桌状态(1为空桌) UPDATE icate_table_set SET table_stat

对已经存在的hbase表修改压缩方式

业务上可能会遇到这种情况,在最初创建hbase表时候,未指定压缩方式,当数据导入之后,由rowkey带来的数据膨胀导致hdfs上的数据大小远远大于原始数据大小.所以这时候可能就不得不考虑使用压缩,但是如果将表删除,再创建一张指定压缩的表,再重新导入数据未免太浪费时间.当然也完全不用这样,可以直接修改hbase表的压缩方式,然后在执行major_compact即可 disable 'testcompression' //首先将表下线 alter 'testcompression', NAME =>

修改注册表~使自启动

[转自互联网] 1 #include <windows.h> 2 #include <stdio.h> 3 #pragma comment(lib,"Advapi32.lib") 4 void CreateStringReg(HKEY hRoot,char *szSubKey,char* ValueName,char *Data) 5 { 6 HKEY hKey; 7 //打开注册表键,不存在则创建它 8 long lRet=RegCreateKeyEx(hRo

Ubuntu - Dconf 注册表键值修改参考表

gsettings reset org.gnome.desktop.wm.preferences theme默认gnomegsettings set org.gnome.desktop.interface clock-show-date true顶部面板显示日期gsettings set org.gnome.SessionManager logout-prompt 'false'禁止注销重关机启延时gsettings set org.gnome.desktop.interface cursor-

ORA-01779: 无法修改与非键值保存表对应的列

一.如果两张表有主键关系的话: 执行更新 UPDATE (SELECT tt1.col1 ,tt2.cola,tt1.id,tt2.id FROM tt1,tt2 WHERE tt1.ID=tt2.ID) SET col1=cola; 报错:ORA-01779: 无法修改与非键值保存表对应的列 分析 根据错误提示:”无法修改与非键值保存表对应的列”,初步推断为tt2中没有主键? 那么在tt2上添加主键后再更新试试 ALTER TABLE tt2 ADD CONSTRAINT pk_tt2_id

修改表默认值

1 2 3 4 5 6 7 8 9 10 11 12 13 ALTER TABLE 表名 add DEFAULT ('修改后的默认值') for 字段名 WITH VALUES 注:如果该字段以前已经有默认值了,在修改之前需要先将约束删除,否则会报错  删约束的SQL:  Alter table 表名 drop constraint 约束名  关于约束名,需要先查一下,  查约束名的SQL:  select c.name from sysconstraints a  inner join sys

hbase建表create高级属性 //hbase 表预分区也就是手动分区 这个很重要

2019/2/19 星期二 hbase建表create高级属性 //hbase 表预分区也就是手动分区 这个很重要 下面几个shell 命令在后续的hbase 操作中可以起到很到的作用,且主要体现在建表的过程中,看下面几个create 属性1.BLOOMFILTER 默认是NONE 是否使用布隆过虑使用何种方式布隆过滤可以每列族单独启用.使用HColumnDescriptor.setBloomFilterType(NONE |ROW | ROWCOL) 对列族单独启用布隆.Default = N

pinpoint 单机HBASE数据量过大问题解决

Pinpoint接入业务监控后数据量大涨,平均每周Hbase数据增量25G左右,数据量太大,需要对数据进行定期清理,否则监控可用性降低. 操作步骤 查找出数据大的hbase表 [[email protected] worker]# du -sh hbase/data/default/* 2.2M hbase/data/default/AgentEvent 348K hbase/data/default/AgentInfo 2.6M hbase/data/default/AgentLifeCycl

HBase表管理系统

1. 软件版本 & 部署: maven:3.3.9,jdk:1.7 ,Struts2:2.3.24.1,Hibernate:4.3.6,Spring:4.2.5,MySQL:5.1.34,Junit:4,Myeclipse:2014: Hadoop2.6.4,HBase1.1.2 源码下载:https://github.com/fansy1990/ssh_v3/releases 部署参考:http://blog.csdn.net/fansy1990/article/details/5135658