Reputation: 689
I am using HA proxy version 1.6.6 for load balancing rabbitmq server, and it works fine but i want to add server dynamically in ha proxy backend in ubuntu using script. can anyone please tell me how can i done it?
Upvotes: 10
Views: 8103
Reputation: 531
HAProxy OSS v1.8 does not include add/remove
commands in Runtime API, but you can achieve similar functionality by using ready/disabled
state commands.
disabled
state: server-template websrv 1-100 192.168.122.1:8080 check disabled
//This adds 100 servers (websrv1...websrv100) in disabled stateadd
feature): set server be_template/websrv1 state ready
remove
feature): set server be_template/websrv1 state maint
Address and port can be changed using Runtime API as usual: set server be_template/websrv1 addr 192.168.50.112 port 8000
Reference(s):
Upvotes: 12
Reputation: 112
I think there is not this kind of features with HAProxy Open Source.
If you use their ALOHA Load Balancer, there is an API to do this actions here :
https://www.haproxy.com/resources/documentation/
Upvotes: 0
Reputation: 431
As far as I know haproxy api ( stats socket ) does not support dynamic adding/removing servers to backend. One of the solution to use consul, the cost - reload service after some change. https://www.hashicorp.com/blog/haproxy-with-consul.html
Upvotes: 0