- roundrobin: smooth weighted roundrobin method
- chash: cosistent hashing method
- balancer: multiple LB instances, passive health check, SSL offloading
- controller: dynamic configuration, REST API to start/stop/add/remove LB at runtime
- statistics: HTTP method/path/code/bytes
The configurations specify that controller listens on 127.0.0.1:6587
,
and define a virtual server including two servers with the default roundrobin method
{
"controller": {
"address": "127.0.0.1:6587",
"auth": {
"username": "admin",
"password": "admin"
}
},
"virtual_server": [
{
"name": "web",
"address": "127.0.0.1:8081",
"pool": [
{
"address": "127.0.0.1:10001",
"weight": 1
},
{
"address": "127.0.0.1:10002",
"weight": 2
}
]
}
]
}
- Terminal #1:
make run
- Terminal #2:
watch 'curl -H "Host:localhost" http://127.0.0.1:8081 > /dev/null'
- Terminal #3:
python -m SimpleHTTPServer 10001 & python -m SimpleHTTPServer 10002 & python -m SimpleHTTPServer 10003
- Terminal #4:
curl -u admin:admin http://127.0.0.1:6587/stats
curl -u admin:admin http://127.0.0.1:6587/vs
curl -u admin:admin http://127.0.0.1:6587/vs/web
curl -XPOST -u admin:admin -d '{"address":"127.0.0.1:10003"}' http://127.0.0.1:6587/vs/web/pool
curl -u admin:admin http://127.0.0.1:6587/vs/web
curl -u admin:admin http://127.0.0.1:6587/stats
curl -XDELETE -u admin:admin -d '{"address":"127.0.0.1:10003"}' http://127.0.0.1:6587/vs/web/pool
curl -XPOST -u admin:admin -d '{"action":"disable"}' http://127.0.0.1:6587/vs/web
curl -u admin:admin http://127.0.0.1:6587/vs/web
curl -XPOST -u admin:admin -d '{"action":"enable"}' http://127.0.0.1:6587/vs/web