Mongo DB Re-Connection

Imported Google Group message. Original thread at: Redirecting to Google Groups Import Date: 2016-01-19 21:20:25 +0000.
Sender:Ben King.
Date:Tuesday, 17 March 2015 11:49:24 UTC.

Hi Martin et al.

We are experimenting with resilient configuration of Tyk 1.5 using Mongo 3.

One of the scenarios we tested was a failure of the MongoDB. When this occurs, the dashboard (obviously) stops working, and the Gateway reports:

time=“2015-03-17T06:53:30-04:00” level=error msg=“Problem inserting to mongo collection”
time=“2015-03-17T06:53:30-04:00” level=error msg=EOF

When the MongoDB instance is restarted, it currently looks like both the Gateway and Dashboard need to be re-started in order to re-establish the Mongo connection.

Is this currently expected behaviour (feature request!), or have we possibly mis-configured something? I would ideally like to avoid a restart requirement for the Gateway in this scenario if possible?

Thanks and regards,

Ben

Imported Google Group message.
Sender:Martin Buhr.
Date:Tuesday, 17 March 2015 12:01:53 UTC.

Hi Ben,

This is a bug, there’s currently no re-connect handling capability for Mongo, only for redis, it’s definetely something we’ll need to add in.

The thing is, in the gateway, there are two separate components that talk to Mongo, the analytics purger (the error you’re describing above) and the API Definition loader (this only runs on reload), I’m not sure if the db connection redials on a reload, so that needs investigating. either way, it should be possible to force a connect in these instances.

With the Gateway it’s a different story, the storage interface has a connect function, but connection checks will need to be added across all of the different models, which might be a larger task!

Can you raise a GH issue please?

Thanks,
Martin

  • show quoted text -

Imported Google Group message.
Sender:Marcel Montel.
Date:Wednesday, 19 August 2015 09:35:42 UTC+1.

Martin what is the status of this? I’m still seeing this error in the logs.

  • show quoted text -

Imported Google Group message.
Sender:Martin Buhr.
Date:Wednesday, 19 August 2015 09:43:09 UTC+1.

It’s been fixed in 1.8 - see this thread from Aug 12th:

https://groups.google.com/d/msg/tyk-community-support/ZyAsOtUKG2s/5pVJj8_tGwAJ

Martin

  • show quoted text -