I am using nginx to proxy my mongodb stream.

The actual configuration is

worker_processes 4;
pid /run/nginx.pid;

events {}

http {}

stream {
    server {
        listen 27017;
        proxy_connect_timeout 1s;
        proxy_timeout 3s;
        proxy_pass mongo.staging:27017;

It works fine but if for example my mongo restart the socket does not reconnect.

I tried listen 27017 so_keepalive=on; but it does not work anyway

Do you have any solution ?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.