Configuration

CMD interface

Surealived allows to read application parameters and override some real servers settings in runtime without services.xml reconfiguration. Interface is listening at loopback from default (127.0.0.1) on 1337 port. Currently there can be performed specified actions: 

  • vlist [passive] - lists virtuals defined in tester memory,
  • rlist [passive] - lists reals defined in tester memory for selected virtual,
  • stats [passive] - shows runtime statistics and performance counters,
  • connstats [passive] - shows detailed virtual/real statistics,
  • rset [active] - allows changing weight for selected real or set its state to OFFLINE (weight = 0) or DOWN (remove real from IPVS).

Examples:
 

> printf "vlist\n" | nc -q 1 localhost 1337
0. vname=onet vproto=tcp vaddr=192.168.0.1 vport=80 vfwmark=0 vrt=dr vsched=wrr
1. vname=wp vproto=tcp vaddr=192.168.0.2 vport=80 vfwmark=0 vrt=dr vsched=wrr

> printf "rlist vproto=tcp vaddr=192.168.0.2 vport=80\n" | nc -q 1 localhost 1337
1. raddr=212.77.100.101 rport=80 currwgt=11 confwgt=11 ronline=TRUE rstate=ONLINE

> printf "rset vproto=tcp vaddr=192.168.0.2 vport=80 raddr=212.77.100.101 rport=80 rweight=1\%\%\n" \
	 | nc -q 1 localhost 1337
Set: rstate=ONLINE, weight=1, inpercent=TRUE

> printf "rset vproto=tcp vaddr=192.168.0.2 vport=80 raddr=212.77.100.101 rport=80 rstate=OFFLINE\n" \
	 | nc -q 1 localhost 1337
Set: rstate=OFFLINE, weight=-1, inpercent=FALSE

> printf "rlist vproto=tcp vaddr=192.168.0.2 vport=80\n" | nc -q 1 localhost 1337
1. raddr=212.77.100.101 rport=80 currwgt=0 confwgt=11 ronline=TRUE rstate=OFFLINE

> printf "stats\n" | nc -q 1 localhost 1337
... statistics here ...

> printf "connstats\n" | nc -q 2 localhost 1337
... detailed statistics here ...

Active command rset allows us to change weight also as percent of weight configurated in xml services file. You need to remember, that for 1% runtime weight will be set to minimum 1.

All changes modified by cmd are saved in override.dump file. That means, all our overrides will survive even xml services changes or surealived restarts performed in the meantime.