alternativeRole.sim 2.1 KB
Newer Older
1 2 3 4 5 6
system sh/stop_dnodes.sh

system sh/deploy.sh -n dnode1 -i 1
system sh/deploy.sh -n dnode2 -i 2
system sh/deploy.sh -n dnode3 -i 3

S
Shengliang Guan 已提交
7 8 9
system sh/cfg.sh -n dnode1 -c role -v 1
system sh/cfg.sh -n dnode2 -c role -v 2
system sh/cfg.sh -n dnode3 -c role -v 0
10 11 12 13 14

system sh/cfg.sh -n dnode1 -c wallevel -v 1
system sh/cfg.sh -n dnode2 -c wallevel -v 1
system sh/cfg.sh -n dnode3 -c wallevel -v 1

15 16 17
system sh/cfg.sh -n dnode1 -c numOfMnodes -v 3
system sh/cfg.sh -n dnode2 -c numOfMnodes -v 3
system sh/cfg.sh -n dnode3 -c numOfMnodes -v 3
18 19

print ========== step1
S
Shengliang Guan 已提交
20
system sh/exec.sh -n dnode1 -s start
21 22
sql connect
sql create dnode $hostname2
S
Shengliang Guan 已提交
23
system sh/exec.sh -n dnode2 -s start
24 25
sleep 3000
sql create dnode $hostname3
S
Shengliang Guan 已提交
26
system sh/exec.sh -n dnode3 -s start
27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83
sleep 3000

sql show dnodes
print dnode1 $data5_1
print dnode1 $data5_2
print dnode1 $data5_3

if $data5_1 != mnode then
  return -1
endi
if $data5_2 != vnode then
  return -1
endi
if $data5_3 != any then
  return -1
endi

sql show mnodes
print dnode1 ==> $data2_1
print dnode2 ==> $data2_2
print dnode3 ==> $data2_3
if $data2_1 != master then
  return -1
endi
if $data2_2 != null then
  return -1
endi
if $data2_3 != slave then
  return -1
endi

print ========== step2
sql create database d1 maxTables 4
sql create table d1.t1 (ts timestamp, i int)
sql create table d1.t2 (ts timestamp, i int)
sql create table d1.t3 (ts timestamp, i int)
sql create table d1.t4 (ts timestamp, i int)
sql create table d1.t5 (ts timestamp, i int)
sql create table d1.t6 (ts timestamp, i int)
sql create table d1.t7 (ts timestamp, i int)
sql create table d1.t8 (ts timestamp, i int)

sql show dnodes
print dnode1 $data2_1
print dnode2 $data2_2
print dnode3 $data2_3

if $data2_1 != 0 then
  return -1
endi
if $data2_2 != 1 then
  return -1
endi
if $data2_3 != 1 then
  return -1
endi

S
Shengliang Guan 已提交
84 85 86 87 88 89 90 91
system sh/exec.sh -n dnode1 -s stop  -x SIGINT
system sh/exec.sh -n dnode2 -s stop  -x SIGINT
system sh/exec.sh -n dnode3 -s stop  -x SIGINT
system sh/exec.sh -n dnode4 -s stop  -x SIGINT
system sh/exec.sh -n dnode5 -s stop  -x SIGINT
system sh/exec.sh -n dnode6 -s stop  -x SIGINT
system sh/exec.sh -n dnode7 -s stop  -x SIGINT
system sh/exec.sh -n dnode8 -s stop  -x SIGINT