apisix icon indicating copy to clipboard operation
apisix copied to clipboard

request help: how could I only enable passive health check

Open idbeta opened this issue 6 years ago • 2 comments

Issue description

active health check is working good, but how could I only enable passive health check? The document does not clearly state this situation, is there a problem with my use?

Environment

  • apisix version (cmd: apisix version): master
  • OS:

I did like this, but not working

curl http://127.0.0.1:9080/apisix/admin/routes/1 -H 'X-API-KEY: edd1c9f034335f136f87ad84b625c8f1' -X PUT -d '
{
    "uri": "/index.html",
    "plugins": {
        "limit-count": {
            "count": 2,
            "time_window": 60,
            "rejected_code": 503,
            "key": "remote_addr"
        }
    },
    "upstream": {
         "nodes": {
            "127.0.0.1:1980": 1,
            "127.0.0.1:1970": 1
        },
        "type": "roundrobin",
        "retries": 2,
        "checks": {
            "passive": {
                "healthy": {
                    "http_statuses": [200, 201],
                    "successes": 3
                },
                "unhealthy": {
                    "http_statuses": [500],
                    "http_failures": 3,
                    "tcp_failures": 3
                }
            }
        }
    }
}'

return

{"error_msg":"invalid configuration: property \"upstream\" validation failed: property \"checks\" validation failed: object matches none of the requireds: [\"active\"] or [\"active\",\"passive\"]"}

idbeta avatar Nov 14 '20 03:11 idbeta

It is unreasonable to only enable passive checking. If the upstream node is marked as unhealthy, it will not automatically recover, because no traffic will be distributed to the node which is marked as unhealthy.

gxthrj avatar Nov 14 '20 09:11 gxthrj

Good to know, I think your answer can be added to the document for beginners.

idbeta avatar Nov 14 '20 09:11 idbeta