Fluentd(td-agent)安装

一:安装

(1)下载td-agent-2.2.1-0.el6.x86_64.rpm,下载地址:https://td-agent-package-browser.herokuapp.com/2/redhat/6/x86_64

 下载安装包到到 /export/installer/文件夹下,安装.

 安装后的目录为/etc/td-agent.

  (2)touch /dev/shm/record.log 用于log_generator 输出日志信息的文件

     (3)编辑td-agent.conf


     type   kafka
     host   192.168.179.18
     port   9092
     topics test
     format json
     interval 10
     # socket_timeout_ms 30000    
     # add_prefix 
     # add_suffix 
     # max_bytes           (integer)    :default => nil (Use default of Poseidon)
     # max_wait_ms         (integer)    :default => nil (Use default of Poseidon)
     # min_bytes           (integer)    :default => nil (Use default of Poseidon)
     # socket_timeout_ms   (integer)    :default => nil (Use default of Poseidon)
    



        type copy
   
        type elasticsearch
        index_name fluentd
        type_name fluentd-type
        logstash_format true
        logstash_prefix fluentd-grabbed
        host 192.168.179.18
        port 9200
        flush_interval 1s
    


      # For debug
      
          type file
          path /tmp/copy.log
         append true
          buffer_type memory
         flush_interval 1s
      



(4)连接ES

首先要安装 fluent-plugin-elasticsearch 插件,是 ruby gem 形式,安装机器不能连外网,可以参考我的另一篇文件关于离线安装fluent-plugin-kafka插件.

下载fluent-plugin-elasticsearch 插件所需的依赖到同一个目录下。

插件列表如下::

  • elasticsearch-1.0.12.gem
  • elasticsearch-api-1.0.12.gem
  • elasticsearch-transport-1.0.12.gem
  • excon-0.45.4.gem
  • faraday-0.9.1.gem
  • fluent-plugin-elasticsearch-1.0.0.gem
  • multi_json-1.11.2.gem
  • multipart-post-2.0.0.gem

  然后gem install 命令如下

/opt/td-agent/embedded/bin/gem install fluent-plugin-elasticsearch-1.0.0.gem


(5)安装fluent-plugin-kafka插件.

下载fluent-plugin-kafka所需依赖插件,见我的另一篇文件关于离线安装fluent-plugin-kafka插件。

下载后的插件列表如下:

cool.io-1.3.1.gem

fluentd-0.12.15.gem

fluent-plugin-kafka-0.0.15.gem

http_parser.rb-0.6.0.gem

json-1.8.3.gem

ltsv-0.1.0.gem

msgpack-0.5.12.gem

poseidon-0.0.5.gem

sigdump-0.2.3.gem

string-scrub-0.0.5.gem

thread_safe-0.3.5.gem

tzinfo-1.2.2.gem

tzinfo-data-1.2015.6.gem

yajl-ruby-1.2.1.gem

zookeeper-1.4.10.gem

然后gem install命令如下:

/opt/td-agent/embedded/bin/gem install fluent-plugin-kafka-0.0.15.gem



(5)启动td-agent

service td-agent start




你可能感兴趣的:(Fluentd(td-agent)安装)