日志收集工具——Fluentd的安装配置

版权声明:本文为博主原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。
本文链接: https://blog.csdn.net/weixin_43707160/article/details/100249814

本文系统安装环境:Centos7 X64

  1. 安装fluentd前需要配置相关系统环境
  • 官网建议在安装节点上配置NTP守护进程,以获得准确时间戳

    1. 安装ntp、ntpdate :yum -y install ntp ntpdate
    1. 启动ntpd服务:sudo systemctl enable ntpd

      sudo systemctl start ntpd 
      
      sudo systemctl status ntpd
      
    1. 添加指定的Centos NTP服务器:# ntpdate -u -s 0.centos.pool.ntp.org 1.centos.pool.ntp.org 2.centos.pool.ntp.org
    1. 开启ntp同步:timedatectl set-ntp yes
    1. 检查ntp同步是否启用:timedatectl
    1. 将硬件时间设置为当前系统时间:hwclock -w
    1. 配置/etc/ntp.conf,指定专门的日志输出,以便检查ntp服务出现异常:
      在这里插入图片描述
  • 增加文件描述符的最大数量。可以使用ulimit -n命令检查当前编号。

    1. 修改/etc/security/limits.conf配置,以增加
      在这里插入图片描述
  • 优化网络内核参数

    1. 若要有很多Fluentd实例组成的高负载环境,需配置/etc/sysctl.conf
      在这里插入图片描述
    1. 使用sysctl -p使配置生效
  1. 安装tg-agent
  • 下载安装,这个shell脚本在/etc/yum.repos.d/td.repo注册一个新的rpm存储库并安装td-agent rpm包。

    sudo curl -L https://toolbelt.treasuredata.com/sh/install-redhat-td-agent3.sh | sh
    
  • 加载启动项:sudo systemctl enable /usr/lib/systemd/system/td-agent.service

  • 利用sudo systemctl start td-agent.service tg-agent

  • /etc/td-agent有默认的配置文件

猜你喜欢

转载自blog.csdn.net/weixin_43707160/article/details/100249814