4 killall -q ctdb_recoverd
6 echo "Starting 4 ctdb daemons"
7 bin/ctdbd --recovery-daemon --nlist direct/4nodes.txt
8 bin/ctdbd --recovery-daemon --nlist direct/4nodes.txt --listen=127.0.0.2:9001 --socket=/tmp/ctdb.socket.127.0.0.2
9 bin/ctdbd --recovery-daemon --nlist direct/4nodes.txt --listen=127.0.0.3:9001 --socket=/tmp/ctdb.socket.127.0.0.3
10 bin/ctdbd --recovery-daemon --nlist direct/4nodes.txt --listen=127.0.0.4:9001 --socket=/tmp/ctdb.socket.127.0.0.4
13 echo "Attaching to some databases"
14 bin/ctdb_control attach test1.tdb || exit 1
15 bin/ctdb_control attach test2.tdb || exit 1
16 bin/ctdb_control attach test3.tdb || exit 1
17 bin/ctdb_control attach test4.tdb || exit 1
19 echo "Clearing all databases to make sure they are all empty"
20 bin/ctdb_control getdbmap 0 | egrep "^dbid:" | sed -e "s/^dbid://" -e "s/ .*$//" | while read DB; do
21 seq 0 3 | while read NODE; do
22 bin/ctdb_control cleardb $NODE $DB
29 echo "Printing all databases on all nodes. they should all be empty"
30 echo "============================================================="
31 bin/ctdb_control getdbmap 0 | egrep "^dbid:" | sed -e "s/^.*name://" -e "s/ .*$//" | while read DBNAME; do
32 seq 0 3 | while read NODE; do
33 echo "Content of DBNAME:$DBNAME NODE:$NODE :"
34 bin/ctdb_control catdb $DBNAME $NODE
40 echo "Populating the databases"
41 ./bin/ctdb_control writerecord 0 0x220c2a7b testkey1 testdata1
42 ./bin/ctdb_control setdmaster 0 0x220c2a7b 1
44 ./bin/ctdb_control writerecord 1 0x220c2a7b testkey1 testdata1
45 ./bin/ctdb_control writerecord 1 0x220c2a7b testkey1 testdata1
46 ./bin/ctdb_control setdmaster 1 0x220c2a7b 2
48 ./bin/ctdb_control writerecord 2 0x220c2a7b testkey1 testdata1
49 ./bin/ctdb_control writerecord 2 0x220c2a7b testkey1 testdata1
50 ./bin/ctdb_control writerecord 2 0x220c2a7b testkey1 testdata1
51 ./bin/ctdb_control setdmaster 2 0x220c2a7b 3
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 writerecord 3 0x220c2a7b testkey1 testdata1
57 ./bin/ctdb_control setdmaster 3 0x220c2a7b 3
62 echo "Printing all databases on all nodes. there should be a record there"
63 echo "============================================================="
64 bin/ctdb_control getdbmap 0 | egrep "^dbid:" | sed -e "s/^.*name://" -e "s/ .*$//" | while read DBNAME; do
65 seq 0 3 | while read NODE; do
66 echo "Content of DBNAME:$DBNAME NODE:$NODE :"
67 bin/ctdb_control catdb $DBNAME $NODE
73 echo "killing off node #2"
74 echo "==================="
75 CTDBPID=`./bin/ctdb_control getpid 2 | sed -e "s/Pid://"`
82 echo "wait 3 seconds to let the recovery daemon do its job"
83 echo "===================================================="
88 echo "Printing all databases on all nodes."
89 echo "The databases should be the same now on all nodes"
90 echo "and the record will have been migrated to node 0"
91 echo "================================================="
93 bin/ctdb_control catdb test4.tdb 0
95 bin/ctdb_control catdb test4.tdb 1
97 bin/ctdb_control catdb test4.tdb 3
99 bin/ctdb_control getnodemap 0
103 echo "Traverse the cluster and dump the database"
104 bin/ctdb_control catdb test4.tdb
107 #leave the ctdb daemons running so one can look at the box in more detail