solidDB Help : solidDB Grid : Failure handling in the grid : Node controller : Optional node controller scripts
  
Optional node controller scripts
Note Check the solidDB Release Notes for any limitations that are associated with using a grid in the current release.
In addition to restarting the server when required, you can configure the node controller to run some cleanup, recovery, or other administrative tasks whenever a restart is required. You add scripts that run the required tasks to the working directory of the node controller and the node controller automatically runs each script either before or after restarting the server (depending on the script).
Note The node controller must be active when grid failures occur in order for the recovery actions to run.
All scripts receive the following parameters:
server full executable path,
server connect string,
server startup directory,
server current working directory.
By default, script output is appended to a file named script_name.out in the same directory.
The following scripts are available. Depending on your operating system, the scripts will either have a .bat or a .sh extension.
 
Name
Use case
nc_after_server_restart
Executed after the node is restarted.
nc_before_server_restart
Executed before the node is restarted.
nc_recycle_dropped_node
Executed after the DROP NODE RECYCLE statement is executed, before the node is restarted.
In order for the DROP NODE RECYCLE statement to succeed, this script must move or delete the existing database because a recycled node must restart without any database.
nc_server_outofservice
Executed when a node restart has failed a number of consecutive times (as configured in the MaxRestart parameter in controller.ini).
This script can be used to resolve situations where the node controller is not able to restart the node (for example, due to a database corruption or an immediate assertion at startup). After this script is executed, the node controller tries to reconnect to the server.
The following text is an example of the nc_recycle_dropped_node script file:
#!/usr/local/bin/zsh
#
# Recycles Grid node. This script performs cleanup steps before Grid node is restarted
# with -xgridnode command line option.
#
# $1 Server's full executable path
# $2 Server's connect string
# $3 Server's startup directory
# $4 Server's current working directory
#
#
BAKDIR=recycle
cd $3
mkdir $BAKDIR
rm $BAKDIR/*.log
rm $BAKDIR/*.db
mv *.log $BAKDIR
mv *.db $BAKDIR
Go up to
Node controller