td-agent is a stable distribution package of Fluentd, which is maintained by Treasure Data.

The installation from Ruby gem presents some difficulties for most users, so we made the package easier to install and use. Learn about the difference between Fluentd and td-agent.

Prerequisites

It's highly recommended that you set up ntpd on the nodes to sync the clock. Otherwise, the logs could contain invalid timestamps.

Install or Upgrade

You can either install or upgrade from a previous version using the following methods. We recommend using td-agent4 as this is the currently maintained version. 

For td-agent4

Redhat / CentOS

CentOS and RHEL 7, 8 64-bit are currently supported.

Executing install-redhat-td-agent4.sh automatically installs td-agent on your machine. The shell script registers a new rpm repository at /etc/yum.repos.d/td.repo and installs the td-agent rpm package.

$ curl -L https://toolbelt.treasuredata.com/sh/install-redhat-td-agent4.sh | sh

For td-agent3

Redhat / CentOS

CentOS and RHEL 6, 7, 8 64-bit are currently supported.

Executing install-redhat-td-agent3.sh automatically installs td-agent on your machine. The shell script registers a new rpm repository at /etc/yum.repos.d/td.repo and installs the td-agent rpm package.

$ curl -L https://toolbelt.treasuredata.com/sh/install-redhat-td-agent3.sh | sh

We use $releasever as the repository path in the script. Use only a major version (such as ver. 7) of RHEL or CentOS as your run environment for $releasever. If your environment uses a version level such as "7.2", change it to a major version or set up the TD repository manually.

see https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/6/html/deployment_guide/sec-setting_repository_options

Launch Daemon

td-agent provides 2 scripts:

systemd (td-agent4 / td-agent3)

The /usr/lib/systemd/system/td-agent script is provided to start, stop, or restart the agent.

$ sudo systemctl start td-agent.service
$ sudo systemctl status td-agent.service
● td-agent.service - td-agent: Fluentd based data collector for Treasure Data
   Loaded: loaded (/lib/systemd/system/td-agent.service; disabled; vendor preset: enabled)
   Active: active (running) since Thu 2017-12-07 15:12:27 PST; 6min ago
     Docs: https://docs.treasuredata.com/articles/td-agent
  Process: 53192 ExecStart = /opt/td-agent/embedded/bin/fluentd --log /var/log/td-agent/td-agent.log --daemon /var/run/td-agent/td-agent.pid (code = exited, statu
 Main PID: 53198 (fluentd)
   CGroup: /system.slice/td-agent.service
           ├─53198 /opt/td-agent/embedded/bin/ruby /opt/td-agent/embedded/bin/fluentd --log /var/log/td-agent/td-agent.log --daemon /var/run/td-agent/td-agent
           └─53203 /opt/td-agent/embedded/bin/ruby -Eascii-8bit:ascii-8bit /opt/td-agent/embedded/bin/fluentd --log /var/log/td-agent/td-agent.log --daemon /v

Dec 07 15:12:27 ubuntu systemd[1]: Starting td-agent: Fluentd based data collector for Treasure Data...
Dec 07 15:12:27 ubuntu systemd[1]: Started td-agent: Fluentd based data collector for Treasure Data.

If you want to customize systemd behavior, put your td-agent.service into /etc/systemd/system

init.d (td-agent2 / td-agent3)

The /etc/init.d/td-agent script is provided to start, stop, or restart the agent.

$ sudo /etc/init.d/td-agent start
Starting td-agent: [  OK  ]
$ sudo /etc/init.d/td-agent status
td-agent (pid  21678) is running...

The following commands are supported:

$ sudo /etc/init.d/td-agent start
$ sudo /etc/init.d/td-agent stop
$ sudo /etc/init.d/td-agent restart
$ sudo /etc/init.d/td-agent status

Make sure your configuration file is located at /etc/td-agent/td-agent.conf.

Cookbook

If you have many machines on which to install td-agent, consider using the OpsCode chef cookbook, to automate this td-agent process. For the td-agent cookbook, refer to: https://github.com/treasure-data/chef-td-agent.

Other Resources

The ChangeLog for td-agent is available here.

For those who are using Treasure Data, refer to the following document too.




  • No labels