在Mac下安装Fluentd:
sudo gem install fluentd --no-ri --no-rdoc
WARNING: Error fetching data: too many connection resets (http://production.s3.rubygems.org/specs.4.8.gz) Successfully installed fluentd-0.10.32 1 gem installed
报了这个错误。看不懂,google了下
http://stackoverflow.com/questions/10278174/gem-not-installing-showing-connection-error
This problem was caused by the cachefly server.
It seems that the folks over at rubygems.org disabled this mirror and then people's downloads were able to continue successfully.
There is a thread over at rubygems.org discussing this issue.
不知道怎么解决~于是使用源码安装$ git clone https://github.com/fluent/fluentd.git
$ cd fluentd
$ rake build
Jeweler not available. Install it with: gem install jeweler rake aborted! Don't know how to build task 'build' (See full trace by running task with --trace)
又报错了~~先装jeweler,再rake build。
$ sudo gem install jeweler
$ rake build
/usr/local/Cellar/ruby/1.9.3-p286/lib/ruby/gems/1.9.1/gems/git-1.2.5/lib/git/lib.rb:709: warning: Insecure world writable dir /usr/local in PATH, mode 040777 WARNING: no description specified Successfully built RubyGem Name: fluentd Version: 0.10.32 File: fluentd-0.10.32.gem
$ sudo gem install pkg/fluentd-0.10.32.gem安装好啦~~接下来测试安装情况
$ fluentd --setup ./fluent -bash: fluentd: command not found
修改~/.bash_profile,添加
export PATH="/usr/local/Cellar/ruby/1.9.3-p286/lib/ruby/gems/1.9.1/gems/fluentd-0.10.32/bin:$PATH"
再次运行:
$ fluentd --setup ./fluent
$ fluentd -c ./fluent/fluent.conf -vv &
$ echo '{"json":"message"}' | fluent-cat debug.test
2013-03-13 22:41:54 +0800 [trace]: plugin/in_forward.rb:147:initialize: accepted fluent socket object_id=70313253903680 2013-03-13 22:41:54 +0800 debug.test: {"json":"message"} 2013-03-13 22:41:54 +0800 [trace]: plugin/in_forward.rb:188:on_close: closed fluent socket object_id=70313253903680
更多安装方式:
http://docs.fluentd.org/categories/installation
http://www.cnblogs.com/xuxm2007/archive/2013/01/25/2876590.html
安装mongo插件
$ sudo gem install fluent-plugin-mongo
Fetching: bson-1.6.4.gem (100%) Fetching: mongo-1.6.4.gem (100%) Fetching: fluent-plugin-mongo-0.6.13.gem (100%) Successfully installed bson-1.6.4 Successfully installed mongo-1.6.4 Successfully installed fluent-plugin-mongo-0.6.13 3 gems installed
$ sudo fluent-gem install fluent-plugin-mongo
Successfully installed fluent-plugin-mongo-0.6.13 1 gem installed Installing ri documentation for fluent-plugin-mongo-0.6.13... Installing RDoc documentation for fluent-plugin-mongo-0.6.13...
$ fluentd -c ./fluent/fluent.conf -vv & ........ 2013-03-14 23:21:25 +0800 [info]: fluent/engine.rb:61:configure: using configuration file: <ROOT> <source> type forward </source> <source> type http port 8888 </source> <source> type tail format apache2 path /private/var/log/apache2/access_log pos_file /var/log/td-agent/apache2.access_log.pos tag mongo.apache </source> <source> type debug_agent port 24230 </source> <match debug.**> type stdout </match> <match mongo.**> type mongo database apache collection access host 127.0.0.1 port 27017 flush_interval 10s </match> </ROOT> 2013-03-14 23:21:25 +0800 [info]: fluent/engine.rb:70:block in configure: adding source type="forward" 2013-03-14 23:21:25 +0800 [info]: fluent/engine.rb:70:block in configure: adding source type="http" 2013-03-14 23:21:25 +0800 [info]: fluent/engine.rb:70:block in configure: adding source type="tail" 2013-03-14 23:21:25 +0800 [info]: fluent/engine.rb:70:block in configure: adding source type="debug_agent" 2013-03-14 23:21:25 +0800 [info]: fluent/engine.rb:86:block in configure: adding match pattern="debug.**" type="stdout" 2013-03-14 23:21:25 +0800 [info]: fluent/engine.rb:86:block in configure: adding match pattern="mongo.**" type="mongo" 2013-03-14 23:21:25 +0800 [trace]: fluent/plugin.rb:89:register_impl: registered output plugin 'mongo' /usr/local/Cellar/ruby/1.9.3-p286/lib/ruby/1.9.1/rubygems/custom_require.rb:36: stack level too deep (SystemStackError) 2013-03-14 23:21:25 +0800 [info]: fluent/supervisor.rb:170:supervise: process finished code=256 2013-03-14 23:21:25 +0800 [warn]: fluent/supervisor.rb:173:supervise: process died within 1 second. exit.2013-03-14 23:21:25 +0800 [trace]: fluent/plugin.rb:89:register_impl: registered output plugin 'mongo'
这是什么东西~,各种谷歌,头都大了,还是不知道怎么解决,只好向github求助
https://github.com/fluent/fluentd/issues/110 ,
在@ repeatedly 的建议下,
I first heard this issue.
Could you reduce the cause of this case?
For example:
我降低了fluentd 的版本,重新安装bson_ext版本(保持跟mongo同一版本),这才解决了问题。具体解决过程在上面issues链接里。
第一次在英文网站发表问题,让英语小学水平的我获得一点点兴奋和满足,哈哈~
一点点消除错误,一点点减少挫败感