• 对于注定会优秀的人来说,他所需要的,只是时间----博主
  • 手懒得,必受贫穷,手勤的,必得富足----《圣经》
  • 帮助别人,成就自己。愿君在本站能真正有所收获!
  • 如果你在本站中发现任何问题,欢迎留言指正!
  • 宝剑锋从磨砺出,梅花香自苦寒来!
  • 本站开启了防爆破关小黑屋机制,如果您是正常登录但被关进小黑屋,请联系站长解除!

<六>ELK-6.5.3学习笔记–elasticsearch索引管理

ELK eryajf 11个月前 (01-05) 1254°C 已收录 0个评论
本文预计阅读时间 29 分钟
  • 1,查看索引。
  • [root@elk ~]$curl  'localhost:9200/_cat/indices?v'
    health status index                           uuid                   pri rep docs.count docs.deleted store.size pri.store.size
    yellow open   wf4-2018.12.22                  jjRV5VIgTfiv6q8iJ7o69g   5   1     987148            0    328.5mb        328.5mb
    yellow open   yf1-2018.12.25                  fQ_VYwr9QVC3lR_5grMbZw   5   1      27870            0      3.9mb          3.9mb
    yellow open   yf1-2018.12.22                  02oUFAhQT4qSsQruIFad-A   5   1      87549            0       11mb           11mb
    yellow open   wf2-2018.12.24                  yGOPJfu0RI60F3qEl7tUow   5   1     683664            0      108mb          108mb
    green  open   .monitoring-kibana-6-2018.12.24 uIFCkWtSRVeHyFsjEhsrNw   1   0      17276            0      3.3mb          3.3mb
    yellow open   wf5-2018.12.21                  4EPmw4gsQdC1pTtDRN_bHw   5   1    1178566            0    365.8mb        365.8mb
    yellow open   wf5-2018.12.24                  tdmcamTOR3WLV3QD87oRAA   5   1     922208            0    300.1mb        300.1mb
    yellow open   yf2-2018.12.22                  lF9jZAlWTs-RPuUXtYIS0A   5   1       3453            0    955.7kb        955.7kb
    yellow open   wf2-2018.12.20                  rHcSj9HTQ4GmdtKC0Jti2Q   5   1     729169            0    120.4mb        120.4mb
    yellow open   wf6-2018.12.23                  eG_u7bSRSBK9KjV_bykShg   5   1     780374            0    238.6mb        238.6mb
    yellow open   wf2-2018.12.21                  EqRAVZt0TEa65lz_vXe-Yg   5   1     833613            0    137.6mb        137.6mb
    green  open   .monitoring-es-6-2018.12.20     9cj137KuTSiJ_f03ozHjRw   1   0     252715         1342    140.1mb        140.1mb
    yellow open   wf6-2018.12.20                  Vi2W8CR-T4-avVcHlvtblw   5   1     771965            0    236.9mb        236.9mb
    yellow open   wf6-2018.12.22                  Ygm1fRWmR-6FWDHzo6b01w   5   1     806617            0    253.6mb        253.6mb
    yellow open   wf5-2018.12.23                  MjE7n9j8RnWg1iaXeZ78Rw   5   1     965034            0    323.8mb        323.8mb
    yellow open   wf3-2018.12.24                  Por8Fb5oTOe2oLIrjQHasQ   5   1     687247            0    108.8mb        108.8mb
    yellow open   wf4-2018.12.25                  MYdvnUy9TvOYJ6bjnnKNcg   5   1     345203            0    114.8mb        114.8mb
    yellow open   wf2-2018.12.22                  pZRyDlQjRcas5a8ADJz4tw   5   1     797741            0    130.4mb        130.4mb
    yellow open   wf5-2018.12.20                  kc3Lz-KiTi2FXxqNDtDByw   5   1     976625            0    325.2mb        325.2mb
    yellow open   yf1-2018.12.20                  mPpNKYo4TFG8b-AIuKR2mA   5   1      82944            0     10.8mb         10.8mb
    yellow open   wf2-2018.12.23                  Ve3quMvSRi6AOMKCBrPQsA   5   1     754477            0    120.1mb        120.1mb
    yellow open   wf6-2018.12.25                  v43r_cUeTUajiRU7q3n83Q   5   1     271405            0     81.9mb         81.9mb
    green  open   .newakibana_1                   yKhbNPo8Txa8JOL9fhfSbw   1   0          0            0       261b           261b
    yellow open   yf4-2018.12.20                  o7AuGVbWS06r1Vaoc5DN7Q   5   1      83029            0     10.9mb         10.9mb
    yellow open   wf3-2018.12.22                  kDlpAjgRTsKqBVbc0MSH5w   5   1     802308            0    131.7mb        131.7mb
    yellow open   yf3-2018.12.24                  tUo_N44rS0CgNUsEeLEBvQ   5   1     896500            0    146.3mb        146.3mb
    yellow open   logstash-nginx-access-2018-12   ZCPK_OcESUeglzl75PqYGA   5   1   19211932            0      8.9gb          8.9gb
    yellow open   wf6-2018.12.21                  RNqBKXCYS3CZMGof522GlA   5   1     879132            0    266.8mb        266.8mb
    yellow open   yf2-2018.12.24                  HlinQ8W2Qc26Na4EvOadyQ   5   1     456517            0     75.5mb         75.5mb
    yellow open   wf1-2018.12.23                  _YD9-pscTcCxdRTDcVk5aA   5   1     752487            0    119.8mb        119.8mb
    green  open   .monitoring-es-6-2018.12.25     a0dYH288QlKonNsfG03hhA   1   0     225804        10080    155.3mb        155.3mb
    green  open   .monitoring-es-6-2018.12.18     MwHqiBRySR2J4zAb6bcLaQ   1   0     460669        18860    222.5mb        222.5mb
    yellow open   wf4-2018.12.24                  z5E3CS4DSy-pPmQusK0sqQ   5   1     914839            0    298.6mb        298.6mb
    yellow open   yf3-2018.12.22                  X3z2128QTCyCTThtuELFBg   5   1       3456            0    914.9kb        914.9kb
    yellow open   wf4-2018.12.21                  a-Yd46WESTaPDtVvdI0ogg   5   1    1182077            0    366.7mb        366.7mb
    yellow open   wf1-2018.12.24                  _Z_t0HuZShG1iq-1QC5nMw   5   1     689415            0    109.2mb        109.2mb
    yellow open   wf3-2018.12.20                  RxJJozV2TSGLlePYIPFwAA   5   1     722696            0    119.9mb        119.9mb
    green  open   .monitoring-kibana-6-2018.12.19 59sHqlzeQE-gr35Zic0LLw   1   0       8291            0      2.6mb          2.6mb
    yellow open   wf1-2018.12.22                  Nq5AsVocSwe6za5_XpG1Bg   5   1     795699            0    130.4mb        130.4mb
    yellow open   wf5-2018.12.25                  NMxEc7AnSkWzXHhE542J2g   5   1     343157            0    112.6mb        112.6mb
    green  open   .monitoring-es-6-2018.12.21     LWEfDSZYSJOrsZ8SmTF8kw   1   0     338715         4032    194.5mb        194.5mb
    yellow open   yf2-2018.12.21                  AUNgViEIT_ey0F4iSucxAQ   5   1       4594            0      1.7mb          1.7mb
    yellow open   yf2-2018.12.23                  pofWG8tWSyiX4w0YgRBvig   5   1       3456            0    874.5kb        874.5kb
    yellow open   wf3-2018.12.23                  1FraDw-3TE-j0pj52yZ8tw   5   1     749250            0    119.4mb        119.4mb
    green  open   .monitoring-kibana-6-2018.12.21 wb-6_lAPRR-RBGktnFqWOg   1   0      17276            0      3.4mb          3.4mb
    yellow open   wf1-2018.12.20                  z_ISOyHlS1eRXxGp1Byrwg   5   1     973777            0      159mb          159mb
    yellow open   yf3-2018.12.21                  3j2MM-mlQCOXmSAOWUQ4Iw   5   1       4721            0      1.5mb          1.5mb
    green  open   .monitoring-es-6-2018.12.22     Zjz4t_fySWWC1stOrPU-OA   1   0     442509         5542    252.8mb        252.8mb
    yellow open   yf4-2018.12.25                  7u7ADSk8Sc2xVBQEvcgBdQ   5   1      27953            0        4mb            4mb
    yellow open   yf3-2018.12.25                  jrhWhJTVSeq4CK2bK1XkxA   5   1       3042            0      1.8mb          1.8mb
    green  open   .monitoring-es-6-2018.12.19     V543MHwZSeW6JLMxVgb6pw   1   0      99229         8538     43.3mb         43.3mb
    yellow open   yf4-2018.12.24                  Jjn7KfY6QQyAjxQNbw31BA   5   1     129340            0     18.2mb         18.2mb
    yellow open   yf4-2018.12.22                  WGr4vuvWSKeO6pRD3rwl2Q   5   1      87552            0     11.1mb         11.1mb
    yellow open   yf1-2018.12.21                  y9IQ6gPGToe4zNiC8H2Gmw   5   1      87978            0     11.3mb         11.3mb
    green  open   .tasks                          Wh2WiKW-SRuR_fR6t14Rcw   1   0          1            0      6.2kb          6.2kb
    green  open   .monitoring-es-6-2018.12.23     U2hmu-GVRlyKx5b4IND1Rg   1   0     546436         6691    299.1mb        299.1mb
    yellow open   wf3-2018.12.21                  9vu65HJgTAiS8P6sFxLrNQ   5   1     831776            0    137.7mb        137.7mb
    yellow open   yf2-2018.12.20                  SWkBA1vrQLyeFhTnDyTWEg   5   1       7081            0      2.4mb          2.4mb
    yellow open   yf4-2018.12.23                  qHyK0yDrSSmpMqFsbuKulg   5   1      87549            0     11.1mb         11.1mb
    yellow open   yf3-2018.12.20                  GWujzIc4Sx6ekKL0cUHu8w   5   1       6763            0      2.7mb          2.7mb
    yellow open   wf4-2018.12.20                  jT8xleSZQ0yT4xtwYqhBfQ   5   1     960724            0    318.2mb        318.2mb
    yellow open   yf1-2018.12.24                  lwb7v1u-S4-o7lKvOgsj7A   5   1     131699            0     18.4mb         18.4mb
    yellow open   wf2-2018.12.25                  sgEb3lf9Tz-kTs8n6z3LJg   5   1     230312            0     39.1mb         39.1mb
    green  open   .monitoring-kibana-6-2018.12.25 jQQiSq7rQfSjMD4i7PRC3A   1   0       5238            0      1.1mb          1.1mb
    green  open   .newkibana_2                    e87PQRE0TQOA1IevT7Vr7A   1   0         18            8       59kb           59kb
    green  open   .monitoring-kibana-6-2018.12.23 K5JRbvvIQUSfLZVURdfAoA   1   0      17274            0      3.3mb          3.3mb
    yellow open   yf3-2018.12.23                  6k-QdQGeRb2uqe_ChyeGTQ   5   1       3456            0    918.8kb        918.8kb
    yellow open   yf4-2018.12.21                  pdlPPoBTTy2MdU-QT4aUKA   5   1      87921            0     11.2mb         11.2mb
    yellow open   wf4-2018.12.23                  SoobGvkrTUe-WeRpzQSCtQ   5   1     955903            0    319.8mb        319.8mb
    green  open   .monitoring-kibana-6-2018.12.18 KS5oKtpgTUiia5NkteCGvw   1   0      10941            0      3.2mb          3.2mb
    green  open   .monitoring-kibana-6-2018.12.20 xiMGIJY_Qs-i2H_C3zFdrw   1   0      14001            0        3mb            3mb
    yellow open   wf1-2018.12.25                  M7LLDaI1QoexnEQIBfdP7A   5   1     227287            0     38.5mb         38.5mb
    yellow open   wf6-2018.12.24                  ysFDJ2HUSJCsXRWD1zZz6A   5   1     731664            0    220.9mb        220.9mb
    yellow open   yf1-2018.12.23                  3eOixFw3SuOqPdDBjALB2w   5   1      87549            0     11.1mb         11.1mb
    yellow open   yf2-2018.12.25                  p8rzGkFjSx-G35si_OIkEQ   5   1       2976            0      1.8mb          1.8mb
    yellow open   wf1-2018.12.21                  Ad7dfIbyTrGbGtSG0hdOzw   5   1     831372            0    137.5mb        137.5mb
    green  open   .newkibana_1                    ao_IxYXDTDyTljxR1b3Fvw   1   0         13            0     30.8kb         30.8kb
    yellow open   wf3-2018.12.25                  RrDqLajjR_iWYaXcAhue1w   5   1     227969            0     38.6mb         38.6mb
    yellow open   wf5-2018.12.22                  wdiLC5iGSC2wNGbKWVTpQA   5   1     981146            0    332.9mb        332.9mb
    green  open   .monitoring-es-6-2018.12.24     _vavT7VoRD-D7BuZQ7C2kg   1   0     646545         7930    358.4mb        358.4mb
    green  open   .monitoring-kibana-6-2018.12.22 yPtt_vzKS_C4hbXfNxQsgw   1   0      17276            0      3.2mb          3.2mb
    
  • 2,删除指定索引。
  • curl -XDELETE -u elastic:changeme http://localhost:9200/acc-apply-2018.08.09
    
  • 3,删除指定多个索引。
  • 多个索引之间用,隔开。

    curl -XDELETE -u elastic:changeme http://localhost:9200/acc-apply-2018.08.09,acc-apply-2018.08.10
    
  • 4,模糊匹配删除。
  • curl -XDELETE -u elastic:changeme http://localhost:9200/acc-apply-*
    
  • 5,使用通配符,删除所有的索引
  •  curl -XDELETE http://localhost:9200/_all
     或 curl -XDELETE http://localhost:9200/*
    

    _all ,* 通配所有的索引

    通常不建议使用通配符,误删了后果就很严重了,所有的index都被删除了
    禁止通配符为了安全起见,可以在elasticsearch.yml配置文件中设置禁用_all和*通配符

    action.destructive_requires_name = true
    

    这样就不能使用_all和*了

  • 6,定时删除索引。
  • 可以通过脚本的形式。删除3天前的索引。

    #!/bin/bash
    time=$(date -d '-3days' +'%Y.%m.%d')
    curl -XDELETE -u elastic:changeme http://localhost:9200/*-${time}
    

    也可以通过写入定时任务。删除3天前的索引。

    30 2 * * * /usr/bin/curl -XDELETE -u elastic:changeme http://localhost:9200/*-$(date -d '-3days' +'%Y.%m.%d') >/dev/null 2>&1
    

    参考:https://www.cnblogs.com/Dev0ps/p/9493576.html


    weinxin
    扫码订阅本站,第一时间获得更新
    微信扫描二维码,订阅我们网站的动态,另外不定时发送WordPress小技巧,你可以随时退订,欢迎订阅哦~

    二丫讲梵 , 版权所有丨如未注明 , 均为原创丨本网站采用BY-NC-SA协议进行授权 , 转载请注明<六>ELK-6.5.3学习笔记–elasticsearch索引管理
    喜欢 (3)
    [如果想支持本站,可支付宝赞助]
    分享 (0)
    eryajf
    关于作者:
    学无止境,我愿意无止境学。书山有路,我愿意举身投火,淬炼成金!

    您必须 登录 才能发表评论!