mgmtr2.sim 1.7 KB
Newer Older
S
slguan 已提交
1
system sh/stop_dnodes.sh
S
slguan 已提交
2 3 4
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
slguan 已提交
5 6 7 8 9 10

system sh/cfg.sh -n dnode1 -c numOfMPeers -v 2
system sh/cfg.sh -n dnode2 -c numOfMPeers -v 2
system sh/cfg.sh -n dnode3 -c numOfMPeers -v 2

print ============== step1
S
slguan 已提交
11
system sh/exec_up.sh -n dnode1 -s start
S
slguan 已提交
12 13 14 15
sql connect
sleep 3000

sql show mnodes
S
slguan 已提交
16 17 18
$dnode1Role = $data2_1
$dnode2Role = $data2_2
$dnode3Role = $data2_3
S
slguan 已提交
19 20 21
print dnode1 ==> $dnode1Role
print dnode2 ==> $dnode2Role
print dnode3 ==> $dnode3Role
S
slguan 已提交
22 23 24 25

if $dnode1Role != master then
  return -1
endi
26
if $dnode2Role != NULL then
S
slguan 已提交
27 28
  return -1
endi
29
if $dnode3Role != NULL then
S
slguan 已提交
30 31 32 33
  return -1
endi

print ============== step2
S
slguan 已提交
34
sql create dnode $hostname2 
S
slguan 已提交
35
sleep 1700
S
slguan 已提交
36
sql create dnode $hostname3
S
slguan 已提交
37 38 39 40

print ============== step3
print ========= start dnode2 and dnode3

S
slguan 已提交
41
system sh/exec_up.sh -n dnode2 -s start
S
slguan 已提交
42
sleep 1000
S
slguan 已提交
43
system sh/exec_up.sh -n dnode3 -s start
S
slguan 已提交
44 45

sleep 8000
S
slguan 已提交
46 47
system sh/exec_up.sh -n dnode2 -s stop
system sh/exec_up.sh -n dnode3 -s stop
S
slguan 已提交
48
sleep 4000
S
slguan 已提交
49 50
system sh/exec_up.sh -n dnode2 -s start
system sh/exec_up.sh -n dnode3 -s start
S
slguan 已提交
51
sleep 4000
S
slguan 已提交
52 53
system sh/exec_up.sh -n dnode2 -s stop
system sh/exec_up.sh -n dnode3 -s stop
S
slguan 已提交
54
sleep 4000
S
slguan 已提交
55 56
system sh/exec_up.sh -n dnode2 -s start
system sh/exec_up.sh -n dnode3 -s start
S
slguan 已提交
57 58 59 60

print ============== step4
sql show mnodes

S
slguan 已提交
61 62 63
$dnode1Role = $data2_1
$dnode2Role = $data2_2
$dnode3Role = $data2_3
S
slguan 已提交
64 65 66
print dnode1 ==> $dnode1Role
print dnode2 ==> $dnode2Role
print dnode3 ==> $dnode3Role
S
slguan 已提交
67 68 69 70 71 72 73

if $dnode1Role != master then
  return -1
endi
if $rows != 2 then
  return -1
endi
74
if $dnode3Role != NULL then
S
slguan 已提交
75 76
  return -1
endi
S
slguan 已提交
77 78 79 80

system sh/exec_up.sh -n dnode1 -s stop
system sh/exec_up.sh -n dnode2 -s stop
system sh/exec_up.sh -n dnode3 -s stop