Debian Codegraph @

cts/README

raw
1 BASIC REQUIREMENTS BEFORE STARTING:
2
3 Three machines: one test exerciser and two test cluster machines.
4
5 The two test cluster machines need to be on the same subnet
6 and they should have journalling filesystems for
7 all of their filesystems other than /boot
8 You also need two free IP addresses on that subnet to test
9 mutual IP address takeover
10
11 The test exerciser machine doesn't need to be on the same subnet
12 as the test cluster machines. Minimal demands are made on the
13 exerciser machine - it just has to stay up during the tests ;-).
14 However, it does need to have a current copy of the cts test
15 scripts. It is worth noting that these scripts are coordinated
16 with particular versions of linux-ha, so that in general you
17 have to have the same version of test scripts as the rest of
18 linux-ha.
19
20
21 Install heartbeat, heartbeat-pils, and heartbeat-stonith on all three
22 machines. Set up the configuration on the cluster machines *and make
23 a copy of it on the test exerciser machine*. These are the necessary
24 files:
25 /etc/ha.d/ha.cf
26 /etc/ha.d/haresources
27 /etc/ha.d/authkeys
28
29 NOTE: Do not run heartbeat on the test exerciser machine. After
30 installing all three packages, run the following to make sure that
31 heartbeat isn't automatically started every time the test exerciser
32 machine boots:
33 rm /etc/rc.d/rc3.d/*heartbeat
34 rm /etc/rc.d/rc5.d/*heartbeat
35
36 NOTE: Wherever machine names are mentioned in these configuration files,
37 they must match the machines' `uname -n` name. This may or may not match
38 the machines' FQDN (fully qualified domain name) - it depends on how
39 you (and your OS) have named the machines. It helps a lot in tracking
40 problems if the three machines' clocks are closely synchronized. xntpd
41 does this, but you can do it by hand if you want.
42
43 Make sure the 'at' daemon is enabled on the test cluster machines (this
44 is normally the 'atd' service started by /etc/init.d/atd). This doesn't
45 mean just start it, it means enable it to start on every boot into your
46 default init state (probably either 3 or 5). Enabling it for both state
47 3 and 5 is a good minimum. We don't need this in production - just for these
48 tests. This typically means you need a symlink for /etc/rc.d/rc3.d/S*atd
49 to /etc/init.d/atd, and one in /etc/rc.d/rc5.d/S*atd.
50
51 Make sure all your filesystems are journalling filesystems (/boot can be
52 ext2 if you want). This means filesystems like jfs, ext3, or reiserfs.
53
54 Here's what you need to do to run CTS:
55
56 Configure the two cluster machines with their logging of heartbeat
57 messages redirected via syslog to the exerciser machine. The exerciser
58 doesn't have to be the same OS as the others but it needs to be one that
59 supports a lot of the other things (like ssh and remote syslog logging).
60
61 You may want to configure the cluster machines to boot into run level 3,
62 that is without Xdm logins - particularly if they're behind a KVM switch.
63 Some distros refuse to boot correctly without knowing what kind of mouse
64 is present, and the kvm switch will likely make it impossible to figure
65 out without manual intervention. And since some of the tests cause the
66 machine to reboot without manual intervention this would be a problem.
67
68 Configure syslog on the cluster machines accordingly.
69 (see the Mini-MOWTOs at the end for more details)
70
71 The exerciser needs to be able to ssh over to the cluster nodes as root
72 without a password challenge. Configure ssh accordingly.
73 (see the Mini-HOWTOs at the end for more details)
74
75 The exerciser needs to have the IP addresses of the test machines available
76 to it - either by DNS or by /etc/hosts. It uses this to validate configuration
77 information.
78
79 The StonithdTest uses 'ssh' as its default plugin. To run this test, the cluster
80 nodes need to be able to ssh over to each other without a password challenge.
81 Configure ssh accordingly.
82 (see the Mini-HOWTOs at the end for more details)
83
84 The "heartbeat" service (init script) needs to be enabled to
85 automatically start in the default run level on the cluster machines.
86 This typically means you need a symlink for /etc/rc.d/rc3.d/S*heartbeat
87 to /etc/init.d/heartbeat, and one in /etc/rc.d/rc5.d/S*heartbeat.
88 If you don't do this, then things will look fine until you run the STONITH
89 test - and it will always fail...
90
91 The test software is called cts and is in the (surprise!) cts directory.
92 It's in the tarball, and (for later versions) is installed in
93 /usr/lib/heartbeat/cts.
94
95 The cts system consists of the following files:
96 CM_fs.py - ignore this - it's for failsafe
97 CM_hb.py - interacts with heartbeat
98 CTS.py - the core common code for testing
99 CTSaudits.py - performs audits at the end of each test
100 CTSlab.py - defines the "lab" (test) environment
101 CTStests.py - contains the definitions of the tests
102
103 You probably should look at the CTSlab.py file, but you should no longer
104 need to modify it.
105
106
107 OK. Now assuming you did all this and the stuff described below, what you
108 need to do is run CTSlab.py. If you run any other file, it won't test
109 your cluster ;-)
110
111 Depending on permissions, etc., this may be either done as:
112 ./CTSlab.py number-of-tests-to-run
113 or as
114 python ./CTSlab.py number-of-tests-to-run
115
116 The test output goes to standard error, so you'll probably want to catch stderr
117 with the usual 2>&1 construct like this:
118 ./CTSlab.py > outputfile 2>&1 &
119 followed by a
120 tail -f outputfile
121
122 Options for CTSlab:
123
124 --suppressmonitoring
125 Don't "monitor" resources as part of the audits
126
127 --directory dirname
128 Directory to find config info in. Defaults to
129 /etc/ha.d
130 --logfile
131 Directory to find logging information in defaults to
132 /var/log/ha-log-local7
133 --stonith (yes|no)
134 Enable/disable STONITH tests
135 --standby (yes|no)
136 Enable/disable standby tests
137 -v2
138 Test release 2.x (includes 1.99.x)
139 (see the Mini-HOWTOs at the end for more details)
140
141 ==============
142 Mini-HOWTOs:
143 ==============
144
145 --------------------------------------------------------------------------------
146 How to redirect linux-HA logging the way CTS wants it using syslog
147 --------------------------------------------------------------------------------
148
149 NOTE: There have been reports of messages being lost with vanilla syslog.
150 At least one of the developers recommends using syslog-ng or indeed
151 anything else to avoid these problems.
152
153 1) Redirect each machine to go (at least) to syslog local7:
154
155 Change /etc/ha.d/ha.cf on each test machine to say this:
156
157 logfacility local7
158
159 (you can also log to a dedicated local file with logfile if you want)
160
161 2) Change /etc/syslog.conf to redirect local7 on each of your cluster
162 machines to redirect to your exerciser machine by adding this line
163 somewhere near the top of /etc/syslog.conf
164
165 local7.* @exerciser-machine
166
167 3) Change syslog on the exerciser machine to accept remote
168 logging requests. You do this by making sure it gets invoked with
169 the "-r" option. On SuSE Linux you need to change /etc/rc.config
170 to put have this line for SYSLOGD_PARAMS:
171
172 SYSLOGD_PARAMS="-r"
173
174 If you're on a recent version of SuSE/UL, this parameter has
175 moved into /etc/sysconfig/syslog. You'll have to restart syslog
176 after putting these parameters into effect.
177
178 4) Change syslog on the exerciser machine to redirect messages
179 from local7 into /var/log/ha-log-local7 by adding this line to
180 /etc/syslog.conf
181
182 local7.* -/var/log/ha-log-local7
183
184 and then (on SuSE) run this command:
185
186 /etc/rc.d/syslog restart
187
188 Use the corresponding function for your distro.
189
190 --------------------------------------------------------------------------------
191 How to make OpenSSH allow you to login as root across the network without
192 a password.
193 --------------------------------------------------------------------------------
194
195 All our scripts run ssh -l root, so you don't have to do any of your testing
196 logged in as root on the test machine
197
198 1) Grab your key from the exerciser machine:
199
200 take the single line out of ~/.ssh/identity.pub
201 and put it into root's authorized_keys file.
202 [This has changed to: copying the line from ~/.ssh/id_dsa.pub into
203 root's authorized_keys file ]
204
205 NOTE: If you don't have an id_dsa.pub file, create it by running:
206
207 ssh-keygen -t dsa
208
209 2) Run this command on each of the cluster machines as root:
210
211 ssh -v -l myid ererciser-machine cat /home/myid/.ssh/identity.pub \
212 >> ~root/.ssh/authorized_keys
213
214 [For most people, this has changed to:
215 ssh -v -l myid exerciser-machine cat /home/myid/.ssh/id_dsa.pub \
216 >> ~root/.ssh/authorized_keys
217 ]
218
219 You will probably have to provide your password, and possibly say
220 "yes" to some questions about accepting the identity of the
221 test machines
222
223 3) You must also do the corresponding update for the exerciser
224 machine itself as root:
225
226 cat /home/myid/.ssh/identity.pub >> ~root/.ssh/authorized_keys
227
228 To test this, try this command from the exerciser machine for each
229 of your cluster machines, and for the exerciser machine itself.
230
231 ssh -l root cluster-machine
232
233 If this works without prompting for a password, you're in business...
234 If not, you need to look at the ssh/openssh documentation and the output from
235 the -v options above...
236
237 --------------------------------------------------------------------------------
238 How to redirect linux-HA logging the way CTS wants it using syslog-ng
239 --------------------------------------------------------------------------------
240
241 why syslog-ng:
242 Syslog-ng can use tcp and guarantee availability of logs. It is
243 important we get every log message or our test may fail with loss of some
244 important messages.
245
246 The following instructions apply to RedHat systems:
247
248 1) Redirect each machine to go (at least) to syslog local7:
249
250 Change /etc/ha.d/ha.cf on each test machine to say this:
251
252 logfacility local7
253
254
255 2) On all machines: download syslog-ng rpm and install it.
256 Or you can download its source at
257 http://www.balabit.com/products/syslog_ng/
258 and compile and install it.
259
260
261 3) On all machines: stop syslog and disable it on reboot (SEE NOTE BELOW
262 FIRST)
263
264 /etc/init.d/syslog stop
265 chkconfig --level 2345 syslog off
266
267
268 4) On exerciser machine, add the source and destination for remote log in
269 the file /etc/syslog-ng/syslog-ng.conf. You can change the port number
270 to other number, but it must be the same with the port number in cluster
271 machines (see 5)
272
273 options { long_hostnames(off); sync(0); perm(0640); stats(3600); time_reap(300); };
274 source s_tcp { tcp(port(15789) max-connections(512)); };
275 destination d_ha { file("/var/log/ha-log-local7"); };
276 log { source(s_tcp); destination(d_ha); };
277
278
279 5) On cluster machines, send log out to a remote machine by adding the
280 following lines to /etc/syslog-ng/syslog-ng.conf after the definition
281 of f_boot. Note the port number must be the same with 4).
282 Change exerciser-machine to the exerciser machine's IP or name
283
284 source s_tcp { tcp(port(15789) max-connections(512)); };
285 filter f_ha { facility(local7); };
286 filter f_ha_tcp { facility(local7); };
287 destination ha_local { file("/var/log/cluster.log" perm(0644)); };
288 destination ha_tcp { tcp(exerciser-machine port(15789));};
289 log { source(src); filter(f_ha_tcp); destination(ha_tcp); };
290 log { source(src); source(s_tcp); filter(f_ha); destination(ha_local); };
291
292
293 6) Start syslog-ng and enable it upon reboot in all machines (SEE NOTE
294 BELOW FIRST)
295
296 /etc/init.d/syslog-ng start
297 chkconfig --level 2345 syslog-ng on
298
299 NOTE: Instead of disabling syslog and enabling syslog-ng, it is possible
300 with newer versions of syslog to simply tell it to use the syslog-ng
301 daemon instead of its own. If you prefer this method, then step 3
302 becomes:
303
304 /etc/init.d/syslog stop
305
306 and step 6 becomes:
307
308 echo SYSLOG_DAEMON="syslog-ng" >> /etc/sysconfig/syslog
309 echo SYSLOG_NG_CREATE_CONFIG="no" >> /etc/sysconfig/syslog
310 /etc/init.d/syslog start
311
312 --------------------------------------------------------------------------------
313 How to redirect linux-HA logging CTS wants with evlog
314 --------------------------------------------------------------------------------
315
316 Related background introduction
317
318 evlog is a new logging system. It's open source, and its source/binary is
319 licensed under GPL/LGPL. its web site is as below.
320 http://evlog.sourceforge.net/
321
322 evlog is compliance with draft POSIX Standard 1003.25. It can provide more
323 advanced logging capacities (please refer to its web site for more details).
324 Among its several important features, when comparing with syslog, the remote
325 logging with tcp protocol is preferred here.
326
327 Why? Because when testing linux-ha as described above, you may have to need
328 remote logging support. Of course you can use syslog to get it via suitable
329 setting as the steps described above. But, syslog itself only supports remote
330 logging with udp protocol. As you know, sometimes udp protocol is not reliable
331 enough, especially under heavy workload, may lose some udp packages, cause
332 cts' log to become mess and difficult to analyze. Evlog is a good way to
333 resolve this issue.
334
335 Briefly, we can locally forward syslog message to evlog, then continue
336 forwarding the log message to remote machine with evlog's tcp remote logging
337 capacity. This don't require to rewrite related applications, such as heartbeat.
338 It's a big advantage for us. Since by default evlog isn't configured to
339 support tcp remote logging, so need to configure it. The following is the brief
340 steps. Some of them are abstracted from evlog documents.
341
342 1) Get the evlog, build binary if needed.
343 -----------------------------------------
344
345 You can download evlog binary or source from evlog project page:
346 http://sourceforge.net/projects/evlog
347 Some linux distributions, such as SLES, include evlog, but normally it
348 doesn't contain remote tcp logging module named as tcp_rmtlog_be. So you may
349 need to get additional package from there.
350
351 If luck you can get the suitable binary packages for your system from there.
352 As for rpm package, you need two packages as below.
353 evlog -- Standard package, including most functions
354 tcp_rmtlog_be -- Module to support remote tcp logging
355
356 If you have to build binary for yourself, the simple steps is as below.
357 Here suppose you begin from evlog-1.5.3 tarball.
358 a. Log in as root
359 b. Download evlog-1.5.3.tar.gz
360 c. Untar the tarball
361 tar -xzvf evlog-1.5.3.tar.gz
362 d. cd to evlog-1.5.3
363 e. To run configuration scripts.
364 ./autogen.sh
365 ./configure
366 f. Build and install.
367 Normal way.
368 make
369 make install
370 make startall
371
372 Or
373 Build rpm do the following:
374 make rpm
375 make rpm-tcp
376 make rpm-udp
377 Then you can see the evlog and tcp_rmtlog_be in top build directory.
378 you can install them with rpm command.
379
380 When install is successful, you will see messages like these...
381 /etc/rc.d/init.d/evlog start
382 Starting enterprise event logger: [ OK ]
383 sleep 1
384 /etc/init.d/evlogrmt start
385 Starting remote event logger: [ OK ]
386 sleep 1
387 /etc/rc.d/init.d/evlnotify start
388 Starting enterprise event log notification: [ OK ]
389 sleep 1
390 /etc/rc.d/init.d/evlaction start
391 Starting notification action daemon: [ OK ]
392
393 2) Configure remote event consolidator, which normally run CTS test scripts.
394 ----------------------------------------------------------------------------
395
396 This procedure configures the evlogrmtd daemon to accept events from other two
397 hosts running heartbeat testing hosts on the network. So that events from
398 multiple hosts can be consolidated into a single log file.
399
400 a. Log in as root
401 b. Edit /etc/evlog.d/evlhosts to add an entry for each of two testing host that
402 run heartbeat. Each entry must specify host name, either simple name or
403 fqdn, and also a unique identifier for each host. This identifier can be up
404 to 2 bytes, but cannot be equal to 0 (it will be ignored).
405
406 For example, the following are all valid entries:
407
408 (identifier) (hostname)
409 1 hatest1
410 2 hatest2
411
412 c. There is also a configuration file, /etc/evlog.d/evlogrmtd.conf which
413 contains the following as default:
414
415 Password=password
416 TCPPort=12000
417
418 "Password" is used only by TCP clients to authenticate remote hosts when
419 attempting to connect.
420
421 "TCPPort" must match the TCP port used by other two test machines for
422 sending events to the event consolidator.
423
424 d. Restart the evlogrmtd daemon...
425
426 /etc/init.d/evlogrmt restart
427
428 If evlogrmtd cannot resolve any of the hosts listed in evlhosts, or there
429 are no entries in /etc/evlog.d/evlhosts, then the evlogmrtd will exit.
430
431 3) Configure the two test machine on which heartbeat will run.
432 -------------------------------------------------------------
433
434 This procedure installs and configures an event tcp logging plugin for
435 forwarding events to a remote event consolidator.
436
437 The local logging software must be installed.
438
439 a. Log in as root.
440
441 b. If have installed tcp_rmtlog_be, then skip to next step. Or execute the
442 following command (shown for i386 rpm):
443 rpm -i tcp_rmtlog_be-1.5.3-1.i386.rpm
444
445 c. cd to /etc/evlog.d/plugins, then edit tcp_rmtlog_be.conf.
446 you need to specify the following items.
447
448 IP address, or hostname - for the event consolidator.
449 Port number - should match the port number used by the event consolidator.
450 Disable=no - to send events using TCP
451 Password - must match password expected by the event consolidator when the
452 TCP connection is attempted.
453 BufferLenInKbytes - Specifies the size of the memory buffer for events being
454 transmitted via TCP. This reduces the chances of losing events during
455 temporary loss of connection. Default size=128. Recommended range = 32
456 to 1024.
457
458 A sample tcp_rmtlog_be.conf may like as below.
459
460 Remote Host=172.30.1.180
461 Password=password
462 Port=12000
463 BufferLenInKbytes=128
464 Disable=no
465
466 d. Restart the evlogd daemon to load the plugin...
467 /etc/init.d/evlog restart
468
469 4) Configure syslog on the pair of HA machines.
470 -----------------------------------------------
471
472 For forwarding syslog messages to the evlog on the same machine. Issue this
473 command, which is from evlog package.
474 /sbin/slog_fwd
475
476 This will forward syslog messages immediately, and after every subsequent
477 reboot. To disable syslog forwarding:
478 /sbin/slog_fwd -r
479
480 5) Test your configure work.
481 ----------------------------
482
483 For example, on you one of the pair of HA machines, issue this command:
484 logger -p local7.info "logging hello from hatest1"
485
486 Then go to remote event consolidator, which run CTS test scripts. issue this
487 command, which is from evlog package.
488 evlview -m | grep hatest1
489 you should see its result.
490 Apr 7 13:32:04 hadev1 logging hello from hatest1
491
492 Notes, by default event log message of evlog is store in file
493 /var/evlog/eventlog
494 It's a file containing binary structure messages, so you should use evlview
495 to read them.
496
497 Enjoy evlog ;). The end.
498
499 --------------------------------------------------------------------------------
500 How to configure release 2.x (including 1.99.x) for cts testing
501 --------------------------------------------------------------------------------
502 To test release 2.x (including 1.99.x) you need to do the following additional
503 work.
504
505 1. Please build the source code with --enable-crm option and install it.
506
507 2. Configure ha.cf, and make it same on the test exerciser and all test
508 cluster machines. Please add the following lines to ha.cf:
509 auto_failback legacy
510 crm yes
511 Also, if the following line is in ha.cf, please remove it as it does not
512 apply to 2.x:
513 respawn hacluster /usr/lib/heartbeat/ipfail
514
515 3. Remove all lines from haresources and save it as an empty file until
516 bug 613 (http://www.osdl.org/developer_bugzilla/show_bug.cgi?id=613) is
517 resolved.
518
519 4. Now we can start cts test on the exerciser node:
520 ./CTSlab.py -v2 number-of-tests-to-run
521 or as
522 python ./CTSlab.py -v2 number-of-tests-to-run
523
524 5. To automatically generate and install a sample CIB:
525 add the -r and -c options to the above command
526
527 --------------------------------------------------------------------------------
528 How to configure OpenSSH for StonithdTest
529 --------------------------------------------------------------------------------
530
531 This configure enables cluster machines to ssh over to each other without a
532 password challenge.
533
534 1) On each of the cluster machines, grab your key:
535
536 take the single line out of ~/.ssh/identity.pub
537 and put it into root's authorized_keys file.
538 [This has changed to: copying the line from ~/.ssh/id_dsa.pub into
539 root's authorized_keys file ]
540
541 NOTE: If you don't have an id_dsa.pub file, create it by running:
542
543 ssh-keygen -t dsa
544
545 2) Run this command on each of the cluster machines as root:
546
547 ssh -v -l myid cluster_machine_1 cat /home/myid/.ssh/identity.pub \
548 >> ~root/.ssh/authorized_keys
549
550 ssh -v -l myid cluster_machine_2 cat /home/myid/.ssh/identity.pub \
551 >> ~root/.ssh/authorized_keys
552
553 ......
554
555 ssh -v -l myid cluster_machine_n cat /home/myid/.ssh/identity.pub \
556 >> ~root/.ssh/authorized_keys
557
558 [For most people, this has changed to:
559 ssh -v -l myid cluster_machine cat /home/myid/.ssh/id_dsa.pub \
560 >> ~root/.ssh/authorized_keys
561 ]
562
563 You will probably have to provide your password, and possibly say
564 "yes" to some questions about accepting the identity of the
565 test machines
566
567 To test this, try this command from any machine for each
568 of other cluster machines, and for the machine itself.
569
570 ssh -l root cluster-machine
571
572 This should work without prompting for a password,
573 If not, you need to look at the ssh/openssh documentation and the output from
574 the -v options above...
575
576 ----------------------------------------------------------------------------------
577 How to set up host based authentication
578 ----------------------------------------------------------------------------------
579 Client Machine
580 1) set
581 HostbasedAuthentication yes
582 in /etc/ssh/ssh_config
583
584 Server Machine
585 1) in server, in /etc/ssh/sshd_config, set
586 HostbasedAuthentication yes
587 IgnoreUserKnownHosts yes
588 and restart sshd
589
590 2) put client's machine name to /etc/ssh/shosts.equiv (assume the client is posic021)
591 posic021
592 posic021.domain.name
593
594 3) put the client machine's host key to /etc/ssh/ssh_known_hosts,
595 add the client machine's name/full domain name/ip before that, e.g
596 posic021,posic021.domain.name,141.142.xxx.xxx, ssh-rsa .....
597
598 4) For HostBasedAuthentication to work with root, In the server machine,
599 you need have the file /root/.shosts
600 posic021.domain.name root
601 You also need to set
602 IgnoreRhosts no
603 in /etc/ssh/sshd_config and then restart sshd.
604
605
606
607
608
609