Fluent 安裝過程


在Mac下安裝Fluentd: html

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了下 git

http://stackoverflow.com/questions/10278174/gem-not-installing-showing-connection-error github

This problem was caused by the cachefly server. shell

It seems that the folks over at rubygems.org disabled this mirror and then people's downloads were able to continue successfully. apache

There is a thread over at rubygems.org discussing this issue. json

不知道怎麼解決~因而使用源碼安裝
$ 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,添加 ruby

export PATH="/usr/local/Cellar/ruby/1.9.3-p286/lib/ruby/gems/1.9.1/gems/fluentd-0.10.32/bin:$PATH"

再次運行: bash

$ 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

更多安裝方式: socket

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'
/usr/local/Cellar/ruby/1.9.3-p286/lib/ruby/1.9.1/rubygems/custom_require.rb:36: stack level too deep (SystemStackError)

這是什麼東西~,各類谷歌,頭都大了,仍是不知道怎麼解決,只好向github求助

https://github.com/fluent/fluentd/issues/110


在@ repeatedly 的建議下,

I first heard this issue.
Could you reduce the cause of this case?

For example:

  • invoke fluentd without sudo
  • remove non-related source or match
  • degrade the fluentd version
  • etc...

我下降了fluentd 的版本,從新安裝bson_ext版本(保持跟mongo同一版本),這才解決了問題。具體解決過程在上面issues連接裏。

第一次在英文網站發表問題,讓英語小學水平的我得到一點點興奮和知足,哈哈~

一點點消除錯誤,一點點減小挫敗感

相關文章
相關標籤/搜索