Forum: NGINX upstream on OpenBSD not executing requests

2974d09ac2541e892966b762aad84943?d=identicon&s=25 roman_mir (Guest)
on 2014-06-17 05:25
(Received via mailing list)
Hello everybody!
I am a new and excited nginx user and I just had to hit a problem
complex
enough for me to post a message here hoping to get some help.

OS: OpenBSD 5.5 amd64
nginx -v:   nginx version: nginx/1.4.7

nginx.conf:

user  www;
worker_processes  10;
error_log /var/log/nginx/error.log  error;
worker_rlimit_nofile 1024;
events {
    worker_connections  800;
}
http {
  include       mime.types;
  default_type  application/octet-stream;
  index         index.jsp;
  keepalive_timeout  4;
  upstream shipmaticacluster {
    server 10.0.0.10:8080;
    server 10.0.0.11:8080;
  }
  server {
    server_tokens off;
    access_log /var/log/nginx/proxy.log;
    location / {
      proxy_pass http://shipmaticacluster;
    }
  }
}


Here is the problem: if the following is used:
proxy_pass http://10.1.1.10:8080;
or this is used:
proxy_pass http://10.1.1.11:8080;
then the requests are executed and the proxy log has this in it:

192.168.0.13 - - [16/Jun/2014:21:22:56 -0400] "GET /Shipmatica/
HTTP/1.1"
200 11118 "-" "Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:16.0)
Gecko/20100101 Firefox/16.0"

and that is great!

However when I use upstream cluster settings:

proxy_pass http://shipmaticacluster;

then the request executes a long time until it expires or until I hit
escape
in the browser and then these lines are printed into the proxy log:

192.168.0.13 - - [16/Jun/2014:23:03:26 -0400] "GET /Shipmatica HTTP/1.1"
499
0 "-" "Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:16.0) Gecko/20100101
Firefox/16.0"

and info log:

2014/06/16 23:03:26 [info] 29349#0: *1 kevent() reported that client
prematurely closed connection, so upstream connection is closed too
while
connecting to upstream, client: 192.168.0.13, server: , request: "GET
/Shipmatica HTTP/1.1", upstream: "http://10.0.0.10:8080/Shipmatica",
host:
"192.168.0.28"


I have gone through about 5 or 6 hours of internet searches and
experiments
by now, looked at the system log files and payed attention to pflog, no
results anywhere, nothing is found in the OS log files, pf doesn't block
any
traffic.  I switch back to the specific IP address in the proxy_pass and
the
requests flow through just fine.

This is as far as I can go without some help, I hope somebody has
insights
on this issue.

Thank you!
Roman

Posted at Nginx Forum:
http://forum.nginx.org/read.php?2,250904,250904#msg-250904
40b4c848b8fcd63b0cb60b9d170c3a77?d=identicon&s=25 Valentin V. Bartenev (Guest)
on 2014-06-17 09:04
(Received via mailing list)
On Monday 16 June 2014 23:24:39 roman_mir wrote:
> Hello everybody!
> I am a new and excited nginx user and I just had to hit a problem complex
> enough for me to post a message here hoping to get some help.
[..]
>   upstream shipmaticacluster {
>     server 10.0.0.10:8080;
>     server 10.0.0.11:8080;
>   }
[..]
> Here is the problem: if the following is used:
> proxy_pass http://10.1.1.10:8080;
> or this is used:
> proxy_pass http://10.1.1.11:8080;
> then the requests are executed and the proxy log has this in it:
[..]

Have you noticed that 10.1.1.1[01] and 10.0.0.1[01] (in your upstream
block)
are different IPs?  Is that intentionally?

  wbr, Valentin V. Bartenev
2974d09ac2541e892966b762aad84943?d=identicon&s=25 prkumar (Guest)
on 2014-06-19 07:47
(Received via mailing list)
I think you can not have two server directive in upstream, how nginx
would
know which one to forward request to?
Will it do round robin? Not sure about that will have to check.. Can you
try
by removing one..

Posted at Nginx Forum:
http://forum.nginx.org/read.php?2,250904,251036#msg-251036
40b4c848b8fcd63b0cb60b9d170c3a77?d=identicon&s=25 Valentin V. Bartenev (Guest)
on 2014-06-19 09:11
(Received via mailing list)
On Thursday 19 June 2014 01:46:40 prkumar wrote:
> I think you can not have two server directive in upstream, how nginx would
> know which one to forward request to?
> Will it do round robin? Not sure about that will have to check.. Can you try
> by removing one..
>
[..]

You should read the documentation: http://nginx.org/r/upstream

The main purpose of "upstream" directive is exactly to create a group of
servers and to do load-balancing between them.

  wbr, Valentin V. Bartenev
2974d09ac2541e892966b762aad84943?d=identicon&s=25 roman_mir (Guest)
on 2014-06-19 15:53
(Received via mailing list)
Valentin, thank you for your insight, I am upset at myself for not
noticing
some obvious errors, but that's the result of my stupid schedule, which
I am
personally responsible for at the end.  So yes, it was supposed to be
10.1.1.10 and 10.1.1.11.

At this point the balancing works, I am balancing 2 Tomcat instances,
having
session replication between them and using ip_hash to force the same
session
to go to the same instance.  I guess I just have to specify conditions
under
which the balancer will assume that an instance is down and force all
requests to just one live instance.  Also working out the details of
https
connectivity.  This is on OpenBSD and since there were new OpenSSL
security
issues fixed on the 5th of June, this means patching first.  Nginx
configuration for SSL looks simple enough on the surface, I will soon
find
out how it goes in reality :)

Thank you,
Roman

Posted at Nginx Forum:
http://forum.nginx.org/read.php?2,250904,251053#msg-251053
Please log in before posting. Registration is free and takes only a minute.
Existing account

NEW: Do you have a Google/GoogleMail, Yahoo or Facebook account? No registration required!
Log in with Google account | Log in with Yahoo account | Log in with Facebook account
No account? Register here.