Java自学者论坛

 找回密码
 立即注册

手机号码,快捷登录

恭喜Java自学者论坛(https://www.javazxz.com)已经为数万Java学习者服务超过8年了!积累会员资料超过10000G+
成为本站VIP会员,下载本站10000G+会员资源,会员资料板块,购买链接:点击进入购买VIP会员

JAVA高级面试进阶训练营视频教程

Java架构师系统进阶VIP课程

分布式高可用全栈开发微服务教程Go语言视频零基础入门到精通Java架构师3期(课件+源码)
Java开发全终端实战租房项目视频教程SpringBoot2.X入门到高级使用教程大数据培训第六期全套视频教程深度学习(CNN RNN GAN)算法原理Java亿级流量电商系统视频教程
互联网架构师视频教程年薪50万Spark2.0从入门到精通年薪50万!人工智能学习路线教程年薪50万大数据入门到精通学习路线年薪50万机器学习入门到精通教程
仿小米商城类app和小程序视频教程深度学习数据分析基础到实战最新黑马javaEE2.1就业课程从 0到JVM实战高手教程MySQL入门到精通教程
查看: 934|回复: 0

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

[复制链接]
  • TA的每日心情
    奋斗
    6 天前
  • 签到天数: 803 天

    [LV.10]以坛为家III

    2053

    主题

    2111

    帖子

    72万

    积分

    管理员

    Rank: 9Rank: 9Rank: 9

    积分
    726482
    发表于 2021-5-5 00:18:47 | 显示全部楼层 |阅读模式

    Pinpoint接入业务监控后数据量大涨,平均每周Hbase数据增量35G左右,数据量太大,需要对数据进行定期清理,否则监控可用性降低。

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

    [root@iZ28ovlz7ccZ worker]# du -sh hbase/data/default/*
    
    2.2M    hbase/data/default/AgentEvent
    
    348K    hbase/data/default/AgentInfo
    
    2.6M    hbase/data/default/AgentLifeCycle
    
    329M    hbase/data/default/AgentStatV2
    
    34M hbase/data/default/ApiMetaData
    
    44K hbase/data/default/ApplicationIndex
    
    66M hbase/data/default/ApplicationMapStatisticsCallee_Ver2
    
    60M hbase/data/default/ApplicationMapStatisticsCaller_Ver2
    
    16M hbase/data/default/ApplicationMapStatisticsSelf_Ver2
    
    1.1M    hbase/data/default/ApplicationStatAggre
    
    1.1G    hbase/data/default/ApplicationTraceIndex
    
    976K    hbase/data/default/HostApplicationMap_Ver2
    
    15M hbase/data/default/SqlMetaData_Ver2
    
    848K    hbase/data/default/StringMetaData
    
    21G hbase/data/default/TraceV2
    
     

     

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

    进入hbase修改表ttl

    [root@iZ28ovlz7ccZ ~]# /usr/local/hbase-1.0.3/bin/hbase shell
    
    2019-08-19 15:43:20,320 WARN  [main] util.NativeCodeLoader: Unable to load native-hadoop library for your platform... using builtin-java classes where applicable
    
    hbase(main):002: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.0100 seconds
    
     
    
    => ["AgentEvent", "AgentInfo", "AgentLifeCycle", "AgentStatV2", "ApiMetaData", "ApplicationIndex", "ApplicationMapStatisticsCallee_Ver2", "ApplicationMapStatisticsCaller_Ver2", "ApplicationMapStatisticsSelf_Ver2", "ApplicationStatAggre", "ApplicationTraceIndex", "HostApplicationMap_Ver2", "SqlMetaData_Ver2", "StringMetaData", "TraceV2"]
    
    hbase(main):004: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.1190 seconds
    
    hbase(main):005:0> disable 'TraceV2'
    
    0 row(s) in 4.2190 seconds
    
    hbase(main):006:0> alter 'TraceV2' , {NAME=>'S',TTL=>'604800'}
    
    Updating all regions with the new schema...
    
    256/256 regions updated.
    
    Done.
    
    0 row(s) in 1.0980 seconds
    
    hbase(main):009:0> enable 'TraceV2'
    
    0 row(s) in 4.2370 seconds
    
     
    
    hbase(main):010: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.0160 seconds

    hbase(main):011:0> major_compact  'TraceV2'
    0 row(s) in 0.4900 seconds
     
     

     

    设置ApplicationTraceIndex的TTL为 14天

    hbase(main):011: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.0150 seconds
    
     
    
    hbase(main):012:0> disable 'ApplicationTraceIndex'
    
    0 row(s) in 1.1660 seconds
    
     
    
    hbase(main):013:0> alter 'ApplicationTraceIndex' , {NAME=>'I',TTL=>'1209600'}
    
    Updating all regions with the new schema...
    
    16/16 regions updated.
    
    Done.
    
    0 row(s) in 1.0550 seconds
    
     
    
    hbase(main):014:0> enable 'ApplicationTraceIndex'
    
    0 row(s) in 0.3520 seconds
    
     
    
    hbase(main):015: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.0200 seconds
    
     
    
    hbase(main):016:0> major_compact  'ApplicationTraceIndex'
    
    0 row(s) in 0.1660 seconds
    
     

     

    备注:

    major_compact目的

    1.合并文件

    2.清除删除、过期、多余版本的数据

    3.提高读写数据的效率

     

    604800  7day

    describe  'TraceV2'

    disable 'TraceV2'

    alter 'TraceV2' , {NAME=>'S',TTL=>'604800'}

    enable 'TraceV2'

    describe 'TraceV2'

    major_compact  'TraceV2'

     

     

    1209600  14day

    describe  'ApplicationTraceIndex'

    disable 'ApplicationTraceIndex'

    alter 'ApplicationTraceIndex' , {NAME=>'I',TTL=>'1209600'}

    enable 'ApplicationTraceIndex'

    describe 'ApplicationTraceIndex'

    major_compact  'ApplicationTraceIndex'

     

     最后查看清理完后的数据大小

    [root@iZ28ovlz7ccZ ~]# du -sh /worker/hbase/data/*
    
    14G /worker/hbase/data/default
    
    348K    /worker/hbase/data/hbase

     

     

     

    哎...今天够累的,签到来了1...
    回复

    使用道具 举报

    您需要登录后才可以回帖 登录 | 立即注册

    本版积分规则

    QQ|手机版|小黑屋|Java自学者论坛 ( 声明:本站文章及资料整理自互联网,用于Java自学者交流学习使用,对资料版权不负任何法律责任,若有侵权请及时联系客服屏蔽删除 )

    GMT+8, 2024-11-23 21:17 , Processed in 0.186242 second(s), 30 queries .

    Powered by Discuz! X3.4

    Copyright © 2001-2021, Tencent Cloud.

    快速回复 返回顶部 返回列表