Redhat linux 下安装fluentd

本文详细介绍了在Redhat Linux系统中安装Fluentd的过程,包括下载安装包、解压、配置、编译、安装Ruby、解决安装过程中遇到的问题,以及验证Fluentd是否成功运行。通过安装Ruby、执行gem install fluentd命令,然后使用fluentd --setup创建配置文件,启动服务,并通过netstat检查监听端口,最后通过发送数据验证Fluentd的输入和输出功能。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

下载fluentd安装包并解压
tar zxvf fluentd-0.10.6.tar.gz 
cd fluentd-0.10.6   
./configure 
make
切换到root账号
make install
提示如下
rake aborted!
Unable to determine name from existing gemspec. Use :name => 'gemname' in #install_tasks to manually set it.
/usr/local/lib/fluent/ruby/lib/ruby/gems/1.9.1/gems/bundler-1.2.1/lib/bundler/gem_helper.rb:30:in `initialize'
/usr/local/lib/fluent/ruby/lib/ruby/gems/1.9.1/gems/bundler-1.2.1/lib/bundler/gem_helper.rb:14:in `new'
/usr/local/lib/fluent/ruby/lib/ruby/gems/1.9.1/gems/bundler-1.2.1/lib/bundler/gem_helper.rb:14:in `install_tasks'
/home/aircom/fluentd-0.10.6/Rakefile:6:in `<top (required)>'
/usr/local/lib/fluent/ruby/lib/ruby/1.9.1/rake.rb:2373:in `load'
/usr/local/lib/fluent/ruby/lib/ruby/1.9.1/rake.rb:2373:in `raw_load_rakefile'
/usr/local/lib/fluent/ruby/lib/ruby/1.9.1/rake.rb:2007:in `block in load_rakefile'
/usr/local/lib/fluent/ruby/lib/ruby/1.9.1/rake.rb:2058:in `standard_exception_handling'
/usr/local/lib/fluent/ruby/lib/ruby/1.9.1/rake.rb:2006:in `load_rakefile'
/usr/local/lib/fluent/ruby/lib/ruby/1.9.1/rake.rb:1991:in `run'
-e:1:in `<main>'
make: *** [install] Error 1


安装ruby
rz ruby-1.9.3-p0.tar.gz
tar zxvf ruby-1.9.3-p0.tar.gz 
cd ruby-1.9.3-p0 
./configure
make 
make install
验证ruby
[root@Server201 ruby-1.9.3-p0]# ruby -v
得到提示信息
ruby 1.9.3p0 (2011-10-30 revision 33570) [x86_64-linux]

执行安装
 gem install fluentd 

提示如下,不必理会,等待安装,稍等一会儿(视网络情况)可看到安装进度。
/usr/local/lib/ruby/1.9.1/yaml.rb:56:in `<top (required)>':
It seems your ruby installation is missing psych (for YAML output).
To eliminate this warning, please install libyaml and reinstall your ruby.
命令执行完之后


执行fluentd --setup 
提示Installed /etc/fluent/fluent.conf.


执行fluentd -c fluent.conf -vv &
输出
 2012-09-27 17:45:16 +0800: fluent/supervisor.rb:153:supervise: starting fluentd-0.10.26
2012-09-27 17:45:16 +0800: fluent/supervisor.rb:235:read_config: reading config file path="fluent.conf"
2012-09-27 17:45:16 +0800: fluent/plugin.rb:89:register_impl: registered buffer plugin 'file'
2012-09-27 17:45:16 +0800: fluent/plugin.rb:89:register_impl: registered buffer plugin 'memory'
2012-09-27 17:45:16 +0800: fluent/plugin.rb:89:register_impl: registered input plugin 'debug_agent'
2012-09-27 17:45:16 +0800: fluent/plugin.rb:89:register_impl: registered input plugin 'exec'
2012-09-27 17:45:16 +0800: fluent/plugin.rb:89:register_impl: registered input plugin 'forward'
2012-09-27 17:45:16 +0800: fluent/plugin.rb:89:register_impl: registered input plugin 'gc_stat'
2012-09-27 17:45:16 +0800: fluent/plugin.rb:89:register_impl: registered input plugin 'http'
2012-09-27 17:45:16 +0800: fluent/plugin.rb:89:register_impl: registered input plugin 'object_space'
2012-09-27 17:45:16 +0800: fluent/plugin.rb:89:register_impl: registered input plugin 'status'
2012-09-27 17:45:16 +0800: fluent/plugin.rb:89:register_impl: registered input plugin 'tcp'
2012-09-27 17:45:16 +0800: fluent/plugin.rb:89:register_impl: registered input plugin 'unix'
2012-09-27 17:45:16 +0800: fluent/plugin.rb:89:register_impl: registered input plugin 'syslog'
2012-09-27 17:45:16 +0800: fluent/plugin.rb:89:register_impl: registered input plugin 'tail'
2012-09-27 17:45:16 +0800: fluent/plugin.rb:89:register_impl: registered output plugin 'copy'
2012-09-27 17:45:16 +0800: fluent/plugin.rb:89:register_impl: registered output plugin 'exec'
2012-09-27 17:45:16 +0800: fluent/plugin.rb:89:register_impl: registered output plugin 'exec_filter'
2012-09-27 17:45:16 +0800: fluent/plugin.rb:89:register_impl: registered output plugin 'file'
2012-09-27 17:45:16 +0800: fluent/plugin.rb:89:register_impl: registered output plugin 'forward'
2012-09-27 17:45:16 +0800: fluent/plugin.rb:89:register_impl: registered output plugin 'null'
2012-09-27 17:45:16 +0800: fluent/plugin.rb:89:register_impl: registered output plugin 'roundrobin'
2012-09-27 17:45:16 +0800: fluent/plugin.rb:89:register_impl: registered output plugin 'stdout'
2012-09-27 17:45:16 +0800: fluent/plugin.rb:89:register_impl: registered output plugin 'tcp'
2012-09-27 17:45:16 +0800: fluent/plugin.rb:89:register_impl: registered output plugin 'unix'
2012-09-27 17:45:16 +0800: fluent/plugin.rb:89:register_impl: registered output plugin 'test'
2012-09-27 17:45:16 +0800: fluent/engine.rb:65:block in configure: adding source type="forward"
2012-09-27 17:45:16 +0800: fluent/engine.rb:65:block in configure: adding source type="http"
2012-09-27 17:45:16 +0800: fluent/engine.rb:81:block in configure: adding match pattern="debug.**" type="stdout"
2012-09-27 17:45:16 +0800: plugin/in_forward.rb:61:listen: listening fluent socket on 0.0.0.0:24224
2012-09-27 17:45:16 +0800: plugin/in_http.rb:74:start: listening http on 0.0.0.0:8888
验证监听端口
netstat -na | grep 88
tcp        0      0 0.0.0.0:8888                0.0.0.0:*                   LISTEN      
tcp        0      0 127.0.0.1:48241             127.0.0.1:8888              TIME_WAIT   
udp        0      0 :::58872                    :::*                                    
unix  2      [ ]         DGRAM                    9880   
unix  2      [ ]         DGRAM                    8859   
unix  2      [ ]         DGRAM                    8846   
unix  2      [ ]         DGRAM                    8806   


发送数据验证
echo '{"json":"message"}'|fluent-cat debug.test
得到输出
2012-09-27 17:45:32 +0800: plugin/in_forward.rb:140:initialize: accepted fluent socket object_id=95324080
2012-09-27 17:45:32 +0800 debug.test: {"json":"message"}
2012-09-27 17:45:32 +0800: plugin/in_forward.rb:181:on_close: closed fluent socket object_id=95324080
至此安装全部完成。
总结:其实直接进行的是在线安装,提前下载fluent包没用。可直接从安装ruby开始,待验证。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值