Hi

On Thu, Jul 11, 2019 at 12:15:19PM -0400, Shaun Tarves wrote:
> Hi -
> 
> I am trying to determine why my servers' IP address is not being preserved
> through a reload when written to the server state file. I'm using version
> 1.9.8 on alpine linux.
> 
> CONFIGURATION:
> global
>   server-state-file /usr/local/etc/haproxy/haproxy.state
> 
> defaults
>   load-server-state-from-file global
> 
> backend rdp-proxy
>   mode tcp
> 
> 
>   server-template rdp 1-5 0.0.0.0:443 disabled init-addr last
> 
> During some time, the servers' IP addresses and/or ports are configured
> through the stats socket.
> 
> Right before restarting, I dump the server state using show servers state
> and it correctly shows me the configured server information:
> 11 rdp-proxy 1 rdp1 172.18.0.2 2 4 1 1 778186 1 0 0 8 0 0 0 - 80 -
> 11 rdp-proxy 2 rdp2 172.18.0.3 2 4 1 1 778186 1 0 0 8 0 0 0 - 80 -
> 11 rdp-proxy 3 rdp3 0.0.0.0 0 5 1 1 778186 1 0 0 8 0 0 0 - 443 -
> 11 rdp-proxy 4 rdp4 0.0.0.0 0 5 1 1 778186 1 0 0 8 0 0 0 - 443 -
> 11 rdp-proxy 5 rdp5 0.0.0.0 0 5 1 1 778186 1 0 0 8 0 0 0 - 443 -
> 
> 
> When I reload via the HUP or USR2 signals, all server information (admin
> state, port, etc.) is correctly restored EXCEPT the IP address, as seen
> below:
> 11 rdp-proxy 1 rdp1 0.0.0.0 2 4 1 1 778186 1 0 4 8 0 0 0 - 80 -
> 11 rdp-proxy 2 rdp2 0.0.0.0 2 4 1 1 778186 1 0 4 8 0 0 0 - 80 -
> 11 rdp-proxy 3 rdp3 0.0.0.0 0 5 1 1 778186 1 0 0 8 0 0 0 - 443 -
> 11 rdp-proxy 4 rdp4 0.0.0.0 0 5 1 1 778186 1 0 0 8 0 0 0 - 443 -
> 11 rdp-proxy 5 rdp5 0.0.0.0 0 5 1 1 778186 1 0 0 8 0 0 0 - 443 -

if you declare the server address with an IP on the server line, the IP from
server state file will never be used. If you want to use it you need to declare
the server address with a name and not an address, like this:

server-template rdp 1-5 foo.bar disabled init-addr last,1.2.3.4

this will set the IP to 1.2.3.4 by default, and you can change it with the stats
socket. when you reload, you will use the IP from the server state file.

cheers,
Jérôme

Reply via email to