Q1:I can’t use module hash.when I use it,tell me: nginx: [emerg]
unknown directive “hash” in
/usr/local/nginx/conf/nginx.conf:65
So I delete it
There is no error report during executing.
Q2;
In my opinion, when the “tomcat of host_192.168.0.242” hasn’t totally
started, healthcheck regards it as unvailable and transfers the visit
link directly to “host_192.168.0.246”.
It comes back after “host_192.168.0.242” has totally started.
But during the course of restart, there was no evidence showing that
healthcheck is working.
Does it happen beacause of my wrong setting or my lack of
understanding?
Looking forward for your help. Thank you for your help in advance.
2011/07/29 12:15:54 [debug] 26735#0: healthcheck: begun healthcheck of
index 2
2011/07/29 12:15:54 [debug] 26735#0: healthcheck: Memzero done
2011/07/29 12:15:54 [debug] 26735#0: healthcheck: Connecting peer
2011/07/29 12:15:54 [debug] 26735#0: healthcheck: connected so far
2011/07/29 12:15:54 [debug] 26735#0: healthcheck: Peer connected
2011/07/29 12:15:54 [debug] 26735#0: healthcheck: Send size 44
2011/07/29 12:15:54 [debug] 26735#0: healthcheck: Finished sending
request
2011/07/29 12:15:54 [debug] 26735#0: healthcheck: Write handler called
2011/07/29 12:15:54 [debug] 26735#0: healthcheck: Ignoring a write. Not
in writing state
2011/07/29 12:15:54 [debug] 26735#0: healthcheck: Read handler called
2011/07/29 12:15:54 [debug] 26735#0: healthcheck: Recv size 39 when I
wanted 6442450945000
2011/07/29 12:15:54 [debug] 26735#0: healthcheck: Recv size -2 when I
wanted 6442450944961
2011/07/29 12:15:54 [debug] 26735#0: healthcheck: Process recv
2011/07/29 12:15:54 [debug] 26735#0: healthcheck: Finished
172.16.0.130:22, state 201
2011/07/29 12:15:54 [debug] 26733#0: healthcheck: begun healthcheck of
index 0
2011/07/29 12:15:54 [debug] 26733#0: healthcheck: Memzero done
2011/07/29 12:15:54 [debug] 26733#0: healthcheck: Connecting peer
2011/07/29 12:15:54 [debug] 26733#0: healthcheck: connected so far
2011/07/29 12:15:54 [debug] 26733#0: healthcheck: Peer connected
2011/07/29 12:15:54 [debug] 26733#0: healthcheck: Send size 44
2011/07/29 12:15:54 [debug] 26733#0: healthcheck: Finished sending
request
2011/07/29 12:15:54 [debug] 26733#0: healthcheck: Write handler called
2011/07/29 12:15:54 [debug] 26733#0: healthcheck: Ignoring a write. Not
in writing state
2011/07/29 12:15:54 [debug] 26733#0: healthcheck: Write handler called
2011/07/29 12:15:54 [debug] 26733#0: healthcheck: Ignoring a write. Not
in writing state
2011/07/29 12:15:54 [debug] 26733#0: healthcheck: Read handler called
2011/07/29 12:15:54 [debug] 26733#0: healthcheck: Recv size 211 when I
wanted 4398046512104
2011/07/29 12:15:54 [debug] 26733#0: healthcheck: Recv size -2 when I
wanted 4398046511893
2011/07/29 12:15:54 [debug] 26733#0: healthcheck: Process recv
2011/07/29 12:15:54 [debug] 26733#0: healthcheck: Finished
172.16.0.130:81, state 100
2011/07/29 12:15:57 [debug] 26735#0: healthcheck: begun healthcheck of
index 1
2011/07/29 12:15:57 [debug] 26735#0: healthcheck: Memzero done
2011/07/29 12:15:57 [debug] 26735#0: healthcheck: Connecting peer
2011/07/29 12:15:57 [debug] 26735#0: healthcheck: connected so far
2011/07/29 12:15:57 [debug] 26735#0: healthcheck: Peer connected
2011/07/29 12:15:57 [debug] 26735#0: healthcheck: Send size 44
2011/07/29 12:15:57 [debug] 26735#0: healthcheck: Finished sending
request
2011/07/29 12:15:57 [debug] 26735#0: healthcheck: Write handler called
2011/07/29 12:15:57 [debug] 26735#0: healthcheck: Ignoring a write. Not
in writing state
2011/07/29 12:15:57 [debug] 26735#0: healthcheck: Read handler called
2011/07/29 12:15:57 [debug] 26735#0: healthcheck: Recv size 211 when I
wanted 6442450945000
2011/07/29 12:15:57 [debug] 26735#0: healthcheck: Recv size -2 when I
wanted 6442450944789
2011/07/29 12:15:57 [debug] 26735#0: healthcheck: Process recv
2011/07/29 12:15:57 [debug] 26735#0: healthcheck: Finished
172.16.0.130:82, state 100
Where 81 and 82 tcp-ports is a tomcat, who answer “HTTP/1.1 200 OK\r\n”
with some fields and close connection.
And 22 is a localhost ssh server, who simply close tcp socket without
answer if nginx send “GET /PingAction.do HTTP/1.0\r\n”
As i see in ngx_http_healthcheck_module.c
“state 100” is a NGX_HEALTH_OK ( // Good + final states)
“state 201” is a NGX_HEALTH_BAD_STATUS (// bad + final states)
But in my case all inversely - :81 and :82 are good - they answer
“HTTP/1.1 200 OK\r\n”
and 22 is bad - he close connection without answer