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 = $data3_1
$dnode2Role = $data3_2
$dnode3Role = $data3_3
S
slguan 已提交
19 20 21
print dnode1 ==> $dnode1Role
print dnode2 ==> $dnode2Role
print dnode3 ==> $dnode3Role
S
slguan 已提交
22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40

if $dnode1Role != master then
  return -1
endi
if $dnode2Role != null then
  return -1
endi
if $dnode3Role != null then
  return -1
endi

print ============== step2
sql create dnode 192.168.0.2 
sleep 1700
sql create dnode 192.168.0.3

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 = $data3_1
$dnode2Role = $data3_2
$dnode3Role = $data3_3
S
slguan 已提交
64 65 66
print dnode1 ==> $dnode1Role
print dnode2 ==> $dnode2Role
print dnode3 ==> $dnode3Role
S
slguan 已提交
67 68 69 70 71 72 73 74 75 76

if $dnode1Role != master then
  return -1
endi
if $rows != 2 then
  return -1
endi
if $dnode3Role != null then
  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