request help: Health Checks can support Backup server?
Issue description
health Check plugin in base on Kong lua-resty-healthcheck.
I need a function that can mark an upstream server as backup. It will be passed requests when only the primary servers are unavailable.
##LIKE NGINX UPSTREAM CONFIG
upstream testproxy {
server 192.168.1.14:8080;
server 192.168.1.200:8080 backup;
}
USE nginx upstream on http://nginx.org/en/docs/http/ngx_http_upstream_module.html
Environment
- apisix version (cmd:
apisix version): 1.4 - OS: centos7
I know this is a bit complicated, I will try to see if there is a simpler way later.
127.0.0.1:9999 is an invalid upstream.
It'll choose 127.0.0.1:1980 when the 127.0.0.1:9999 turn to unhealthy.
curl -i http://127.0.0.1:9080/apisix/admin/routes/1 -H 'X-API-KEY: edd1c9f034335f136f87ad84b625c8f1' -X PUT -d '
{
"uri": "/index.html",
"upstream": {
"type": "roundrobin",
"nodes": {
"127.0.0.1:9999": 1,
"127.0.0.1:1980": 0
},
"checks": {
"active": {
"http_path": "/status",
"host": "test",
"healthy": {
"interval": 2,
"successes": 1
},
"unhealthy": {
"interval": 1,
"http_failures": 2
}
},
"passive": {
"healthy": {
"http_statuses": [200, 201],
"successes": 3
},
"unhealthy": {
"http_statuses": [500, 502],
"http_failures": 3,
"tcp_failures": 3
}
}
}
}
}'
and another request:
sometimes http work and health check listen on different ports ,
like spring boot cloud http api request works on 8080, but actuator health works on 8888 port
so a router config like :
"active": {
"http_path": "/actuator/health",
"port": "8888",
"host": "test",
"healthy": {
"interval": 2,
"successes": 1
},
"unhealthy": {
"interval": 1,
"http_failures": 2
}
},
"passive": {
"healthy": {
"http_statuses": [200],
"successes": 3
},
"unhealthy": {
"http_statuses": [503,404],
"http_failures": 3,
"tcp_failures": 3
}
}
i did not find any health port define in https://github.com/apache/incubator-apisix/blob/master/apisix/schema_def.lua#L81
is it supported now ?
@souzens https://github.com/apache/incubator-apisix/issues/1809#issuecomment-654671064
you should create a new issue about this new question. they were two different things.
The zero weight node trick works well with most occasions, but it doesn't with chash or least conn balancer.