Using Custom Script execution feature to change the virtual IP address of the system during HA failover
In an HA environment, if the Stub microservices such as WSStub and RESTStub are being used, the clients have to use the IP address of the active/standalone server to connect to the Stub microservices.
If there is a failover ie., if primary HA server goes down and the secondary server becomes the standalone/active server, the user needs to change the IP address on their client machines or needs to use a load balancer to switch automatically.
To avoid using a load balancer as explained above, the custom script execution feature can be used to add/remove Virtual IP address while the server switches to states such as Active, Standalone and Passive. The script should add a virtual IP address if the server switches to standalone or active state and should remove the Virtual IP if the server switches the state to passive or waiting or during server shutdown. A sample script for the same is provided at FioranoHome/esb/samples/scripts.
To configure the Server profile for the same, perform the following actions:
- Open eStudio and go to the profile manager.
- Open the Peer Primary HA profile.
- Go to Fiorano > Esb > Ha > Server > HAFPSServer and configure the properties below:
- Enable the ScriptEnable property and provide the ScriptExecutionWaitTime property value.
- Provide the IP Addition script execution command for 'ActiveStartScript' and 'StandaloneScript'.
- Provide the IP Removal script execution command for 'PassiveStartScript' and 'ShutdownScript' too.
- Press CTRL+S or click the Save icon to save the profile.
- Perform above actions for the Peer Secondary HA profile too.
Start the servers.