rha 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- data/Changelog +0 -0
- data/MIT-LICENSE +21 -0
- data/README +73 -0
- data/lib/rha/authkeys.rb +80 -0
- data/lib/rha/daemon.rb +227 -0
- data/lib/rha/ha_cf.rb +762 -0
- data/lib/rha/haresources.rb +63 -0
- data/lib/rha/version.rb +17 -0
- data/lib/rha.rb +9 -0
- data/setup.rb +1585 -0
- data/test/test_helper.rb +2 -0
- data/test/test_rha.rb +11 -0
- metadata +78 -0
data/lib/rha/ha_cf.rb
ADDED
@@ -0,0 +1,762 @@
|
|
1
|
+
# = rha - A Heartbeat gem for Ruby
|
2
|
+
#
|
3
|
+
# Homepage:: http://github.com/jjuliano/rha
|
4
|
+
# Author:: Joel Bryan Juliano
|
5
|
+
# Copyright:: (cc) 2011 Joel Bryan Juliano
|
6
|
+
# License:: MIT
|
7
|
+
|
8
|
+
#
|
9
|
+
# class RhaConfig.new( array, str, array)
|
10
|
+
#
|
11
|
+
|
12
|
+
#
|
13
|
+
# RhaConfig are configurations for heartbeat.
|
14
|
+
#
|
15
|
+
class RhaConfig
|
16
|
+
#
|
17
|
+
# The use_logd directive specifies whether Heartbeat logs its
|
18
|
+
# messages through logging daemon or not.
|
19
|
+
#
|
20
|
+
# If the logging daemon is used, all log messages will be sent
|
21
|
+
# through IPC to the logging daemon, which then writes them into
|
22
|
+
# log files. In case the logging daemon dies (for whatever reason),
|
23
|
+
# a warning message will be logged and all messages will be written
|
24
|
+
# to log files directly.
|
25
|
+
#
|
26
|
+
# If the logging daemon is used, logfile/debugfile/logfacility in this
|
27
|
+
# file are not meaningful any longer. You should check the config file
|
28
|
+
# for logging daemon (the default is /etc/logd.cf).
|
29
|
+
#
|
30
|
+
# If use_logd is not used, all log messages will be written to log files directly.
|
31
|
+
#
|
32
|
+
# The logging daemon is started/stopped in heartbeat script.
|
33
|
+
#
|
34
|
+
# Setting use_logd to "on" is recommended.
|
35
|
+
#
|
36
|
+
attr_accessor :use_logd
|
37
|
+
|
38
|
+
#
|
39
|
+
# The udpport directive specifies which port Heartbeat will use for its
|
40
|
+
# UDP intra-cluster communication. There are two common reasons for overriding
|
41
|
+
# this value: there are multiple bcast clusters on the same subnet, or this port
|
42
|
+
# is already in use in accordance with some locally-established policy.
|
43
|
+
#
|
44
|
+
# The default value for this parameter is the the port ha-cluster in /etc/services
|
45
|
+
# (if present), or 694 if port ha-cluster is not in /etc/services. 694 is the
|
46
|
+
# IANA registered port number for Heartbeat (a.k.a. ha-cluster).
|
47
|
+
#
|
48
|
+
# A sample udpport directive is shown below.
|
49
|
+
#
|
50
|
+
# udpport 694
|
51
|
+
#
|
52
|
+
# You have to configure udpport (in ha.cf) before you configure
|
53
|
+
# ucast or bcast, if not heartbeat will use the default port (694).
|
54
|
+
#
|
55
|
+
# Note
|
56
|
+
#
|
57
|
+
# Due to a specification error in the syntax of the mcast directive,
|
58
|
+
# this directive does not apply to mcast communications.
|
59
|
+
#
|
60
|
+
attr_accessor :udpport
|
61
|
+
|
62
|
+
#
|
63
|
+
# This directive specifies what users and/or groups are allowed to connect to
|
64
|
+
# a specific API group name. The syntax is simple:
|
65
|
+
#
|
66
|
+
# apiauth apigroupname [uid=uid1,uid2 ...] [gid=gid1,gid2 ...]
|
67
|
+
#
|
68
|
+
# You can specify either a uid list, or a gid list, or both. However you must
|
69
|
+
# specify either a uid list or a gid list. If you include both a uid list and a
|
70
|
+
# gid list, then a process is authorized to connect to that API group if if it is
|
71
|
+
# either in the uid-list or it is in the gid-list.
|
72
|
+
#
|
73
|
+
# The API group name default has special meaning. If it is specified, it will
|
74
|
+
# be used for authorizing clients without any API group name, and all client
|
75
|
+
# groups not identified by any other apiauth directive.
|
76
|
+
#
|
77
|
+
# Unless you specify otherwise in the ha.cf file, certain services will be
|
78
|
+
# provided default authorizations as follows:
|
79
|
+
#
|
80
|
+
# Table A.1. Default service authorizations
|
81
|
+
# Service Default apiauth
|
82
|
+
# ipfail uid=hacluster
|
83
|
+
# ccm gid=haclient
|
84
|
+
# ping gid=haclient
|
85
|
+
# cl_status gid=haclient
|
86
|
+
# lha-snmpagent uid=root
|
87
|
+
# crm uid=hacluster
|
88
|
+
#
|
89
|
+
attr_accessor :apiauth
|
90
|
+
|
91
|
+
#
|
92
|
+
# The autojoin directive enables nodes to join automatically just by
|
93
|
+
# communicating with the cluster, hence not requiring node directives in the ha.cf
|
94
|
+
# file. Since our communication is normally strongly authenticated, only nodes
|
95
|
+
# which know the cluster key can join (automatically or otherwise).
|
96
|
+
#
|
97
|
+
# The values you can give for the autojoin directive have the following
|
98
|
+
# meanings:
|
99
|
+
#
|
100
|
+
# * none: disables automatic joining.
|
101
|
+
# * other: allows nodes other than ourself who are not listed in ha.cf to
|
102
|
+
# join automatically. In other words, our node has to be listed in ha.cf, but
|
103
|
+
# other nodes do not.
|
104
|
+
# * any: allows any node to join automatically without being listed in
|
105
|
+
# ha.cf, even the current node.
|
106
|
+
#
|
107
|
+
# Note that the set of nodes currently considered part of the cluster is kept
|
108
|
+
# in the hostcache file. With autojoin enabled, the node directive is no longer
|
109
|
+
# authoritative - the hostcache file is.
|
110
|
+
#
|
111
|
+
attr_accessor :autojoin
|
112
|
+
|
113
|
+
#
|
114
|
+
# The bcast directive is used to configure which interfaces Heartbeat sends
|
115
|
+
# UDP broadcast traffic on. More than one interface can be specified on the line.
|
116
|
+
# The udpport directive is used to configure which port is used for these
|
117
|
+
# broadcast communications if the udpport directive is specified before the bcast
|
118
|
+
# directive, otherwise the default port will be used. A couple of sample bcast
|
119
|
+
# lines are shown below.
|
120
|
+
#
|
121
|
+
# bcast eth0 eth1 # on Linux systems
|
122
|
+
# bcast le0# for Solaris systems
|
123
|
+
#
|
124
|
+
# Note
|
125
|
+
#
|
126
|
+
# Broadcast links are not supported in Pacemaker clusters on BSD systems.
|
127
|
+
#
|
128
|
+
attr_accessor :bcast
|
129
|
+
|
130
|
+
#
|
131
|
+
# The compression directive sets which compression method will be used when a
|
132
|
+
# message is big and compression is needed.
|
133
|
+
#
|
134
|
+
# It could be either zlib or bz2, depending on whether you have the
|
135
|
+
# corresponding library in the system. You can check
|
136
|
+
# /usr/lib/heartbeat/plugins/HBcompress to see what compression module is
|
137
|
+
# available.
|
138
|
+
#
|
139
|
+
# If this directive is not set, there will be no compression.
|
140
|
+
#
|
141
|
+
attr_accessor :compression
|
142
|
+
|
143
|
+
#
|
144
|
+
# The compression_threshold directive sets the threshold to compress a
|
145
|
+
# message, e.g. if the threshold is 1, then any message with size greater than 1
|
146
|
+
# KB will be compressed. The default is 2 (KB). This directive only makes sense if
|
147
|
+
# you have set the compression directive.
|
148
|
+
#
|
149
|
+
attr_accessor :compression_threshold
|
150
|
+
|
151
|
+
#
|
152
|
+
# The conn_logd_time directive specifies the time Heartbeat will reconnect to
|
153
|
+
# the logging daemon if the connection between Heartbeat and the logging daemon is
|
154
|
+
# broken. The conn_logd_time is specified according to the Heartbeat time syntax,
|
155
|
+
# for example:
|
156
|
+
#
|
157
|
+
# conn_logd_time 60 #60 seconds
|
158
|
+
#
|
159
|
+
# The default is 60 seconds.
|
160
|
+
# Note
|
161
|
+
#
|
162
|
+
# Heartbeat will not automatically reconnect to the logging daemon. It only
|
163
|
+
# tries to reconnect when it needs to log a message and conn_logd_time have passed
|
164
|
+
# since the last attempt to connect.
|
165
|
+
#
|
166
|
+
attr_accessor :conn_logd_time
|
167
|
+
|
168
|
+
#
|
169
|
+
# The coredumps directive tells Heartbeat to do things to enable making core
|
170
|
+
# dumps - should it need to dump core.
|
171
|
+
#
|
172
|
+
# The allowed values are true and false.
|
173
|
+
#
|
174
|
+
attr_accessor :coredumps
|
175
|
+
|
176
|
+
#
|
177
|
+
# Enables the Pacemaker cluster manager. For historical reasons, the default
|
178
|
+
# for this option is off; however, it should always be set to respawn.
|
179
|
+
#
|
180
|
+
# When set to respawn, the directive automatically implies:
|
181
|
+
#
|
182
|
+
# apiauth stonithduid=root
|
183
|
+
# apiauth crmduid=hacluster
|
184
|
+
# apiauth cib uid=hacluster
|
185
|
+
#
|
186
|
+
# respawn hacluster ccm
|
187
|
+
# respawn hacluster cib
|
188
|
+
# respawn rootstonithd
|
189
|
+
# respawn rootlrmd
|
190
|
+
# respawn hacluster crmd
|
191
|
+
#
|
192
|
+
attr_accessor :crm
|
193
|
+
|
194
|
+
#
|
195
|
+
# The deadtime directive is used to specify how quickly Heartbeat should
|
196
|
+
# decide that a node in a cluster is dead. Setting this value too low will cause
|
197
|
+
# the system to falsely declare itself dead. Setting it too high will delay
|
198
|
+
# takeover after the failure of a node in the cluster.
|
199
|
+
attr_accessor :deadtime
|
200
|
+
|
201
|
+
#
|
202
|
+
# The debug directive is used to set the level of debugging in effect in the
|
203
|
+
# system. Production systems should have their debug level set to zero (i.e.,
|
204
|
+
# turned off). This is the default. Legal values of the debug option are between
|
205
|
+
# 0-255. The most useful values are between 0 (off) and 3. Setting the debug level
|
206
|
+
# greater than 1 can have an adverse effect on the size of your log files, and on
|
207
|
+
# the system's ability to send heartbeats at rapid rates, thus affecting the
|
208
|
+
# cluster reliability.
|
209
|
+
#
|
210
|
+
# The debug level of the system can also be specified on the command line
|
211
|
+
# using the -d option. Additionally, the debug level of the system can be
|
212
|
+
# dynamically changed by sending the heartbeat process SIGUSR1 and SIGUSR2
|
213
|
+
# signals. SIGUSR1 raises the debug level, and SIGUSR2 lowers it.
|
214
|
+
#
|
215
|
+
attr_accessor :debug
|
216
|
+
|
217
|
+
#
|
218
|
+
# The hbgenmethod directive specifies how Heartbeat should compute its current
|
219
|
+
# generation number for communications. This is a specialized and obscure
|
220
|
+
# directive, used mainly in firewalls which have no local disk, and other devices
|
221
|
+
# which do not have a method of storing data persistently across reboots. It
|
222
|
+
# defaults to storing the Heartbeat generations in a file. Generation numbers are
|
223
|
+
# used by Heartbeat for replay attack protection.
|
224
|
+
#
|
225
|
+
# hbgenmethod time|file
|
226
|
+
#
|
227
|
+
# Warning
|
228
|
+
#
|
229
|
+
# If one specifies the time method, there are certain possible cases where
|
230
|
+
# troubles can arise. If a machine restarts Heartbeat and its local time of day
|
231
|
+
# clock is less than or equal to than the value of the time of day clock when
|
232
|
+
# Heartbeat last started, then that node will be unable to join the cluster.
|
233
|
+
#
|
234
|
+
attr_accessor :hbgenmethod
|
235
|
+
|
236
|
+
#
|
237
|
+
# The initdead parameter is used to set the time that it takes to declare a
|
238
|
+
# cluster node dead when Heartbeat is first started. This parameter generally
|
239
|
+
# needs to be set to a higher value, because experience suggests that it sometimes
|
240
|
+
# takes operating systems many seconds for their communication systems before they
|
241
|
+
# operate correctly. initdead is specified according to the Heartbeat time syntax.
|
242
|
+
# A sample initdead value is shown below:
|
243
|
+
#
|
244
|
+
# initdead 30
|
245
|
+
#
|
246
|
+
# In some switched network environments, switches engage in a spanning tree
|
247
|
+
# algorithm whenever a NIC connects to a port. This can take a long time to
|
248
|
+
# complete, and it is only necessary if the NIC being connected is another switch.
|
249
|
+
# If this is the case, you may be able to configure certain NICs as not being
|
250
|
+
# switches and shrink the connection delay significantly. If not, you'll need to
|
251
|
+
# raise initdead to make this problem go away.
|
252
|
+
#
|
253
|
+
# If this is set too low, you'll see one node declare the other as dead.
|
254
|
+
#
|
255
|
+
attr_accessor :initdead
|
256
|
+
|
257
|
+
#
|
258
|
+
# The keepalive directive sets the interval between heartbeat packets. It is
|
259
|
+
# specified according to the Heartbeat time syntax.
|
260
|
+
#
|
261
|
+
attr_accessor :keepalive
|
262
|
+
|
263
|
+
#
|
264
|
+
# The logfacility is used to tell Heartbeat which syslog logging facility it
|
265
|
+
# should use for logging its messages.
|
266
|
+
#
|
267
|
+
# The possible values for logfacility vary by operating system, but some of
|
268
|
+
# the most common ones are {auth, authpriv, daemon, syslog, user, local0, local1,
|
269
|
+
# local2, local3, local4, local5, local6, local7}.
|
270
|
+
#
|
271
|
+
# A sample logfacility directive is shown below:
|
272
|
+
#
|
273
|
+
# logfacility local7
|
274
|
+
#
|
275
|
+
# If you want to disable logging to syslog:
|
276
|
+
#
|
277
|
+
# logfacility none
|
278
|
+
#
|
279
|
+
attr_accessor :logfacility
|
280
|
+
|
281
|
+
#
|
282
|
+
# The mcast directive is used to configure a multicast communication path. The
|
283
|
+
# syntax of an mcast directive is:
|
284
|
+
#
|
285
|
+
# mcast dev mcast-group udp-port ttl 0
|
286
|
+
#
|
287
|
+
# * dev - IP device to send/rcv heartbeats on
|
288
|
+
# * mcast-group - multicast group to join (class D multicast address
|
289
|
+
# 224.0.0.0 - 239.255.255.255). For most Heartbeat uses, the first byte should be
|
290
|
+
# 239.
|
291
|
+
# * port - UDP port to sendto/rcvfrom (set this to the same value as
|
292
|
+
# udpport)
|
293
|
+
# * ttl - the ttl value for outbound heartbeats. This affects how far the
|
294
|
+
# multicast packet will propagate. (0-255). Set to 1 for the current subnet. Must
|
295
|
+
# be greater than zero.
|
296
|
+
#
|
297
|
+
# A sample mcast directive is shown below:
|
298
|
+
#
|
299
|
+
# mcast eth0 239.0.0.1 694 1 0
|
300
|
+
#
|
301
|
+
attr_accessor :mcast
|
302
|
+
|
303
|
+
#
|
304
|
+
# The msgfmt directive specifies the format Heartbeat uses in wire.
|
305
|
+
#
|
306
|
+
# * classic - Heartbeat will convert a message into a string and transmit
|
307
|
+
# in wire. Binary values are converted with a base64 library.
|
308
|
+
# * netstring - Binary messages will be transmitted directly. This is more
|
309
|
+
# efficient since it avoids conversion between string and binary values.
|
310
|
+
#
|
311
|
+
# When in doubt, leave the default (classic).
|
312
|
+
#
|
313
|
+
attr_accessor :msgfmt
|
314
|
+
|
315
|
+
#
|
316
|
+
# The node directive tells what machines are in the cluster. The syntax of the
|
317
|
+
# node directive is simple:
|
318
|
+
#
|
319
|
+
# node nodename1 nodename2 ...
|
320
|
+
#
|
321
|
+
# Node names in the directive must match the "uname -n" of that machine.
|
322
|
+
#
|
323
|
+
# You can declare multiple node names in one directive. You can also use the
|
324
|
+
# directive multiple times. Normally every node in the cluster must be listed in
|
325
|
+
# the ha.cf file, including the current node, unless the autojoin directive is
|
326
|
+
# enabled.
|
327
|
+
#
|
328
|
+
# The node directive is not completely authoritative with regard to nodes
|
329
|
+
# heartbeat will communicate with. If a node has ever been added in the past, it
|
330
|
+
# will tend to remain in the hostcache file more until it's manually removed.
|
331
|
+
#
|
332
|
+
attr_accessor :node
|
333
|
+
|
334
|
+
#
|
335
|
+
# The realtime directive specifies whether or not Heartbeat should try and
|
336
|
+
# take advantage of the operating system's realtime scheduling features. When
|
337
|
+
# enabled, Heartbeat will lock itself into memory, and raise its priority to a
|
338
|
+
# realtime priority (as set by the rtprio directive). This feature is mainly used
|
339
|
+
# for debugging various kinds of loops which might otherwise cripple the system
|
340
|
+
# and impair debugging them.
|
341
|
+
#
|
342
|
+
# realtime on|off
|
343
|
+
#
|
344
|
+
# The default is on.
|
345
|
+
#
|
346
|
+
attr_accessor :realtime
|
347
|
+
|
348
|
+
#
|
349
|
+
# The rtprio directive is used to specify the priority at which Heartbeat
|
350
|
+
# runs. It does not need to be specified unless other realtime priority programs
|
351
|
+
# are also running on the system. The minimum and maximum values for this field
|
352
|
+
# can be determined from the sched_get_priority_min(SCHED_FIFO) and
|
353
|
+
# sched_get_priority_max(SCHED_FIFO) calls respectively. The default value for
|
354
|
+
# rtprio is halfway between the minimum and maximum values.
|
355
|
+
#
|
356
|
+
# A sample rtprio directive is shown below:
|
357
|
+
#
|
358
|
+
# rtprio 5
|
359
|
+
#
|
360
|
+
attr_accessor :rtprio
|
361
|
+
|
362
|
+
#
|
363
|
+
# The ucast directive configures Heartbeat to communicate over a UDP unicast
|
364
|
+
# communications link. The udpport directive is used to configure which port is
|
365
|
+
# used for these unicast communications if the udpport directive is specified
|
366
|
+
# before the ucast directive, otherwise the default port will be used.
|
367
|
+
#
|
368
|
+
# The general syntax of a ucast directive is:
|
369
|
+
#
|
370
|
+
# ucast dev peer-ip-address
|
371
|
+
#
|
372
|
+
# Where dev is the device to use when talking to the peer, and peer-ip-address
|
373
|
+
# is the IP address we will send packets to.
|
374
|
+
#
|
375
|
+
# A sample ucast directive is shown below:
|
376
|
+
#
|
377
|
+
# ucast eth0 10.10.10.133
|
378
|
+
#
|
379
|
+
# This directive will cause us to send packets to 10.10.10.133 over interface
|
380
|
+
# eth0.
|
381
|
+
#
|
382
|
+
# Note that ucast directives which go to the local machine are effectively
|
383
|
+
# ignored. This allows the ha.cf directives on all machines to be identical.
|
384
|
+
#
|
385
|
+
attr_accessor :ucast
|
386
|
+
|
387
|
+
#
|
388
|
+
# In the normal case, heartbeat generates a UUID for each node in the system
|
389
|
+
# as a way of uniquely identifying a node - even if it should change nodenames.
|
390
|
+
# This UUID is typically stored in the file /var/lib/heartbeat/hb_uuid.
|
391
|
+
#
|
392
|
+
# For certain kinds of installations (those booting from CDs or other
|
393
|
+
# read-only media), it is impossible for heartbeat to save a generated to disk as
|
394
|
+
# it normally does. In these cases, one can use the uuidfrom directive to instruct
|
395
|
+
# heartbeat to use the nodename as though it were a UUID, by specifying uuidfrom
|
396
|
+
# nodename.
|
397
|
+
#
|
398
|
+
# All possible legal uuidfrom directives are shown below.
|
399
|
+
#
|
400
|
+
# uuidfrom file
|
401
|
+
# uuidfrom nodename
|
402
|
+
#
|
403
|
+
attr_accessor :uuidfrom
|
404
|
+
|
405
|
+
#
|
406
|
+
# The warntime directive is used to specify how quickly Heartbeat should issue
|
407
|
+
# a "late heartbeat" warning.
|
408
|
+
#
|
409
|
+
# The warntime value is specified according to the HeartbeatTimeSyntax. A
|
410
|
+
# sample warntime specification is shown below.
|
411
|
+
#
|
412
|
+
# warntime 10 # 10 seconds
|
413
|
+
#
|
414
|
+
# The warntime directive is important for tuning deadtime
|
415
|
+
#
|
416
|
+
attr_accessor :warntime
|
417
|
+
|
418
|
+
#
|
419
|
+
# In legacy Heartbeat clusters, the auto_failback option would determine
|
420
|
+
# whether a resource would automatically fail back to its "primary" node, or
|
421
|
+
# remain on whatever node is serving it until that node fails, or an administrator
|
422
|
+
# intervenes. The possible values for auto_failback were:
|
423
|
+
#
|
424
|
+
# * on - enable automatic failbacks
|
425
|
+
# * off - disable automatic failback
|
426
|
+
# * legacy - enable automatic failbacks in systems where all nodes in
|
427
|
+
# the cluster do not yet support the auto_failback option.
|
428
|
+
#
|
429
|
+
attr_accessor :auto_failback
|
430
|
+
|
431
|
+
#
|
432
|
+
# The baud directive is used to set the speed for serial communications.
|
433
|
+
# Any of the following speeds can be specified, provided they are supported by
|
434
|
+
# your operating system: 9600, 19200, 38400, 57600, 115200, 230400, 460800. The
|
435
|
+
# default speed is 19200.
|
436
|
+
#
|
437
|
+
attr_accessor :baud
|
438
|
+
|
439
|
+
#
|
440
|
+
# The deadping directive is used to specify how quickly Heartbeat should decide
|
441
|
+
# that a ping node in a cluster is dead. Setting this value too low will cause the
|
442
|
+
# system to falsely declare the ping node dead. Setting it too high will delay
|
443
|
+
# detection of communication failure.
|
444
|
+
#
|
445
|
+
attr_accessor :deadping
|
446
|
+
|
447
|
+
#
|
448
|
+
#
|
449
|
+
# The debugfile directive specifies the file Heartbeat will write debug messages to.
|
450
|
+
#
|
451
|
+
# This directive is ignored when use_logd is specified. Enabling use_logd is
|
452
|
+
# the recommended approach.
|
453
|
+
#
|
454
|
+
attr_accessor :debugfile
|
455
|
+
|
456
|
+
#
|
457
|
+
# Hbaping directives are given to declare fiber channel devices as ping nodes.
|
458
|
+
#
|
459
|
+
attr_accessor :hbaping
|
460
|
+
|
461
|
+
#
|
462
|
+
# The hopfudge directive controls how many nodes a packet can be forwarded
|
463
|
+
# through before it is thrown away in the worst case. However, the hopfudge value
|
464
|
+
# is added to the number of nodes in the system. It defaults to 1.
|
465
|
+
#
|
466
|
+
attr_accessor :hopfudge
|
467
|
+
|
468
|
+
#
|
469
|
+
# The logfile directive configures a log file. All non-debug messages from
|
470
|
+
# Heartbeat will go into this file.
|
471
|
+
#
|
472
|
+
# This directive is ignored when use_logd is specified. Enabling use_logd
|
473
|
+
# is the recommended approach.
|
474
|
+
#
|
475
|
+
attr_accessor :logfile
|
476
|
+
|
477
|
+
#
|
478
|
+
# Ping directives are given to declare ping nodes to Heartbeat. The syntax
|
479
|
+
# of the ping directive is simple:
|
480
|
+
#
|
481
|
+
# ping ip-address ...
|
482
|
+
#
|
483
|
+
# Each IP address listed in a ping directive is considered to be independent.
|
484
|
+
# That is, connectivity to each node is considered to be equally important.
|
485
|
+
#
|
486
|
+
# In order to declare that a group of nodes are equally qualified for a particular
|
487
|
+
# function, and that the presence of any of them indicates successful communication,
|
488
|
+
# use the ping_group directive.
|
489
|
+
#
|
490
|
+
attr_accessor :ping
|
491
|
+
|
492
|
+
#
|
493
|
+
# Ping group directives are given to declare a group ping node to Heartbeat.
|
494
|
+
# syntax of the ping_group directive is as follows:
|
495
|
+
#
|
496
|
+
# ping_group group-name ip-address ...
|
497
|
+
#
|
498
|
+
# Each IP address listed in a ping_group directive is considered to be related,
|
499
|
+
# and connectivity to any one node is considered to be connectivity to the group.
|
500
|
+
#
|
501
|
+
# A ping group is considered by Heartbeat to be a single cluster node (group-name).
|
502
|
+
# The ability to communicate with any of the group members means that the group-name member
|
503
|
+
# is reachable. This is useful when (for example) two different routers may be used to contact
|
504
|
+
# the internet, depending on which is up, or when finding an appropriate reliable single ping
|
505
|
+
# node is difficult.
|
506
|
+
#
|
507
|
+
attr_accessor :ping_group
|
508
|
+
|
509
|
+
#
|
510
|
+
# The respawn directive is used to specify a program to run and monitor while it runs.
|
511
|
+
# If this program exits with anything other than exit code 100, it will be automatically
|
512
|
+
# restarted. The first parameter is the user id to run the program under, and the second
|
513
|
+
# parameter is the program to run. Subsequent parameters will be given to the
|
514
|
+
# program as arguments.
|
515
|
+
#
|
516
|
+
attr_accessor :respawn
|
517
|
+
|
518
|
+
#
|
519
|
+
# The serial directive tells Heartbeat to use the specified serial port(s) for its
|
520
|
+
# communication. The parameters to the serial directive are the names of tty devices
|
521
|
+
# suitable for opening without waiting for carrier first. On Linux, those ports are
|
522
|
+
# typically named /dev/ttySX.
|
523
|
+
#
|
524
|
+
# A few sample serial directives are shown below:
|
525
|
+
#
|
526
|
+
# serial /dev/ttyS0 /dev/ttyS1 # Linux
|
527
|
+
# serial /dev/cuaa0 # FreeBSD
|
528
|
+
# serial /dev/cua/a # Solaris
|
529
|
+
#
|
530
|
+
# The baud directive is used to configure the baud rate for the port(s) if the baud
|
531
|
+
# directive is specified before the serial directive, otherwise the default baud rate
|
532
|
+
# will be used.
|
533
|
+
#
|
534
|
+
attr_accessor :serial
|
535
|
+
|
536
|
+
#
|
537
|
+
# The stonith directive is used to configure Heartbeat's legacy STONITH configuration.
|
538
|
+
# It assumes you're going to put in a STONITH configuration file on each machine in the
|
539
|
+
# cluster to configure the (single) STONITH device that this node will use to reset the
|
540
|
+
# other node in the cluster.
|
541
|
+
#
|
542
|
+
attr_accessor :stonith
|
543
|
+
|
544
|
+
#
|
545
|
+
# The stonith_host directive is used to configure Heartbeat's (release 1 only),
|
546
|
+
# STONITH configuration. With this directive, you put all the STONITH configuration
|
547
|
+
# information for the devices in your cluster in the ha.cf file, rather than in
|
548
|
+
# a separate file.
|
549
|
+
#
|
550
|
+
attr_accessor :stonith_host
|
551
|
+
|
552
|
+
#
|
553
|
+
# This directive enables traditional compression. It is highly recommended that this
|
554
|
+
# be set to off (the default); otherwise heartbeat performance can be significantly
|
555
|
+
# negatively impacted.
|
556
|
+
#
|
557
|
+
attr_accessor :traditional_compression
|
558
|
+
|
559
|
+
#
|
560
|
+
# The watchdog directive configures Heartbeat to use a watchdog device. In some
|
561
|
+
# circumstances, a watchdog device can be used in place of a STONITH device. In any case,
|
562
|
+
# it is a reasonable thing to configure if you don't have a STONITH device, or if you
|
563
|
+
# wish, in addition to your STONITH device.
|
564
|
+
#
|
565
|
+
# It is the purpose of a watchdog device to shut the machine down if Heartbeat
|
566
|
+
# does not hear its own heartbeats as often as it thinks it should. This keeps things
|
567
|
+
# like scheduler bugs from becoming split-brain configurations.
|
568
|
+
#
|
569
|
+
# The general syntax of a watchdog directive is:
|
570
|
+
#
|
571
|
+
# watchdog watchdog-device-name
|
572
|
+
#
|
573
|
+
# A sample watchdog directive is shown below:
|
574
|
+
#
|
575
|
+
# watchdog /dev/watchdog
|
576
|
+
#
|
577
|
+
# The most common watchdog device currently used with general Linux systems is the
|
578
|
+
# softdog device. The softdog device is a software-based watchdog device and is usually
|
579
|
+
# referred to as /dev/watchdog - although like most UNIX devices, this is a convention
|
580
|
+
# not a rule.
|
581
|
+
attr_accessor :watchdog
|
582
|
+
|
583
|
+
#
|
584
|
+
# Returns a new RhaConfig Object
|
585
|
+
#
|
586
|
+
def initialize()
|
587
|
+
end
|
588
|
+
|
589
|
+
#
|
590
|
+
# Compile the RhaConfig configuration
|
591
|
+
#
|
592
|
+
def config
|
593
|
+
conf = option_string()
|
594
|
+
return conf
|
595
|
+
end
|
596
|
+
|
597
|
+
private
|
598
|
+
|
599
|
+
def option_string()
|
600
|
+
ostring = ""
|
601
|
+
|
602
|
+
if @use_logd
|
603
|
+
ostring += "use_logd " + @use_logd.to_s + " " + "\n"
|
604
|
+
end
|
605
|
+
|
606
|
+
if @udpport
|
607
|
+
ostring += "udpport " + @udpport.to_s + " " + "\n"
|
608
|
+
end
|
609
|
+
|
610
|
+
if @apiauth
|
611
|
+
ostring += "apiauth " + @apiauth.to_s + " " + "\n"
|
612
|
+
end
|
613
|
+
|
614
|
+
if @autojoin
|
615
|
+
ostring += "autojoin " + @autojoin.to_s + " " + "\n"
|
616
|
+
end
|
617
|
+
|
618
|
+
if @bcast
|
619
|
+
ostring += "bcast " + @bcast.to_s + " " + "\n"
|
620
|
+
end
|
621
|
+
|
622
|
+
if @compression
|
623
|
+
ostring += "compression " + @compression.to_s + " " + "\n"
|
624
|
+
end
|
625
|
+
|
626
|
+
if @compression_threshold
|
627
|
+
ostring += "compression_threshold " + @compression_threshold.to_s + " " + "\n"
|
628
|
+
end
|
629
|
+
|
630
|
+
if @conn_logd_time
|
631
|
+
ostring += "conn_logd_time " + @conn_logd_time.to_s + " " + "\n"
|
632
|
+
end
|
633
|
+
|
634
|
+
if @coredumps
|
635
|
+
ostring += "coredumps " + @coredumps.to_s + " " + "\n"
|
636
|
+
end
|
637
|
+
|
638
|
+
if @crm
|
639
|
+
ostring += "crm " + @crm.to_s + " " + "\n"
|
640
|
+
end
|
641
|
+
|
642
|
+
if @deadtime
|
643
|
+
ostring += "deadtime " + @deadtime.to_s + " " + "\n"
|
644
|
+
end
|
645
|
+
|
646
|
+
if @debug
|
647
|
+
ostring += "debug " + @debug.to_s + " " + "\n"
|
648
|
+
end
|
649
|
+
|
650
|
+
if @hbgenmethod
|
651
|
+
ostring += "hbgenmethod " + @hbgenmethod.to_s + " " + "\n"
|
652
|
+
end
|
653
|
+
|
654
|
+
if @initdead
|
655
|
+
ostring += "initdead " + @initdead.to_s + " " + "\n"
|
656
|
+
end
|
657
|
+
|
658
|
+
if @keepalive
|
659
|
+
ostring += "keepalive " + @keepalive.to_s + " " + "\n"
|
660
|
+
end
|
661
|
+
|
662
|
+
if @logfacility
|
663
|
+
ostring += "logfacility " + @logfacility.to_s + " " + "\n"
|
664
|
+
end
|
665
|
+
|
666
|
+
if @mcast
|
667
|
+
ostring += "mcast " + @mcast.to_s + " " + "\n"
|
668
|
+
end
|
669
|
+
|
670
|
+
if @msgfmt
|
671
|
+
ostring += "msgfmt " + @msgfmt.to_s + " " + "\n"
|
672
|
+
end
|
673
|
+
|
674
|
+
if @node
|
675
|
+
ostring += "node " + @node.to_s + " " + "\n"
|
676
|
+
end
|
677
|
+
|
678
|
+
if @realtime
|
679
|
+
ostring += "realtime " + @realtime.to_s + " " + "\n"
|
680
|
+
end
|
681
|
+
|
682
|
+
if @rtprio
|
683
|
+
ostring += "rtprio " + @rtprio.to_s + " " + "\n"
|
684
|
+
end
|
685
|
+
|
686
|
+
if @ucast
|
687
|
+
ostring += "ucast " + @ucast.to_s + " " + "\n"
|
688
|
+
end
|
689
|
+
|
690
|
+
if @uuidfrom
|
691
|
+
ostring += "uuidfrom " + @uuidfrom.to_s + " " + "\n"
|
692
|
+
end
|
693
|
+
|
694
|
+
if @warntime
|
695
|
+
ostring += "warntime " + @warntime.to_s + " " + "\n"
|
696
|
+
end
|
697
|
+
|
698
|
+
if @auto_failback
|
699
|
+
ostring += "auto_failback " + @auto_failback.to_s + " " + "\n"
|
700
|
+
end
|
701
|
+
|
702
|
+
if @baud
|
703
|
+
ostring += "baud " + @baud.to_s + " " + "\n"
|
704
|
+
end
|
705
|
+
|
706
|
+
if @deadping
|
707
|
+
ostring += "deadping " + @deadping.to_s + " " + "\n"
|
708
|
+
end
|
709
|
+
|
710
|
+
if @debugfile
|
711
|
+
ostring += "debugfile " + @debugfile.to_s + " " + "\n"
|
712
|
+
end
|
713
|
+
|
714
|
+
if @hbaping
|
715
|
+
ostring += "hbaping " + @hbaping.to_s + " " + "\n"
|
716
|
+
end
|
717
|
+
|
718
|
+
if @hopfudge
|
719
|
+
ostring += "hopfudge " + @hopfudge.to_s + " " + "\n"
|
720
|
+
end
|
721
|
+
|
722
|
+
if @logfile
|
723
|
+
ostring += "logfile " + @logfile.to_s + " " + "\n"
|
724
|
+
end
|
725
|
+
|
726
|
+
if @ping
|
727
|
+
ostring += "ping " + @ping.to_s + " " + "\n"
|
728
|
+
end
|
729
|
+
|
730
|
+
if @ping_group
|
731
|
+
ostring += "ping_group " + @ping_group.to_s + " " + "\n"
|
732
|
+
end
|
733
|
+
|
734
|
+
if @respawn
|
735
|
+
ostring += "respawn " + @respawn.to_s + " " + "\n"
|
736
|
+
end
|
737
|
+
|
738
|
+
if @serial
|
739
|
+
ostring += "serial " + @serial.to_s + " " + "\n"
|
740
|
+
end
|
741
|
+
|
742
|
+
if @stonith
|
743
|
+
ostring += "stonith " + @stonith.to_s + " " + "\n"
|
744
|
+
end
|
745
|
+
|
746
|
+
if @stonith_host
|
747
|
+
ostring += "stonith_host " + @stonith_host.to_s + " " + "\n"
|
748
|
+
end
|
749
|
+
|
750
|
+
if @traditional_compression
|
751
|
+
ostring += "traditional_compression " + @traditional_compression.to_s + " " + "\n"
|
752
|
+
end
|
753
|
+
|
754
|
+
if @watchdog
|
755
|
+
ostring += "watchdog " + @watchdog.to_s + " " + "\n"
|
756
|
+
end
|
757
|
+
|
758
|
+
return ostring
|
759
|
+
|
760
|
+
end
|
761
|
+
end
|
762
|
+
|