logstash官方提供的插件安裝方法是:
bin/plugin install logstash-output-webhdfs
按照此方法派殷,不出意料肯定會(huì)出現(xiàn)以下錯(cuò)誤:
[ec2-user@ip-xxx-xxx-xxx-xxx logstash-2.3.0]$ bin/plugin install --no-verify logstash-output-webhdfs
The use of bin/plugin is deprecated and will be removed in a feature release. Please use bin/logstash-plugin.
Installing logstash-output-webhdfs
Error Bundler::InstallError, retrying 1/10
An error occurred while installing snappy (0.0.12), and Bundler cannot continue.
Make sure that `gem install snappy -v '0.0.12'` succeeds before bundling.
WARNING: SSLSocket#session= is not supported
WARNING: SSLSocket#session= is not supported
WARNING: SSLSocket#session= is not supported
原因是:GFW墻掉了logstash的默認(rèn)gem source(類似于CentOS的yum source);
[ec2-user@ip-xxx-xxx-xxx-xxx logstash-2.3.0]$ cat Gemfile | grep source
source "https://rubygems.org"
需要將gem source修改為國(guó)內(nèi)的源,
[ec2-user@ip-xxx-xxx-xxx-xxx logstash-2.3.0]$ vim Gemfile
# This is a Logstash generated Gemfile.
# If you modify this file manually all comments and formatting will be lost.
#source "https://rubygems.org"
source "https://ruby.taobao.org/"
......
執(zhí)行
bin/plugin install logstash-output-webhdfs
一般都能安裝成笙各。
有的插件在淘寶的gem庫中找不到昏苏,這時(shí)候可以考慮本地安裝的辦法鸥咖。
先去https://github.com/logstash-plugins下載對(duì)應(yīng)的插件,然后解壓闪彼,在logstash的Gemfile中添加一行(以logstash-output-webhdfs為例):
[ec2-user@ip-xxx-xxx-xxx-xxx logstash-2.3.0]$ vim Gemfile
......
gem "logstash-output-webhdfs", :path => "/home/ec2-user/logstash-output-webhdfs"
執(zhí)行
bin/logstash-plugin install --no-verify
即可安裝成功