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
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
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
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
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
72 echo "killing off node #2"
73 echo "==================="
74 CTDBPID
=`./bin/ctdb_control getpid 2 | sed -e "s/Pid://"`
81 echo "wait 3 seconds to let the recovery daemon do its job"
82 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 "================================================="
92 bin
/ctdb_control catdb test4.tdb
0
94 bin
/ctdb_control catdb test4.tdb
1
96 bin
/ctdb_control catdb test4.tdb
3
98 bin
/ctdb_control getnodemap
0
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