You need to enable JavaScript to run this app.
导航

升级 LogCollector(宿主机)

最近更新时间2023.12.22 18:33:05

首次发布时间2022.08.16 11:17:17

LogCollector 支持自动升级和手动升级,本文档介绍不同方式升级 LogCollector 的操作步骤。

背景信息

LogCollector 是日志服务提供的日志采集工具,为保证日志采集的稳定性与效率,日志服务建议您始终选用最新版本的 LogCollector 采集服务器日志。为便于版本更新与迭代,提供自动升级和手动升级两种升级方式。

升级方式

说明

自动升级

创建机器组时,如果开启了LogCollector 自动升级,表示启用自动升级功能。
日志服务会在每天的指定时间段对指定机器组进行升级前检查,如果满足升级条件,则自动更新 LogCollector。建议将自动升级时间设置为业务低峰期。自动升级过程中可能会重启 LogCollector,但不会丢失日志。

说明

容器场景 LogCollector 暂不支持自动升级,请手动替换镜像。

启用自动升级,请参考自动升级

手动升级

关闭了LogCollector 自动升级功能的机器组,或不满足 LogCollector 版本要求的机器组,只能通过手动升级来更新 LogCollector 版本。
您需要卸载历史版本 LogCollector,并下载安装最新版本 LogCollector,升级过程中还需要手动迁移断点文件目录和采集配置。
手动升级 LogCollector,请参考手动升级

自动升级 LogCollector

自动升级条件

开启自动升级之后,日志服务会在每天的指定时间段对指定机器组进行以下升级前检查,仅在满足所有升级条件的情况下才会执行自动升级操作。

检查项

说明

当前的 LogCollector 版本是否为 V1.0.8 及后续版本。

仅 V1.0.8 及后续版本的 LogCollector 支持自动升级,请参考手动升级 LogCollector,手动升级到最新版本,才可使用自动升级功能。

当前的 LogCollector 版本是否为最新版本。

日志服务会定期检查 LogCollector 的版本更新情况,若有版本更新,才会进行下一步升级前检查。

LogCollector 的心跳状态是否为正常

心跳状态失败的 LogCollector 无法自动升级,请参考机器组心跳问题排查进行心跳排查。

说明

弹性容器实例 VCI场景下,暂不支持 LogCollector 自动升级功能。

操作步骤

  1. 登录日志服务控制台
  2. 在左侧目录中选择日志服务 > 机器组管理
  3. 机器组管理页面找到需要开启自动升级功能的机器组,并在其对应的操作列单击编辑
  4. 开启LogCollector自动升级功能按钮,并设置自动升级时间
  5. 单击确定
    成功开启自动升级功能之后,在机器组列表中,此机器组在LogCollector自动升级一列中会显示开启

说明

  • 自动升级时间建议设置为业务低峰期。自动升级过程中可能会重启 LogCollector,但不会丢失日志。
  • 如需为多个机器组开启自动升级功能,可以在机器组列表中选择多个机器组,并单击批量 LogCollector 自动升级进行设置。
    图片

手动升级 LogCollector

如果您需要手动升级 LogCollector,需要备份旧版本的断点文件目录及采集配置,并在卸载、重装 LogCollector之后拷贝回原目录。

说明

容器场景 LogCollector暂不支持自动升级,请手动替换镜像。

详细的手动升级步骤如下:

  1. 执行以下命令停止运行旧版本的 LogCollector。

    systemctl stop    filebeatd.service     
    
  2. 备份旧版本中的断点文件目录(/usr/local/filebeat-7.12.0/data)和采集配置(/usr/local/filebeat-7.12.0/etc)到其他目录。
    例如将旧版的断点文件备份至 /tmp/LogCollector-backup 目录下。

    mkdir -p /tmp/LogCollector-backup
    cp -r /usr/local/filebeat-7.12.0/data  /tmp/LogCollector-backup
    cp -r /usr/local/filebeat-7.12.0/etc  /tmp/LogCollector-backup
    
  3. 卸载旧版本的 LogCollector。

    cd /usr/local/filebeat-7.12.0/tools/ && ./filebeat.sh uninstall
    
  4. 下载并安装最新版本的 LogCollector。

    #火山引擎私网下载:
    wget https://logcollector-cn-beijing.tos-cn-beijing.ivolces.com/logcollector.sh && bash ./logcollector.sh cn-beijing && cd /usr/local/filebeat-7.12.0 
    #安装
    cd tools && ./filebeat.sh install
    
  5. 复制步骤 2 中所备份的断点文件目录和采集配置到新版本 LogCollector 目录下。
    若未备份并覆盖相关目录和配置,或者安装后直接启动 LogCollector,可能会造成日志采集异常,例如重复采集日志或 LogCollector 采集配置丢失。

    cp -r /tmp/LogCollector-backup/data  /usr/local/filebeat-7.12.0/   
    cp -r /tmp/LogCollector-backup/etc /usr/local/filebeat-7.12.0/ 
    
  6. 启动 LogCollector。

    systemctl start   filebeatd.service