docs: mention --update and --encrypt in smbget manpage.
[Samba.git] / ctdb / tests / recover.sh
blobc626441786b050a47e59527c2db5702e2bb80873
1 #!/bin/sh
3 killall -q ctdbd
5 echo "Starting 4 ctdb daemons"
6 bin/ctdbd --recovery-daemon --nlist tests/4nodes.txt
7 bin/ctdbd --recovery-daemon --nlist tests/4nodes.txt --listen=127.0.0.2 --socket=/tmp/ctdb.socket.127.0.0.2
8 bin/ctdbd --recovery-daemon --nlist tests/4nodes.txt --listen=127.0.0.3 --socket=/tmp/ctdb.socket.127.0.0.3
9 bin/ctdbd --recovery-daemon --nlist tests/4nodes.txt --listen=127.0.0.4 --socket=/tmp/ctdb.socket.127.0.0.4
11 echo
12 echo "Attaching to some databases"
13 bin/ctdb_control attach test1.tdb || exit 1
14 bin/ctdb_control attach test2.tdb || exit 1
15 bin/ctdb_control attach test3.tdb || exit 1
16 bin/ctdb_control attach test4.tdb || exit 1
18 echo "Clearing all databases to make sure they are all empty"
19 bin/ctdb_control getdbmap 0 | egrep "^dbid:" | sed -e "s/^dbid://" -e "s/ .*$//" | while read DB; do
20 seq 0 3 | while read NODE; do
21 bin/ctdb_control cleardb $NODE $DB
22 done
23 done
26 echo
27 echo
28 echo "Printing all databases on all nodes. they should all be empty"
29 echo "============================================================="
30 bin/ctdb_control getdbmap 0 | egrep "^dbid:" | sed -e "s/^.*name://" -e "s/ .*$//" | while read DBNAME; do
31 seq 0 3 | while read NODE; do
32 echo "Content of DBNAME:$DBNAME NODE:$NODE :"
33 bin/ctdb_control catdb $DBNAME $NODE
34 done
35 done
37 echo
38 echo
39 echo "Populating the databases"
40 ./bin/ctdb_control writerecord 0 0x220c2a7b testkey1 testdata1
41 ./bin/ctdb_control setdmaster 0 0x220c2a7b 1
43 ./bin/ctdb_control writerecord 1 0x220c2a7b testkey1 testdata1
44 ./bin/ctdb_control writerecord 1 0x220c2a7b testkey1 testdata1
45 ./bin/ctdb_control setdmaster 1 0x220c2a7b 2
47 ./bin/ctdb_control writerecord 2 0x220c2a7b testkey1 testdata1
48 ./bin/ctdb_control writerecord 2 0x220c2a7b testkey1 testdata1
49 ./bin/ctdb_control writerecord 2 0x220c2a7b testkey1 testdata1
50 ./bin/ctdb_control setdmaster 2 0x220c2a7b 3
52 ./bin/ctdb_control writerecord 3 0x220c2a7b testkey1 testdata1
53 ./bin/ctdb_control writerecord 3 0x220c2a7b testkey1 testdata1
54 ./bin/ctdb_control writerecord 3 0x220c2a7b testkey1 testdata1
55 ./bin/ctdb_control writerecord 3 0x220c2a7b testkey1 testdata1
56 ./bin/ctdb_control setdmaster 3 0x220c2a7b 3
59 echo
60 echo
61 echo "Printing all databases on all nodes. there should be a record there"
62 echo "============================================================="
63 bin/ctdb_control getdbmap 0 | egrep "^dbid:" | sed -e "s/^.*name://" -e "s/ .*$//" | while read DBNAME; do
64 seq 0 3 | while read NODE; do
65 echo "Content of DBNAME:$DBNAME NODE:$NODE :"
66 bin/ctdb_control catdb $DBNAME $NODE
67 done
68 done
70 echo
71 echo
72 echo "killing off node #2"
73 echo "==================="
74 CTDBPID=`./bin/ctdb_control getpid 2 | sed -e "s/Pid://"`
75 kill $CTDBPID
76 sleep 1
79 echo
80 echo
81 echo "wait 3 seconds to let the recovery daemon do its job"
82 echo "===================================================="
83 sleep 3
85 echo
86 echo
87 echo "Printing all databases on all nodes."
88 echo "The databases should be the same now on all nodes"
89 echo "and the record will have been migrated to node 0"
90 echo "================================================="
91 echo "Node 0:"
92 bin/ctdb_control catdb test4.tdb 0
93 echo "Node 1:"
94 bin/ctdb_control catdb test4.tdb 1
95 echo "Node 3:"
96 bin/ctdb_control catdb test4.tdb 3
97 echo "nodemap:"
98 bin/ctdb_control getnodemap 0
100 echo
101 echo
102 echo "Traverse the cluster and dump the database"
103 bin/ctdb_control catdb test4.tdb
106 #leave the ctdb daemons running so one can look at the box in more detail
107 #killall -q ctdbd