Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Reconnecting to Mongo after connection drop #38

Open
tokajuhani opened this issue Mar 8, 2017 · 4 comments
Open

Reconnecting to Mongo after connection drop #38

tokajuhani opened this issue Mar 8, 2017 · 4 comments

Comments

@tokajuhani
Copy link

output plugin does not reconnecting to Mongo if connection is dropped.
Retry logic stuck in a loop. It will never retry to get connection to Mongo.

Howto reproduce:

  1. Start logstash with a Mongo output plugin
  2. Write something to logstash --> Data is stored to Mongo
  3. Shutdown Mongo (I run Mongo as Service in Windows, so I stop Mongo service)
  4. Write something to logstash
  5. I get error: Failed to send event to MongoDB {:event=>2017-03-08T08:48:00.057Z _________ t4, :exception=>#<Mongo::Error::NoServerAvailable: No server is available matching preference: #<Mongo::ServerSelector::Primary:0x7354 @tag_sets=[], @options=:database=>"admin"},@server_selection_timeout=30>>,
  6. Start Mongo service
  7. Same error occurs again and again

I have no experience of Ruby.
but if this is called only once:

def register
   Mongo::Logger.logger = @logger
   conn = Mongo::Client.new(@uri)
   @db = conn.use(@database)
 end # def register

Maybe conn = Mongo::Client.new(@uri) and @db = conn.use(@database) should be called if connection is dropped in def receive(event) function.

@berlic
Copy link

berlic commented Aug 28, 2017

There's a PR #29 to fix that. Why this patch is not applied? @jordansissel

@jordansissel
Copy link
Contributor

jordansissel commented Aug 28, 2017

Why this patch is not applied

If I had to guess, it's because there are two failures in that PR:

  • ❌ CLA — Commit author has not signed the CLA and is not a member of Elasticsearch
  • ❌ continuous-integration/travis-ci/pr — The Travis CI build failed

@colinsurprenant
Copy link
Contributor

relates to #46

@colinsurprenant
Copy link
Contributor

commented on proposed fix #29

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants