mgmtr2.sim 1.8 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
system sh/cfg.sh -n dnode1 -c numOfMnodes -v 2
system sh/cfg.sh -n dnode2 -c numOfMnodes -v 2
system sh/cfg.sh -n dnode3 -c numOfMnodes -v 2
S
slguan 已提交
9 10

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

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
S
scripts  
Shengliang Guan 已提交
26
if $dnode2Role != null then
S
slguan 已提交
27 28
  return -1
endi
S
scripts  
Shengliang Guan 已提交
29
if $dnode3Role != null then
S
slguan 已提交
30 31 32 33
  return -1
endi

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

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

S
Shengliang Guan 已提交
40
system sh/exec.sh -n dnode2 -s start
S
slguan 已提交
41
sleep 1000
S
Shengliang Guan 已提交
42
system sh/exec.sh -n dnode3 -s start
S
slguan 已提交
43 44

sleep 8000
S
Shengliang Guan 已提交
45 46
system sh/exec.sh -n dnode2 -s stop
system sh/exec.sh -n dnode3 -s stop
S
slguan 已提交
47
sleep 4000
S
Shengliang Guan 已提交
48 49
system sh/exec.sh -n dnode2 -s start
system sh/exec.sh -n dnode3 -s start
S
slguan 已提交
50
sleep 4000
S
Shengliang Guan 已提交
51 52
system sh/exec.sh -n dnode2 -s stop
system sh/exec.sh -n dnode3 -s stop
S
slguan 已提交
53
sleep 4000
S
Shengliang Guan 已提交
54 55
system sh/exec.sh -n dnode2 -s start
system sh/exec.sh -n dnode3 -s start
S
slguan 已提交
56 57

print ============== step4
S
Shengliang Guan 已提交
58 59 60 61 62 63 64 65
$x = 0
step4: 
	$x = $x + 1
	sleep 1000
	if $x == 20 then
		return -1
	endi

S
slguan 已提交
66 67
sql show mnodes

S
slguan 已提交
68 69 70
$dnode1Role = $data2_1
$dnode2Role = $data2_2
$dnode3Role = $data2_3
S
slguan 已提交
71 72 73
print dnode1 ==> $dnode1Role
print dnode2 ==> $dnode2Role
print dnode3 ==> $dnode3Role
S
slguan 已提交
74 75

if $dnode1Role != master then
S
Shengliang Guan 已提交
76
  goto step4
S
slguan 已提交
77
endi
S
scripts  
Shengliang Guan 已提交
78
if $dnode2Role != slave then
S
Shengliang Guan 已提交
79
  goto step4
S
slguan 已提交
80
endi
S
scripts  
Shengliang Guan 已提交
81
if $dnode3Role != null then
S
Shengliang Guan 已提交
82
  goto step4
S
slguan 已提交
83
endi
S
slguan 已提交
84

S
Shengliang Guan 已提交
85 86
system sh/exec.sh -n dnode1 -s stop  -x SIGINT
system sh/exec.sh -n dnode2 -s stop  -x SIGINT
S
Shengliang Guan 已提交
87
system sh/exec.sh -n dnode3 -s stop  -x SIGINT