offline2.sim 2.4 KB
Newer Older
S
slguan 已提交
1 2
system sh/stop_dnodes.sh

S
slguan 已提交
3 4 5
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 已提交
6 7 8 9 10

system sh/cfg.sh -n dnode1 -c offlineThreshold -v 10
system sh/cfg.sh -n dnode2 -c offlineThreshold -v 10
system sh/cfg.sh -n dnode3 -c offlineThreshold -v 10

S
slguan 已提交
11 12 13 14
system sh/cfg.sh -n dnode1 -c balanceInterval -v 5
system sh/cfg.sh -n dnode2 -c balanceInterval -v 5
system sh/cfg.sh -n dnode3 -c balanceInterval -v 5

S
slguan 已提交
15 16 17 18 19 20 21 22 23
system sh/cfg.sh -n dnode1 -c mgmtEqualVnodeNum -v 4
system sh/cfg.sh -n dnode2 -c mgmtEqualVnodeNum -v 4
system sh/cfg.sh -n dnode3 -c mgmtEqualVnodeNum -v 4

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

print ========== step1
S
script  
slguan 已提交
24
system sh/exec_up.sh -n dnode1 -s start
S
slguan 已提交
25
sql connect
S
slguan 已提交
26
sql create dnode $hostname2
S
script  
slguan 已提交
27
system sh/exec_up.sh -n dnode2 -s start
S
slguan 已提交
28 29 30 31 32 33 34
sleep 3000

sql create database d1 replica 2 tables 4
sql create table d1.t1(ts timestamp, i int)
sql insert into d1.t1 values(now, 1)

sql show dnodes
S
slguan 已提交
35 36 37 38
print dnode1 $data4_1
print dnode1 $data4_2

if $data4_1 != ready then
S
slguan 已提交
39 40
  return -1
endi
S
slguan 已提交
41
if $data4_2 != ready then
S
slguan 已提交
42 43 44 45
  return -1
endi

print ========== step2
S
script  
slguan 已提交
46
system sh/exec_up.sh -n dnode2 -s stop -x SIGINT
S
slguan 已提交
47
sleep 8000
S
slguan 已提交
48 49

sql show dnodes
S
slguan 已提交
50 51 52 53
print dnode1 $data4_1
print dnode1 $data4_2

if $data4_1 != ready then
S
slguan 已提交
54 55
  return -1
endi
S
slguan 已提交
56
if $data4_2 != offline then
S
slguan 已提交
57 58 59 60
  return -1
endi

print ========== step3
S
slguan 已提交
61
sleep 10000
S
slguan 已提交
62 63

sql show dnodes
S
slguan 已提交
64 65 66 67
print dnode1 $data4_1
print dnode1 $data4_2

if $data4_1 != ready then
S
slguan 已提交
68 69
  return -1
endi
S
slguan 已提交
70
if $data4_2 != dropping then
S
slguan 已提交
71 72 73 74
  return -1
endi

print ========== step4
S
slguan 已提交
75
sql create dnode $hostname3
S
script  
slguan 已提交
76
system sh/exec_up.sh -n dnode3 -s start
S
slguan 已提交
77
system sh/exec_up.sh -n dnode2 -s start
S
slguan 已提交
78
sql drop dnode $hostname2
S
slguan 已提交
79 80 81 82 83 84

sleep 5000
$x = 0
show4: 
	$x = $x + 1
	sleep 5000
S
slguan 已提交
85
	if $x == 50 then 
S
slguan 已提交
86 87 88 89
	  return -1
	endi

sql show dnodes
S
slguan 已提交
90 91
if $data4_1 != ready then
  goto show4
S
slguan 已提交
92
endi
S
slguan 已提交
93 94
if $data4_2 != null then
  goto show4
S
slguan 已提交
95
endi
S
slguan 已提交
96 97
if $data4_3 != ready then
  goto show4
S
slguan 已提交
98 99 100
endi

print ======================== step5
S
slguan 已提交
101 102 103
sql reset query cache
sleep 1000

S
slguan 已提交
104 105 106 107 108
sql select * from d1.t1
if $rows != 1 then
  return -1
endi

S
scripts  
slguan 已提交
109 110 111 112 113 114 115 116
system sh/exec_up.sh -n dnode1 -s stop  -x SIGINT
system sh/exec_up.sh -n dnode2 -s stop  -x SIGINT
system sh/exec_up.sh -n dnode3 -s stop  -x SIGINT
system sh/exec_up.sh -n dnode4 -s stop  -x SIGINT
system sh/exec_up.sh -n dnode5 -s stop  -x SIGINT
system sh/exec_up.sh -n dnode6 -s stop  -x SIGINT
system sh/exec_up.sh -n dnode7 -s stop  -x SIGINT
system sh/exec_up.sh -n dnode8 -s stop  -x SIGINT