alternativeRole.sim 2.3 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

S
TD-1486  
Shengliang Guan 已提交
19 20 21 22 23
system sh/cfg.sh -n dnode1 -c maxTablesPerVnode -v 4
system sh/cfg.sh -n dnode2 -c maxTablesPerVnode -v 4
system sh/cfg.sh -n dnode3 -c maxTablesPerVnode -v 4


24
print ========== step1
S
Shengliang Guan 已提交
25
system sh/exec.sh -n dnode1 -s start
H
Haojun Liao 已提交
26
sleep 2000
27
sql connect
R
TD-1382  
root 已提交
28

29
sql create dnode $hostname2
S
Shengliang Guan 已提交
30
system sh/exec.sh -n dnode2 -s start
31
sql create dnode $hostname3
S
Shengliang Guan 已提交
32
system sh/exec.sh -n dnode3 -s start
H
Haojun Liao 已提交
33
sleep 3000
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

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
R
scripts  
root 已提交
65
sql create database d1 
66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89
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 已提交
90 91 92 93 94 95 96 97
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