编译安装 logstash-output-jdbc

Posted 吾生也有涯,而知也无涯

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了编译安装 logstash-output-jdbc相关的知识,希望对你有一定的参考价值。

环境 mac

https://github.com/theangryangel/logstash-output-jdbc

logstash-plugin install logstash-output-jdbc


直接安装失败

 

自已编译本地包

 

logstash实际应用的是jruby,但mac默认的ruby不是jruby环境


先安装jruby

1 安装rvm https://rvm.io/ 

curl -sSL https://get.rvm.io | bash -s stable

2 安装 jruby

rvm install jruby

3 应用 jruby

rvm use jruby

 

 

之后执行报错

bjdeMacBook-Pro:logstash-output-jdbc cclient$ bundle install
/usr/local/Cellar/ruby/2.4.2_1/lib/ruby/2.4.0/rubygems.rb:271:in `find_spec_for_exe: cant find gem bundler (>= 0.a) (Gem::GemNotFoundException)
from /usr/local/Cellar/ruby/2.4.2_1/lib/ruby/2.4.0/rubygems.rb:299:in `activate_bin_pathfrom /usr/local/bin/bundle:23:in `<main>bjdeMacBook-Pro:logstash-output-jdbc cclient$ gem install bundler
Fetching: bundler-1.16.2.gem (100%)


因类jruby需要另外单独安装bundle,和原ruby的bundle不通用

gem install bundler

 

环境准备好了安装依赖

git clone https://github.com/theangryangel/logstash-output-jdbc
cd logstash-output-jdbc
bundle install

日志

技术分享图片
Fetching gem metadata from https://rubygems.org/.........
Resolving dependencies........
Using rake 12.3.1
Fetching ast 2.4.0
Installing ast 2.4.0
Using bundler 1.16.2
Fetching numerizer 0.1.1
Installing numerizer 0.1.1
Fetching chronic_duration 0.10.6
Installing chronic_duration 0.10.6
Fetching clamp 0.6.5
Installing clamp 0.6.5
Fetching coderay 1.1.2
Installing coderay 1.1.2
Fetching concurrent-ruby 1.0.5 (java)
Installing concurrent-ruby 1.0.5 (java)
Fetching diff-lcs 1.3
Installing diff-lcs 1.3
Fetching multi_json 1.13.1
Installing multi_json 1.13.1
Fetching elasticsearch-api 5.0.5
Installing elasticsearch-api 5.0.5
Fetching multipart-post 2.0.0
Installing multipart-post 2.0.0
Fetching faraday 0.15.2
Installing faraday 0.15.2
Fetching elasticsearch-transport 5.0.5
Installing elasticsearch-transport 5.0.5
Fetching elasticsearch 5.0.5
Installing elasticsearch 5.0.5
Fetching ffi 1.9.25 (java)
Installing ffi 1.9.25 (java)
Fetching filesize 0.0.4
Installing filesize 0.0.4
Fetching fivemat 1.3.6
Installing fivemat 1.3.6
Fetching gem_publisher 1.5.0
Installing gem_publisher 1.5.0
Fetching gems 0.8.3
Installing gems 0.8.3
Fetching i18n 0.6.9
Installing i18n 0.6.9
Fetching insist 1.0.0
Installing insist 1.0.0
Fetching jar-dependencies 0.3.12
Installing jar-dependencies 0.3.12
Fetching jrjackson 0.4.6 (java)
Installing jrjackson 0.4.6 (java)
Fetching jruby-openssl 0.9.19 (java)
Installing jruby-openssl 0.9.19 (java)
Fetching kramdown 1.14.0
Installing kramdown 1.14.0
Fetching manticore 0.6.3 (java)
Installing manticore 0.6.3 (java)
Fetching minitar 0.5.4
Installing minitar 0.5.4
Fetching method_source 0.8.2
Installing method_source 0.8.2
Fetching slop 3.6.0
Installing slop 3.6.0
Fetching spoon 0.0.6
Installing spoon 0.0.6
Fetching pry 0.10.4 (java)
Installing pry 0.10.4 (java)
Fetching puma 2.16.0 (java)
Installing puma 2.16.0 (java)
Fetching rack 1.6.6
Installing rack 1.6.6
Fetching ruby-maven-libs 3.3.9
Installing ruby-maven-libs 3.3.9
Fetching ruby-maven 3.3.12
Installing ruby-maven 3.3.12
Fetching rubyzip 1.1.7
Installing rubyzip 1.1.7
Fetching rack-protection 1.5.5
Installing rack-protection 1.5.5
Fetching tilt 2.0.8
Installing tilt 2.0.8
Fetching sinatra 1.4.8
Installing sinatra 1.4.8
Fetching stud 0.0.23
Installing stud 0.0.23
Fetching thread_safe 0.3.6 (java)
Installing thread_safe 0.3.6 (java)
Fetching polyglot 0.3.5
Installing polyglot 0.3.5
Fetching treetop 1.4.15
Installing treetop 1.4.15
Fetching logstash-core 5.6.4 (java)
Installing logstash-core 5.6.4 (java)
jar dependencies for logstash-core-5.6.4-java.gemspec . . .
org.apache.logging.log4j:log4j-slf4j-impl:2.6.2:compile
org.apache.logging.log4j:log4j-api:2.6.2:compile
org.apache.logging.log4j:log4j-core:2.6.2:compile
com.fasterxml.jackson.core:jackson-core:2.9.1:compile
com.fasterxml.jackson.core:jackson-databind:2.9.1:compile
com.fasterxml.jackson.core:jackson-annotations:2.9.1:compile
com.fasterxml.jackson.module:jackson-module-afterburner:2.9.1:compile
com.fasterxml.jackson.dataformat:jackson-dataformat-cbor:2.9.1:compile
Fetching logstash-core-plugin-api 2.1.28 (java)
Installing logstash-core-plugin-api 2.1.28 (java)
Fetching logstash-codec-plain 3.0.6
Installing logstash-codec-plain 3.0.6
Fetching rspec-support 3.7.1
Installing rspec-support 3.7.1
Fetching rspec-core 3.7.1
Installing rspec-core 3.7.1
Fetching rspec-expectations 3.7.0
Installing rspec-expectations 3.7.0
Fetching rspec-mocks 3.7.0
Installing rspec-mocks 3.7.0
Fetching rspec 3.7.0
Installing rspec 3.7.0
Fetching rspec-wait 0.0.9
Installing rspec-wait 0.0.9
Fetching logstash-devutils 1.3.6 (java)
Installing logstash-devutils 1.3.6 (java)
Using logstash-output-jdbc 5.3.0 (java) from source at `.`
Fetching parser 2.5.1.0
Installing parser 2.5.1.0
Fetching powerpack 0.1.2
Installing powerpack 0.1.2
Fetching rainbow 2.2.2
Installing rainbow 2.2.2 with native extensions
Fetching ruby-progressbar 1.9.0
Installing ruby-progressbar 1.9.0
Fetching unicode-display_width 1.4.0
Installing unicode-display_width 1.4.0
Fetching rubocop 0.41.2
Installing rubocop 0.41.2
Bundle complete! 5 Gemfile dependencies, 61 gems now installed.
Use `bundle info [gemname]` to see where a bundled gem is installed.
Post-install message from jar-dependencies:

if you want to use the executable lock_jars then install ruby-maven gem before using lock_jars

$ gem install ruby-maven -v ~> 3.3.11

or add it as a development dependency to your Gemfile

gem ruby-maven, ~> 3.3.11

 

if you want to use the executable lock_jars then install ruby-maven gem before using lock_jars

$ gem install ruby-maven -v ~> 3.3.11

or add it as a development dependency to your Gemfile

gem ruby-maven, ~> 3.3.11
View Code

 

剩下的按官方发布过程来

bundle exec rake install_jars
bundle exec rake pre_release_checks
gem build logstash-output-jdbc.gemspec

 

日志

技术分享图片
bundle exec rake install_jars
jar dependencies for logstash-output-jdbc-5.3.0-java.gemspec . . .
com.zaxxer:HikariCP:2.7.2:compile
org.apache.logging.log4j:log4j-slf4j-impl:2.6.2:compile
bjdeMacBook-Pro:logstash-output-jdbc cclient$ bundle exec rake pre_release_checks
rake aborted!
Dont know how to build task pre_release_checks (see --tasks)
/Users/cclient/.rvm/gems/jruby-9.1.13.0@global/gems/rake-12.3.1/exe/rake:27:in `<main>/Users/cclient/.rvm/gems/jruby-9.1.13.0/gems/bundler-1.16.2/lib/bundler/cli/exec.rb:1:in `(root)/Users/cclient/.rvm/gems/jruby-9.1.13.0/gems/bundler-1.16.2/lib/bundler/cli/exec.rb:74:in `kernel_load/Users/cclient/.rvm/gems/jruby-9.1.13.0/gems/bundler-1.16.2/lib/bundler/cli/exec.rb:28:in `run/Users/cclient/.rvm/gems/jruby-9.1.13.0/gems/bundler-1.16.2/lib/bundler/cli.rb:424:in `exec/Users/cclient/.rvm/gems/jruby-9.1.13.0/gems/bundler-1.16.2/lib/bundler/vendor/thor/lib/thor/command.rb:27:in `run/Users/cclient/.rvm/gems/jruby-9.1.13.0/gems/bundler-1.16.2/lib/bundler/vendor/thor/lib/thor/invocation.rb:126:in `invoke_command/Users/cclient/.rvm/gems/jruby-9.1.13.0/gems/bundler-1.16.2/lib/bundler/vendor/thor/lib/thor.rb:387:in `dispatch/Users/cclient/.rvm/gems/jruby-9.1.13.0/gems/bundler-1.16.2/lib/bundler/cli.rb:27:in `dispatch/Users/cclient/.rvm/gems/jruby-9.1.13.0/gems/bundler-1.16.2/lib/bundler/vendor/thor/lib/thor/base.rb:466:in `block in start/Users/cclient/.rvm/gems/jruby-9.1.13.0/gems/bundler-1.16.2/lib/bundler/cli.rb:18:in `start/Users/cclient/.rvm/gems/jruby-9.1.13.0/gems/bundler-1.16.2/exe/bundle:30:in `<main>/Users/cclient/.rvm/gems/jruby-9.1.13.0/gems/bundler-1.16.2/lib/bundler/friendly_errors.rb:124:in `<eval>/Users/cclient/.rvm/gems/jruby-9.1.13.0/bin/jruby_executable_hooks:15:in `<main>(See full trace by running task with --trace)
bjdeMacBook-Pro:logstash-output-jdbc cclient$
bjdeMacBook-Pro:logstash-output-jdbc cclient$ gem build logstash-output-jdbc.gemspec
WARNING: license value Apache License (2.0) is invalid. Use a license identifier from
http://spdx.org/licenses or ‘Nonstandard‘ for a nonstandard license.
Did you mean Apache-2.0?
WARNING: open-ended dependency on stud (>= 0) is not recommended
if stud is semantically versioned, use:
add_runtime_dependency stud, ~> 0
WARNING: open-ended dependency on logstash-codec-plain (>= 0) is not recommended
if logstash-codec-plain is semantically versioned, use:
add_runtime_dependency logstash-codec-plain, ~> 0
WARNING: open-ended dependency on jar-dependencies (>= 0, development) is not recommended
if jar-dependencies is semantically versioned, use:
add_development_dependency jar-dependencies, ~> 0
WARNING: See http://guides.rubygems.org/specification-reference/ for help
Successfully built RubyGem
Name: logstash-output-jdbc
Version: 5.3.0
File: logstash-output-jdbc-5.3.0-java.gem
View Code

 

logstash-output-jdbc-5.3.0-java.gem 便是我们要的

logstash-plugin install logstash-output-jdbc-5.3.0-java.gem

 

安装完成




以上是关于编译安装 logstash-output-jdbc的主要内容,如果未能解决你的问题,请参考以下文章

如何编译安装PHP扩展

TypeScript安装、编译

typeScript的安装编译

编译安装 PHP 扩展

ubuntu12.04编译交叉编译已经安装,为啥还不能编译

gtest 下载 、编译 安装