treat interfaces with the name ethX* as bond devices
[metze/ctdb/wip.git] / config / events.d / README
1 This directory is where you should put any local or application
2 specific event scripts for ctdb to call.
3
4 All event scripts start with the prefic 'NN.' where N is a digit.
5 The event scripts are run in sequence based on NN.
6 Thus 10.interfaces will be run before 60.nfs.
7
8 Each NN must be unique and duplicates will cause undefined behaviour.
9 I.e. having both 10.interfaces and 10.otherstuff is not allowed.
10
11
12 As a special case, any eventscript that ends with a '~' character will be 
13 ignored since this is a common postfix that some editors will append to 
14 older versions of a file.
15
16
17 The eventscripts are called with varying number of arguments.
18 The first argument is the "event" and the rest of the arguments depend
19 on which event was triggered.
20
21 All of the events except the 'shutdown' and 'startrecovery' events will be
22 called with the ctdb daemon in NORMAL mode (ie. not in recovery)
23
24 The events currently implemented are
25 startup
26         This event does not take any additional arguments.
27         This event is only invoked once, when ctdb is starting up.
28         This event is used to wait for the service to start and all
29         resources for the service becoming available.
30
31         This is used to prevent ctdb from starting up and advertize its
32         services until all dependent services have become available.
33
34         All services that are managed by ctdb should implement this
35         event and use it to start the service.
36
37         Example: 50.samba uses this event to start the samba daemon
38         and then wait until samba and all its associated services have
39         become available. It then also proceeds to wait until all
40         shares have become available.
41
42 shutdown
43         This event is called when the ctdb service is shuting down.
44         
45         All services that are managed by ctdb should implement this event
46         and use it to perform a controlled shutdown of the service.
47
48         Example: 60.nfs uses this event to shut down nfs and all associated
49         services and stop exporting any shares when this event is invoked.
50
51 monitor
52         This event is invoked every X number of seconds.
53         The interval can be configured using the MonitorInterval tunable
54         but defaults to 15 seconds.
55
56         This event is triggered by ctdb to continously monitor that all
57         managed services are healthy.
58         When invoked, the event script will check that the service is healthy
59         and return 0 if so. If the service is not healthy the event script
60         should return non zero.
61
62         If a service returns nonzero from this script this will cause ctdb
63         to consider the node status as UNHEALTHY and will cause the public
64         address and all associated services to be failed over to a different
65         node in the cluster.
66
67         All managed services should implement this event.
68
69         Example: 10.interfaces which checks that the public interface (if used)
70         is healthy, i.e. it has a physical link established.
71
72 takeip
73         This event is triggered everytime the node takes over a public ip
74         address during recovery.
75         This event takes three additional arguments :
76         'interface' 'ipaddress' and 'netmask'
77
78         Before this event there will always be a 'startrecovery' event.
79
80         This event will always be followed by a 'recovered' event once
81         all ipaddresses have been reassigned to new nodes and the ctdb database
82         has been recovered.
83         If multiple ip addresses are reassigned during recovery it is
84         possible to get several 'takeip' events followed by a single 
85         'recovered' event.
86
87         Since there might involve substantial work for the service when an ip
88         address is taken over and since multiple ip addresses might be taken 
89         over in a single recovery it is often best to only mark which addresses
90         are being taken over in this event and defer the actual work to 
91         reconfigure or restart the services until the 'recovered' event.
92
93         Example: 60.nfs which just records which ip addresses are being taken
94         over into a local state directory   and which defers the actual
95         restart of the services until the 'recovered' event.
96
97
98 releaseip
99         This event is triggered everytime the node releases a public ip
100         address during recovery.
101         This event takes three additional arguments :
102         'interface' 'ipaddress' and 'netmask'
103
104         In all other regards this event is analog to the 'takeip' event above.
105
106         Example: 60.nfs
107
108 startrecovery
109         This event is triggered everytime we start a recovery process
110         or before we start changing ip address allocations.
111
112 recovered
113         This event is triggered every time we have finished a full recovery
114         and also after we have finished reallocating the public ip addresses
115         across the cluster.
116
117         Example: 60.nfs which if the ip address configuration has changed
118         during the recovery (i.e. if addresses have been taken over or
119         released) will kill off any tcp connections that exist for that
120         service and also send out statd notifications to all registered 
121         clients.
122         
123 stopped
124         This event is called when a node is STOPPED and can be used to
125         perform additional cleanup that is required.
126         Note that a stopped node is considered inactive, so it will not
127         be issuing the recovered event once the cluster has recovered.
128         See 91.lvs for a use of this event.
129
130 Additional note for takeip, releaseip, recovered:
131
132 ALL services that depend on the ip address configuration of the node must 
133 implement all three of these events.
134
135 ALL services that use TCP should also implement these events and at least
136 kill off any tcp connections to the service if the ip address config has 
137 changed in a similar fashion to how 60.nfs does it.
138 The reason one must do this is that ESTABLISHED tcp connections may survive
139 when an ip address is released and removed from the host until the ip address
140 is re-takenover.
141 Any tcp connections that survive a release/takeip sequence can potentially
142 cause the client/server tcp connection to get out of sync with sequence and 
143 ack numbers and cause a disruptive ack storm.
144
145