State Changes
Overview
On startup of nevisAgent the failover cluster is in state initial.Whenever nevisAgent changes a state you call this a transition. The following transitions exist:
- A standby server becomes active.
- An active server becomes standby.
An automatic transition to the active state is initiated when the heartbeat is not received for approximately one minute.
- Changing the state to active includes the following tasks:
- Adding sub-interfaces on the chosen Ethernet interface by assigning IP addresses. Setting these sub-interfaces to "UP".
- Setting the default route.
- Restarting all nevisProxy instances.
- Sending a gratuitous ARP broadcast announcing the new MAC address as a broadcast in order to update the ARP cache of all involved network devices.
- Changing the state to the standby state includes the following tasks:
- Setting the sub-interfaces to "DOWN".
- Stopping all nevisProxy instances.
Extension Hooks
When nevisAgent changes a state, a shell script is executed. By default this script is located at: /opt/nevisagent/bin/ha.sh.
You can customize the commands that nevisAgent executes by replacing this script. Proceed as follows:
Copy the script:
cp /opt/nevisagent/bin/ha.sh /var/opt/nevisagent/bin/ha.sh
Remove the following block from /var/opt/nevisagent/bin/ha.sh:
if [ -x /var/opt/nevisagent/default/bin/ha.sh ]; then
/var/opt/nevisagent/default/bin/ha.sh $@
exit $?
fiImportantThis last step is important. If you do not perform this step, you get an endless loop when nevisAgent runs the script.
Examples
Preventing errors in systemd after nevisAppliance boot
In a failover scenario, the nevisProxy instance should be managed by nevisAgent. However, nevisAppliance starts all Nevis instances during boot. This leads to an error on the passive server in case systemd is used to control nevisProxy instances, because the shared IP is not available. Subsequently, systemd may attempt to restart nevisProxy, which leads to follow-up errors.
As of version 3.6.11.0, nevisAgent provides hooks, which are executed periodically when the server is active or standby. The hooks allow you to create a workaround to this known issue, by customizing the ha.sh script. See the previous section Extension Hooks on how to use a custom script. In your custom script, replace the function is_passive with the following:
is_passive() {
nohup nevisproxy all stop 2>/dev/null 1>/dev/null &
}