Skip to content

Clusterware configuration hooks

Mark J. Titorenko edited this page Feb 1, 2016 · 1 revision

Clusterware configuration hooks

When a Clusterware-enabled node is booted, a sequence of events are performed. Each event can cause multiple hook scripts to be executed. The hook scripts are grouped within handlers each of which provides a different set of functionality that can be added to the node or cluster.

Clusterware Configurator

The Clusterware Configurator is executed at every startup via a System V init script (EL6 distros) or a systemd unit file (EL7 distros). If execution of the configurator needs to be skipped, this can be controlled by creating a configuration file in the Clusterware tree at etc/configurator.rc containing cw_CONFIGURATOR_skip=true. Otherwise the events proceed as follows:

initialize event

The initialize hooks perform actions that need to occur before the Configurator begins processing configuration files.

Wait for configuration file

The Configurator will pause execution until a configuration file exists at etc/config.yml. After 5 minutes, the Configurator will give up and timeout and generate a fail event. Any handlers that need to respond to a lack of configuration being available should define fail hook scripts to deal with the situation.

Fetch further configuration files

The config.yml file may contain a section that controls the retrieval of further configuration files from HTTP(S) URLs. This facility can be used to ensure consistent configuration across a cluster of nodes and cause shared configuration files to be updated on each boot.

preconfigure event

The preconfigure hooks perform actions that need to generate configuration files used by subsequent configure hooks. In general, this hook provides an opportunity to perform early configuration to be fed into other hook scripts (an example is the clusterable handler that parses the config.yml file into more easily ingested configuration files for use by other hook scripts during their configure hooks.)

configure event

The configure hooks perform actions related to configuring the system and services such as parsing, creation or alteration of configuration files required for services and enabling Serviceware components.

If a configure hook is not to be run on each boot, it must manage its own method of doing this. Conventionally, this is by checking for the existence of a directory named for the handler in the etc/config directory. If this directory exists, the hook should not run. If it does not exist, the directory should be created and the hook should run.

start event

The start hooks perform actions related to the starting of services. In most configurations this will include starting the node discovery service (Serf) as well as any services that have been enabled during the configure event. Note that some services enabled during the configure event will already have started on subsequent boots and start hook scripts should be written to cope with this eventuality.

node-started event

The node-started hooks perform any final actions required after all services have been started and the system is fully configured. This hook can be used to send messages to other services that need to know that a system has been fully configured and is operational.

fail event

As mentioned above, if the etc/config.yml file is not detected after 5 minutes, the fail event is triggered. This hook can be used to send messages to external services that need to know that the configuration of a system has failed.