1
0
mirror of https://github.com/samba-team/samba.git synced 2024-12-24 21:34:56 +03:00
samba-mirror/ctdb/config/events.d
Martin Schwenke 46684867b1 ctdb-recovery: Recovery lock setting can now include helper command
The underlying change is to allow the cluster mutex argstring to
optionally contain a helper command.  When the argument string starts
with '!' then the first word is the helper command to run.  This is
now the standard way of changing the helper from the default.

CTDB_CLUSTER_MUTEX_HELPER show now only be used to change the location
of the default helper when testing.

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
2016-04-28 09:39:17 +02:00
..
00.ctdb ctdb-scripts: Drop creation of database directories 2015-11-20 04:40:26 +01:00
01.reclock ctdb-recovery: Recovery lock setting can now include helper command 2016-04-28 09:39:17 +02:00
05.system ctdb-scripts: Avoid dividing by zero in memory calculation 2016-04-23 23:55:14 +02:00
10.external ctdb-scripts: New eventscript 10.external 2015-05-13 06:42:13 +02:00
10.interface ctdb-scripts: Add interface argument to kill_tcp_connections() 2016-04-01 04:42:11 +02:00
11.natgw ctdb-scripts: Fix incorrect comment 2016-04-25 07:10:14 +02:00
11.routing ctdb-eventscripts: Update comment in 11.routing 2014-05-05 03:55:08 +02:00
13.per_ip_routing ctdb-scripts: Rename variable CTDB_ETCDIR to CTDB_SYS_ETCDIR 2015-09-15 08:56:21 +02:00
20.multipathd eventscripts: Clean up 20.multipathd 2013-10-22 14:34:04 +11:00
31.clamd eventscripts: Each script should set CTDB_BASE if it is not set 2013-01-08 15:18:46 +11:00
40.vsftpd eventscripts: Use ctdb_check_counter() instead of ctdb_check_counter_limit() 2013-05-06 16:24:59 +10:00
41.httpd eventscripts: Remove reconfigure code from httpd eventscript 2013-10-22 14:34:04 +11:00
49.winbind ctdb-scripts: Drop use of "smbcontrol winbindd ip-dropped ..." 2016-02-10 14:08:16 +01:00
50.samba ctdb-scripts: Improve error handling for 50.samba testparm failure 2015-08-07 05:33:29 +02:00
60.nfs ctdb-scripts: Improve error messages when using NFS service_check_cmd 2016-04-25 07:10:14 +02:00
70.iscsi ctdb-scripts: Changed uses of "ctdb xpnn" to ctdb_get_pnn() 2015-04-27 03:32:10 +02:00
91.lvs ctdb-scripts: Simplify "ctdb lvs ..." output 2016-04-15 05:57:18 +02:00
99.timeout eventscripts: Instead of listing all tunables, query EventScriptTimeout 2013-10-24 16:54:07 +11:00
README ctdb-docs: Rewrite event script documentation 2015-12-04 09:17:17 +01:00

The events.d/ directory contains event scripts used by CTDB.  Event
scripts are triggered on certain events, such as startup, monitoring
or public IP allocation.  Scripts may be specific to services,
networking or internal CTDB operations.

All event scripts start with the prefix 'NN.' where N is a digit.  The
event scripts are run in sequence based on NN.  Thus 10.interface will
be run before 60.nfs.  It is recommended to keep each NN unique.
However, scripts with the same NN prefix will be executed in
alphanumeric sort order.

As a special case, any eventscript that ends with a '~' character will be
ignored since this is a common postfix that some editors will append to
older versions of a file.

Only executable event scripts are run by CTDB.  Any event script that
does not have execute permission is ignored.

The eventscripts are called with varying number of arguments.  The
first argument is the event name and the rest of the arguments depend
on the event name.

Event scripts must return 0 for success and non-zero for failure.

Output of event scripts is logged.  On failure the output of the
failing event script is included in the output of "ctdb scriptstatus".

The following events are supported (with arguments shown):

init

	This event is triggered once when CTDB is starting up.  This
	event is used to do some basic cleanup and initialisation.

	During the "init" event CTDB is not listening on its Unix
	domain socket, so the "ctdb" CLI will not work.

	Failure of this event will cause CTDB to terminate.

	Example: 00.ctdb creates $CTDB_SCRIPT_VARDIR

setup

	This event is triggered once, after the "init" event has
	completed.

	For this and any subsequent events the CTDB Unix domain socket
	is available, so the "ctdb" CLI will work.

	Failure of this event will cause CTDB to terminate.

	Example: 00.ctdb processes tunables defined in the CTDB
        configuration using CTDB_SET_<TunableName>=<TunableValue>.

startup

	This event is triggered after the "setup" event has completed
	and CTDB has finished its initial database recovery.

	This event starts all services that are managed by CTDB.  Each
	service that is managed by CTDB should implement this event
	and use it to (re)start the service.

	If the "startup" event fails then CTDB will retry it until it
	succeeds.  There is no limit on the number of retries.

	Example: 50.samba uses this event to start the Samba daemon if
	CTDB_MANAGES_SAMBA=yes.

shutdown

	This event is triggered when CTDB is shutting down.

	This event shuts down all services that are managed by CTDB.
	Each service that is managed by CTDB should implement this
	event and use it to stop the service.

	Example: 50.samba uses this event to shut down the Samba
	daemon if CTDB_MANAGES_SAMBA=yes.

monitor

	This event is run periodically.  The interval between
	successive "monitor" events is configured using the
	MonitorInterval tunable, which defaults to 15 seconds.

	This event is triggered by CTDB to continuously monitor that
	all managed services are healthy.  If all event scripts
	complete then the monitor event successfully then the node is
	marked HEALTHY.  If any event script fails then no subsequent
	scripts will be run for that event and the node is marked
	UNHEALTHY.

	Each service that is managed by CTDB should implement this
	event and use it to monitor the service.

	Example: 10.interface checks that each configured interface
	for public IP addresses has a physical link established.

startrecovery

	This event is triggered every time a database recovery process
	is started.

	This is rarely used.

recovered

	This event is triggered every time a database recovery process
	is completed.

	This is rarely used.

takeip <interface> <ip-address> <netmask-bits>

	This event is triggered for each public IP address taken by a
	node during IP address (re)assignment.  Multiple "takeip"
	events can be run in parallel if multiple IP addresses are
	being assigned.

	Example: In 10.interface the "ip" command (from the Linux
	iproute2 package) is used to add the specified public IP
	address to the specified interface.  The "ip" command can
	safely be run concurrently.  However, the "iptables" command
	cannot be run concurrently so a wrapper is used to serialise
	runs using exclusive locking.

	If substantial work is required to reconfigure a service when
	a public IP address is taken over it can be better to defer
	service reconfiguration to the "ipreallocated" event, after
	all IP addresses have been assigned.

	Example: 60.nfs uses ctdb_service_set_reconfigure() to flag
	that public IP addresses have changed so that service
	reconfiguration will occur in the "ipreallocated" event.

releaseip <interface> <ip-address> <netmask-bits>

	This event is triggered for each public IP address released by
	a node during IP address (re)assignment.  Multiple "releaseip"
	events can be run in parallel if multiple IP addresses are
	being unassigned.

	In all other regards, this event is analogous to the "takeip"
	event above.

updateip <old-interface> <new-interface> <ip-address> <netmask-bits>

	This event is triggered for each public IP address moved
	between interfaces on a node during IP address (re)assignment.
	Multiple "updateip" events can be run in parallel if multiple
	IP addresses are being moved.

        This event is only used if multiple interfaces are capable of
        hosting an IP address, as specified in the public addresses
        configuration file.

	This event is similar to the "takeip" event above.

ipreallocated

	This event is triggered after "releaseip", "takeip" and
	"updateip" events during public IP address (re)assignment.

	This event is used to reconfigure services.

        This event runs even if public IP addresses on a node have not
	been changed.  This allows reconfiguration to depend on the
	states of other nodes rather that just IP addresses.

	Example: 11.natgw recalculates the NAT gateway master and
	updates the relevant network configuration on each node if the
	NAT gateway master has changed.

Additional notes for "takeip", "releaseip", "updateip",
ipreallocated":

* Failure of any of these events causes IP allocation to be retried.

* The "ipreallocated" event is run on all nodes.  It is even run if no
  "takeip", "releaseip" or "updateip" events were triggered.

* An event script can use ctdb_service_set_reconfigure() in "takeip"
  or "releaseip" events to flag that its service needs to be
  reconfigured.  The event script can then define a
  service_reconfigure() function, which will be implicitly run before
  the "ipreallocated" event.  This is a useful way of performing
  reconfiguration that is conditional upon public IP address changes.

  This means an explicit "ipreallocated" event handler is usually not
  necessary.