Firstsawyou edited a comment on issue #3616:
URL: https://github.com/apache/apisix/issues/3616#issuecomment-783179886


   Hi, @yocaning  
   You need to pay attention to your configuration. The `http_path` of the 
active health check should be consistent with the uri that provides the 
service. Secondly, the value of `"timeout":1` is recommended to be set larger.
   
   
   This is an example, you can refer to it
   
   1、Add a route and enable health check
   
   The 1981 and 1982 ports are healthy, but the 1985 port is unhealthy.
   
   ```shell
   curl http://127.0.0.1:9080/apisix/admin/routes/1 -H 'X-API-KEY: 
edd1c9f034335f136f87ad84b625c8f1' -X PUT -d '
   {
       "id":"1",
       "update_time":1613734165,
       "upstream":{
           "checks":{
               "active":{
                   "healthy":{
                       "interval":3,
                       "successes":2
                   },
                   "unhealthy":{
                       "interval":10,
                       "http_failures":2
                   },
                   "timeout":10,
                   "http_path":"/hello",
                   "type":"http",
                   "req_headers":[
                       "Content-Seq:3"
                   ]
               },
               "passive":{
                   "timeout":5,
                   "healthy":{
                       "http_statuses":[
                           200,
                           201
                       ],
                       "successes":3
                   },
                   "type":"http",
                   "unhealthy":{
                       "http_statuses":[
                           500,
                           504
                       ],
                       "timeouts":3,
                       "tcp_failures":1,
                       "http_failures":1
                   }
               }
           },
           "nodes":{
               "127.0.0.1:1980":1,
               "127.0.0.1:1981":1,
               "127.0.0.1:1985":1
           },
           "timeout":{
               "connect":3,
               "read":3,
               "send":3
           },
           "pass_host":"pass",
           "hash_on":"vars",
           "type":"roundrobin"
       },
       "methods":[
           "PUT",
           "GET"
       ],
       "status":1,
       "create_time":1613722689,
       "priority":0,
       "uri":"/hello"
   }'
   ```
   
   2、Access request and view error.log
   
   ```
   $ curl http://127.0.0.1:9080/hello
   hello 1980
   
   $ tail -f error.log
   2021/02/22 15:41:42 [warn] 23035#23035: *66190 [lua] healthcheck.lua:1107: 
log(): [healthcheck] (upstream#/apisix/routes/1) unhealthy TCP increment (1/2) 
for '(127.0.0.1:1985)', context: ngx.timer, client: 127.0.0.1, server: 
0.0.0.0:9080
   2021/02/22 15:41:48 [warn] 23035#23035: *66445 [lua] healthcheck.lua:1107: 
log(): [healthcheck] (upstream#/apisix/routes/1) unhealthy TCP increment (2/2) 
for '(127.0.0.1:1985)', context: ngx.timer, client: 127.0.0.1, server: 
0.0.0.0:9080
   
   2021/02/22 15:42:56 [warn] 23036#23036: *69367 [lua] healthcheck.lua:1107: 
log(): [healthcheck] (upstream#/apisix/routes/1) healthy SUCCESS increment 
(1/2) for '(127.0.0.1:1980)', context: ngx.timer, client: 127.0.0.1, server: 
0.0.0.0:9080
   2021/02/22 15:42:56 [warn] 23036#23036: *69367 [lua] healthcheck.lua:1107: 
log(): [healthcheck] (upstream#/apisix/routes/1) healthy SUCCESS increment 
(1/2) for '(127.0.0.1:1981)', context: ngx.timer, client: 127.0.0.1, server: 
0.0.0.0:9080
   ```
   3、When the port of `1985` recovered health and view error.log
   
   When an unhealthy node is restored to a healthy node, it will be 
automatically marked as healthy.
   
   ```
   2021/02/22 15:57:32 [warn] 23035#23035: *107236 [lua] healthcheck.lua:1107: 
log(): [healthcheck] (upstream#/apisix/routes/1) healthy SUCCESS increment 
(2/2) for '(127.0.0.1:1985)', context: ngx.timer, client: 127.0.0.1, server: 
0.0.0.0:9080
   
   ```
   


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


Reply via email to