Hi everyone.
I am trying to make an integration between MongoDB (Version 4.2.7) and Elasticsearch (Version 7.7.0) via Logstash (Version 7.8.0).
The goal is to synchronize data from MongoDB to
Elasticsearch.
The scenario is as follows:
- An instance of MongoDB Server on 127.0.0.1:2717;
- Installation of Logstash and the plug-in for mongoDB logstash-input-mongodb;
- Elasticsearch cluster with 3 nodes: 127.0.0.1:9200, 127.0.0.1:9201, 127.0.0.1:9202;
Here is the Logstash configuration file:
input
{
mongodb
{
uri => 'mongodb: // username: password @ localhost: 27017 / dbname'
placeholder_db_dir => 'C: \ Logstash-MongoDB'
placeholder_db_name => 'logstash_mongodb.db'
collection => 'collectionName'
batch_size => 5000
}
}
filter
{
}
output
{
Elasticsearch
{
hosts => ["localhost: 9200", "localhost: 9201", "localhost: 9202"]
index => "collectionName"
}
}
The pipeline starts and soon "dies". Here is a fragment of the log:
[2020-06-30T12:01:30,991][**ERROR**][logstash.javapipeline ]
[main] **Pipeline aborted due to error** {:pipeline_id=>"main", :exception=>#<**NoMethodError: undefined method `[]' for nil:NilClass**>, :backtrace=>
["C:/logstash-7.8.0/vendor/bundle/jruby/2.5.0/gems/logstash-input-mongodb-0.4.1/lib/logstash/inputs/mongodb.rb:99:in `init_placeholder'",
"C:/logstash-7.8.0/vendor/bundle/jruby/2.5.0/gems/logstash-input-mongodb-0.4.1/lib/logstash/inputs/mongodb.rb:113:in `get_placeholder'",
"C:/logstash-7.8.0/vendor/bundle/jruby/2.5.0/gems/logstash-input-mongodb-0.4.1/lib/logstash/inputs/mongodb.rb:160:in `block in update_watched_collections'",
"org/jruby/RubyArray.java:1809:in `each'",
"C:/logstash-7.8.0/vendor/bundle/jruby/2.5.0/gems/logstash-input-mongodb-0.4.1/lib/logstash/inputs/mongodb.rb:158:in `update_watched_collections'",
"C:/logstash-7.8.0/vendor/bundle/jruby/2.5.0/gems/logstash-input-mongodb-0.4.1/lib/logstash/inputs/mongodb.rb:182:in `register'",
"C:/logstash-7.8.0/logstash-core/lib/logstash/java_pipeline.rb:216:in `block in register_plugins'",
"org/jruby/RubyArray.java:1809:in `each'", "C:/logstash-7.8.0/logstash-core/lib/logstash/java_pipeline.rb:215:in `register_plugins'",
"C:/logstash-7.8.0/logstash-core/lib/logstash/java_pipeline.rb:326:in `start_inputs'", "C:/logstash-7.8.0/logstash-core/lib/logstash/java_pipeline.rb:286:
in `start_workers'", "C:/logstash-7.8.0/logstash-core/lib/logstash/java_pipeline.rb:170:in `run'",
"C:/logstash-7.8.0/logstash-core/lib/logstash/java_pipeline.rb:125:in `block in start'"],
"pipeline.sources"=>["c:/logstash-7.8.0/config/mongodata.conf"], :thread=>"#<Thread:0x55e4e5c4 run>"}
Thank You very much, leoper.