Reload with state file does not take the updated IP of the server in latest version


#1

Has anyone else faced similar issue.

reload with state file does not take the updated IP of the server in latest version. However the changes in ports and status ready/maint are reloaded from state file, but IP address is not.

Any help is appreciated


#2

Any particular init-addr setting? Please share the configuration.


#3

Thanks @lukastribus, below are my configuration

global
   daemon
   stats socket /root/haproxy-1.8.4/hapee-lb.sock mode 777 level admin expose-fd listeners
   server-state-file /root/haproxy-1.8.4/state
defaults
   load-server-state-from-file global
   default-server init-addr last,libc,none
frontend appFrontEnd
   bind *:8089
   default_backend appBackend
backend appBackend
    balance roundrobin
    server app1 0.0.0.0:8080 maxconn 1
    server app2 0.0.0.0:8080 maxconn 1

echo "set server appBackend/app1 addr 9.9.9.9" | socat stdio /root/haproxy-1.8.4/hapee-lb.sock

 echo "show servers state" | socat stdio  /root/haproxy-1.8.4/hapee-lb.sock  > /root/haproxy-1.8.4/state

new state file looks like

# be_id be_name srv_id srv_name srv_addr srv_op_state srv_admin_state srv_uweight srv_iweight srv_time_since_last_change srv_check_status srv_check_result srv_check_health srv_check_state srv_agent_state bk_f_forced_id srv_f_forced_id srv_fqdn srv_port
3 appBackend 1 app1 9.9.9.9 2 0 1 1 992 1 0 2 0 0 0 0 - 8080
3 appBackend 2 app2 0.0.0.0 2 0 1 1 992 1 0 2 0 0 0 0 - 8080

after this I reloaded ha-proxy

./haproxy -f haproxy.cfg -sf <PID>

and then
echo "show servers state" | socat stdio /root/haproxy-1.8.4/hapee-lb.sock > /root/haproxy-1.8.4/state
new state file has no change in app1 IP

   # be_id be_name srv_id srv_name srv_addr srv_op_state srv_admin_state srv_uweight srv_iweight srv_time_since_last_change srv_check_status srv_check_result srv_check_health srv_check_state srv_agent_state bk_f_forced_id srv_f_forced_id srv_fqdn srv_port
    3 appBackend 1 app1 0.0.0.0 2 0 1 1 992 1 0 2 0 0 0 0 - 8080
    3 appBackend 2 app2 0.0.0.0 2 0 1 1 992 1 0 2 0 0 0 0 - 8080

**Note change in port number works