pinpoint的Hbase数据库的数据优化
写的原因:
因为是测试服务器,在运行测试项目时,需要日志的打印输出,由于发现磁盘空间不足,想删除些东西,释放空间,然后发现pinpoint服务的Hbase数据库占据了18G空间,其中TraceV2表占据了13G。
解决的方法:
进入Hbase数据库后,使用desc 'TraceV2'
看了TraceV2的表结构,他的一个TTL值默认是60 DAY(这是我按照pinpoint的官方默认表结构),意思是保留60天内的记录,超出后才清理。我就寻思想把这个记录保留时间变为3 DAY。
我写了一个hbase,shell命令文本,是把这里边的表都改为3 day
bin/hbase shell test.hbase
以下是test.habse文本内容。
cat test.hbase
disable 'AgentInfo'
disable 'AgentLifeCycle'
disable 'AgentStatV2'
disable 'ApiMetaData'
disable 'ApplicationIndex'
disable 'ApplicationMapStatisticsCallee_Ver2'
disable 'ApplicationMapStatisticsCaller_Ver2'
disable 'ApplicationMapStatisticsSelf_Ver2'
disable 'ApplicationStatAggre'
disable 'ApplicationTraceIndex'
disable 'HostApplicationMap_Ver2'
disable 'SqlMetaData_Ver2'
disable 'StringMetaData'
disable 'TraceV2'
alter 'AgentEvent',{NAME => 'E',TTL => '2592