本人最初将此解决方案发布在 ELK中文社区 http://elasticsearch.cn/question/1046
由于生产环境无法连接互联网,所有再一台联网机器上将所有插件做了 pack
拖到生产机上使用 logstash-plugin unpack xxxx.zip
再执行logstash-plugin install --local xxxxxxx 就报错,2.X.X版本的没有问题
报错信息如下:
[root@d4jtporvura06 logstash-5.0.]# ./bin/logstash-plugin install --local logstash-filter-translate
Installing logstash-filter-translate
Dec , :: AM org.apache.maven.wagon.providers.http.httpclient.impl.execchain.RetryExec execute
INFO: I/O exception (java.net.SocketException) caught when processing request to {s}->https://repo.maven.apache.org:443: Network is unreachable
Dec , :: AM org.apache.maven.wagon.providers.http.httpclient.impl.execchain.RetryExec execute
INFO: Retrying request to {s}->https://repo.maven.apache.org:443
Dec , :: AM org.apache.maven.wagon.providers.http.httpclient.impl.execchain.RetryExec execute
INFO: I/O exception (java.net.SocketException) caught when processing request to {s}->https://repo.maven.apache.org:443: Network is unreachable
Dec , :: AM org.apache.maven.wagon.providers.http.httpclient.impl.execchain.RetryExec execute
INFO: Retrying request to {s}->https://repo.maven.apache.org:443
Dec , :: AM org.apache.maven.wagon.providers.http.httpclient.impl.execchain.RetryExec execute
INFO: I/O exception (java.net.SocketException) caught when processing request to {s}->https://repo.maven.apache.org:443: Network is unreachable
Dec , :: AM org.apache.maven.wagon.providers.http.httpclient.impl.execchain.RetryExec execute
INFO: Retrying request to {s}->https://repo.maven.apache.org:443
Error Bundler::InstallError, retrying /10
.
.
.
Make sure that `gem install logstash-core-event-java -v '5.0.1'` succeeds before bundling.
解决办法:
1.利用pack打包,再unpack本地安装(5.X.X)版本上目前搞不定
2.在本地搭建Gem 仓库 (由于不熟悉Ruby怎么都没搞定)
下面是一个快速,但不正规的方法:
第一步:在联网机器上安装好插件
第二步:拷贝 logstash/vender/bundle/jruby/1.9/gems/ 下面的你要的插件整个文件夹到目标机器
第三步:拷贝 logstash/vendor/bundle/jruby/1.9/specifications/ 下面对应的声明文件
第四部:手动修改logstash/Gemfile 加入插件行如:gem "logstash-filter-translate"
总结:还是推荐大家生产区搭建自己的Gem仓库,当你机器特别多的时候会显得非常方便从容。无须不停的打包,上传,解压再本地安装。