We are using Nginx As a load balancer for multiple riak nodes. The setup worked fine for some time(few hours) before Nginx started giving bad gateway 502 errors. On checking the individual nodes seemed to be working. We found out that The problem was with nginx buffer size hence increased the buffer size to 16k, it worked fine for one more day before we started getting 502 error for everything.

My Nginx configuration is as follows

upstream riak {
   server 127.0.0.1:8091 weight=3;
   server 127.0.0.1:8092;
   server 127.0.0.1:8093;    
   server 127.0.0.1:8094;

  }

  server {
    listen 8098;
    server_name 127.0.0.1:8098;
    location / {
      proxy_pass http://riak;
      proxy_buffer_size 16k;
      proxy_buffers 8 16k;
    }
  }

Any help is appreciated,Thank you.

link|improve this question
Anything interesting in logs? – Shane Madden Jan 3 at 16:46
nothing in error logs and in access logs it shows 502. – djd Jan 4 at 4:57
502 is a clear indication that the backend failed to respond. Check the backend logs, you should find the problem there. It could be the backend is taking longer than 60sec (the default timeout) to respond hence the 502. – Sameer Feb 6 at 11:41
feedback

Know someone who can answer? Share a link to this question via email, Google+, Twitter, or Facebook.

Your Answer

 
or
required, but never shown

Browse other questions tagged or ask your own question.