cluster_main.sim 10.1 KB
Newer Older
H
Hui Li 已提交
1 2 3 4 5
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
system sh/deploy.sh -n dnode4 -i 4
H
Hui Li 已提交
6
system sh/deploy.sh -n dnode5 -i 5
H
Hui Li 已提交
7 8 9 10 11

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
system sh/cfg.sh -n dnode4 -c numOfMnodes -v 3
H
Hui Li 已提交
12
system sh/cfg.sh -n dnode5 -c numOfMnodes -v 3
H
Hui Li 已提交
13 14 15 16 17

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
system sh/cfg.sh -n dnode4 -c walLevel -v 1
H
Hui Li 已提交
18
system sh/cfg.sh -n dnode5 -c walLevel -v 1
H
Hui Li 已提交
19 20 21 22 23

system sh/cfg.sh -n dnode1 -c balanceInterval -v 10
system sh/cfg.sh -n dnode2 -c balanceInterval -v 10
system sh/cfg.sh -n dnode3 -c balanceInterval -v 10
system sh/cfg.sh -n dnode4 -c balanceInterval -v 10
H
Hui Li 已提交
24
system sh/cfg.sh -n dnode5 -c balanceInterval -v 10
H
Hui Li 已提交
25

S
Shengliang Guan 已提交
26 27 28 29 30
system sh/cfg.sh -n dnode1 -c role -v 0
system sh/cfg.sh -n dnode2 -c role -v 0
system sh/cfg.sh -n dnode3 -c role -v 0
system sh/cfg.sh -n dnode4 -c role -v 0
system sh/cfg.sh -n dnode5 -c role -v 0
H
Hui Li 已提交
31

H
Hui Li 已提交
32 33 34 35 36
system sh/cfg.sh -n dnode1 -c maxtablesPerVnode -v 5000
system sh/cfg.sh -n dnode2 -c maxtablesPerVnode -v 5000
system sh/cfg.sh -n dnode3 -c maxtablesPerVnode -v 5000
system sh/cfg.sh -n dnode4 -c maxtablesPerVnode -v 5000
system sh/cfg.sh -n dnode5 -c maxtablesPerVnode -v 5000
H
Hui Li 已提交
37 38 39 40 41

system sh/cfg.sh -n dnode1 -c arbitrator -v $arbitrator
system sh/cfg.sh -n dnode2 -c arbitrator -v $arbitrator
system sh/cfg.sh -n dnode3 -c arbitrator -v $arbitrator
system sh/cfg.sh -n dnode4 -c arbitrator -v $arbitrator
H
Hui Li 已提交
42
system sh/cfg.sh -n dnode5 -c arbitrator -v $arbitrator
H
Hui Li 已提交
43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59

print ============== step0: start tarbitrator
system sh/exec_tarbitrator.sh -s start

print ============== step1: start dnode1/dnode2/dnode3
system sh/exec.sh -n dnode1 -s start
system sh/exec.sh -n dnode2 -s start
system sh/exec.sh -n dnode3 -s start
sleep 3000
sql connect
sql create dnode $hostname2
sql create dnode $hostname3
sleep 3000

print ============== step2: create db1 with replica 3
$db = db1
print create database $db replica 3
R
scripts  
root 已提交
60
#sql create database $db replica 3 
H
Hui Li 已提交
61 62 63 64 65
sql create database $db replica 3
sql use $db

print ============== step3: create stable stb1
$stb = stb1
H
Hui Li 已提交
66
sql create table $stb (ts timestamp, c1 int) tags(t1 int, t2 binary(8))
H
Hui Li 已提交
67

H
Hui Li 已提交
68
print ============== step4: start back client1_0.sim
H
Hui Li 已提交
69
run_back unique/cluster/client1_0.sim
H
Hui Li 已提交
70 71 72
#run_back unique/cluster/client1_1.sim
#run_back unique/cluster/client1_2.sim
#run_back unique/cluster/client1_3.sim
H
Hui Li 已提交
73 74 75 76 77 78
#run_back unique/cluster/client2_0.sim
#run_back unique/cluster/client2_1.sim
#run_back unique/cluster/client2_2.sim
#run_back unique/cluster/client2_3.sim
#run_back unique/cluster/client3.sim
#run_back unique/cluster/client4.sim
H
Hui Li 已提交
79 80

sleep 20000
H
Hui Li 已提交
81 82 83 84 85 86 87 88 89 90

wait_subsim_insert_complete_create_tables:
sql select count(tbname) from $stb
print select count(tbname) from $stb
print data00 $data00
if $data00 < 1000 then
  sleep 3000
  goto wait_subsim_insert_complete_create_tables
endi

H
Hui Li 已提交
91
wait_subsim_insert_data:
H
Hui Li 已提交
92
print select count(*) from $stb
H
Hui Li 已提交
93 94
sql select count(*) from $stb
print data00 $data00
H
Hui Li 已提交
95
if $data00 < 1000 then
H
Hui Li 已提交
96 97 98
  sleep 3000
  goto wait_subsim_insert_data
endi
H
Hui Li 已提交
99 100 101 102

print wait for a while to let clients start insert data
sleep 5000    

H
Hui Li 已提交
103 104 105 106
print ============== step4-1: add dnode4/dnode5 into cluster
sql create dnode $hostname4
sql create dnode $hostname5

H
Hui Li 已提交
107 108
$loop_cnt = 0
loop_cluster_do:
H
Hui Li 已提交
109
print **** **** **** START loop cluster do (loop_cnt: $loop_cnt )**** **** **** ****
H
Hui Li 已提交
110
print ============== step5: start dnode4/dnode5
H
Hui Li 已提交
111
system sh/exec.sh -n dnode4 -s start
H
Hui Li 已提交
112
system sh/exec.sh -n dnode5 -s start
H
Hui Li 已提交
113
sleep 20000
H
Hui Li 已提交
114

H
Hui Li 已提交
115
print ============== step6: stop dnode1
H
Hui Li 已提交
116
system sh/exec.sh -n dnode1 -s stop -x SIGINT
H
Hui Li 已提交
117 118 119
sleep 10000
#sql drop dnode $hostname1
#sleep 5000
H
Hui Li 已提交
120

H
Hui Li 已提交
121 122
#system rm -rf ../../../sim/dnode1/data
#sleep 20000
H
Hui Li 已提交
123

H
Hui Li 已提交
124
sql show mnodes
H
Hui Li 已提交
125 126
print show mnodes
print rows: $rows
H
Hui Li 已提交
127 128 129 130
print $data0_1  $data1_1  $data2_1  $data3_1  $data4_1
print $data0_2  $data1_2  $data2_2  $data3_2  $data4_2
print $data0_3  $data1_3  $data2_3  $data3_3  $data4_3
print $data0_4  $data1_4  $data2_4  $data3_4  $data4_4
H
Hui Li 已提交
131 132 133 134 135
print $data0_5  $data1_5  $data2_5  $data3_5  $data4_5
print $data0_6  $data1_6  $data2_6  $data3_6  $data4_6
print $data0_7  $data1_7  $data2_7  $data3_7  $data4_7
print $data0_8  $data1_8  $data2_8  $data3_8  $data4_8
print $data0_9  $data1_9  $data2_9  $data3_9  $data4_9
H
Hui Li 已提交
136

H
Hui Li 已提交
137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152
print ============== step6-1: restart dnode1
system sh/exec.sh -n dnode1 -s start
sleep 10000
sql show mnodes
print show mnodes
print rows: $rows
print $data0_1  $data1_1  $data2_1  $data3_1  $data4_1
print $data0_2  $data1_2  $data2_2  $data3_2  $data4_2
print $data0_3  $data1_3  $data2_3  $data3_3  $data4_3
print $data0_4  $data1_4  $data2_4  $data3_4  $data4_4
print $data0_5  $data1_5  $data2_5  $data3_5  $data4_5
print $data0_6  $data1_6  $data2_6  $data3_6  $data4_6
print $data0_7  $data1_7  $data2_7  $data3_7  $data4_7
print $data0_8  $data1_8  $data2_8  $data3_8  $data4_8
print $data0_9  $data1_9  $data2_9  $data3_9  $data4_9

H
Hui Li 已提交
153
print ============== step7: stop dnode2 
H
Hui Li 已提交
154
system sh/exec.sh -n dnode2 -s stop -x SIGINT
H
Hui Li 已提交
155
sleep 5000
H
Hui Li 已提交
156

H
Hui Li 已提交
157
sql show mnodes
H
Hui Li 已提交
158 159
print show mnodes
print rows: $rows
H
Hui Li 已提交
160 161 162 163
print $data0_1  $data1_1  $data2_1  $data3_1  $data4_1
print $data0_2  $data1_2  $data2_2  $data3_2  $data4_2
print $data0_3  $data1_3  $data2_3  $data3_3  $data4_3
print $data0_4  $data1_4  $data2_4  $data3_4  $data4_4
H
Hui Li 已提交
164 165 166 167 168
print $data0_5  $data1_5  $data2_5  $data3_5  $data4_5
print $data0_6  $data1_6  $data2_6  $data3_6  $data4_6
print $data0_7  $data1_7  $data2_7  $data3_7  $data4_7
print $data0_8  $data1_8  $data2_8  $data3_8  $data4_8
print $data0_9  $data1_9  $data2_9  $data3_9  $data4_9
H
Hui Li 已提交
169 170 171

print ============== step8: restart dnode2, then wait sync end
system sh/exec.sh -n dnode2 -s start
H
Hui Li 已提交
172
sleep 20000
H
Hui Li 已提交
173
sql show mnodes
H
Hui Li 已提交
174 175
print show mnodes
print rows: $rows
H
Hui Li 已提交
176 177 178 179
print $data0_1  $data1_1  $data2_1  $data3_1  $data4_1
print $data0_2  $data1_2  $data2_2  $data3_2  $data4_2
print $data0_3  $data1_3  $data2_3  $data3_3  $data4_3
print $data0_4  $data1_4  $data2_4  $data3_4  $data4_4
H
Hui Li 已提交
180 181 182 183 184
print $data0_5  $data1_5  $data2_5  $data3_5  $data4_5
print $data0_6  $data1_6  $data2_6  $data3_6  $data4_6
print $data0_7  $data1_7  $data2_7  $data3_7  $data4_7
print $data0_8  $data1_8  $data2_8  $data3_8  $data4_8
print $data0_9  $data1_9  $data2_9  $data3_9  $data4_9
H
Hui Li 已提交
185 186 187

print ============== step9: stop dnode3, then wait sync end
system sh/exec.sh -n dnode3 -s stop -x SIGINT
H
Hui Li 已提交
188 189 190 191
sleep 20000
sql show mnodes
print show mnodes
print rows: $rows
H
Hui Li 已提交
192 193 194 195
print $data0_1  $data1_1  $data2_1  $data3_1  $data4_1
print $data0_2  $data1_2  $data2_2  $data3_2  $data4_2
print $data0_3  $data1_3  $data2_3  $data3_3  $data4_3
print $data0_4  $data1_4  $data2_4  $data3_4  $data4_4
H
Hui Li 已提交
196 197 198 199 200
print $data0_5  $data1_5  $data2_5  $data3_5  $data4_5
print $data0_6  $data1_6  $data2_6  $data3_6  $data4_6
print $data0_7  $data1_7  $data2_7  $data3_7  $data4_7
print $data0_8  $data1_8  $data2_8  $data3_8  $data4_8
print $data0_9  $data1_9  $data2_9  $data3_9  $data4_9
H
Hui Li 已提交
201 202 203

print ============== step10: restart dnode3, then wait sync end
system sh/exec.sh -n dnode3 -s start
H
Hui Li 已提交
204 205 206 207
sleep 20000
sql show mnodes
print show mnodes
print rows: $rows
H
Hui Li 已提交
208 209 210 211
print $data0_1  $data1_1  $data2_1  $data3_1  $data4_1
print $data0_2  $data1_2  $data2_2  $data3_2  $data4_2
print $data0_3  $data1_3  $data2_3  $data3_3  $data4_3
print $data0_4  $data1_4  $data2_4  $data3_4  $data4_4
H
Hui Li 已提交
212 213 214 215 216
print $data0_5  $data1_5  $data2_5  $data3_5  $data4_5
print $data0_6  $data1_6  $data2_6  $data3_6  $data4_6
print $data0_7  $data1_7  $data2_7  $data3_7  $data4_7
print $data0_8  $data1_8  $data2_8  $data3_8  $data4_8
print $data0_9  $data1_9  $data2_9  $data3_9  $data4_9
H
Hui Li 已提交
217 218 219

print ============== step11: stop dnode4, then wait sync end
system sh/exec.sh -n dnode4 -s stop -x SIGINT
H
Hui Li 已提交
220
sleep 20000
H
Hui Li 已提交
221 222 223

print ============== step12: restart dnode4, then wait sync end
system sh/exec.sh -n dnode4 -s start
H
Hui Li 已提交
224 225 226 227
sleep 20000
sql show mnodes
print show mnodes
print rows: $rows
H
Hui Li 已提交
228 229 230 231
print $data0_1  $data1_1  $data2_1  $data3_1  $data4_1
print $data0_2  $data1_2  $data2_2  $data3_2  $data4_2
print $data0_3  $data1_3  $data2_3  $data3_3  $data4_3
print $data0_4  $data1_4  $data2_4  $data3_4  $data4_4
H
Hui Li 已提交
232 233 234 235 236
print $data0_5  $data1_5  $data2_5  $data3_5  $data4_5
print $data0_6  $data1_6  $data2_6  $data3_6  $data4_6
print $data0_7  $data1_7  $data2_7  $data3_7  $data4_7
print $data0_8  $data1_8  $data2_8  $data3_8  $data4_8
print $data0_9  $data1_9  $data2_9  $data3_9  $data4_9
H
Hui Li 已提交
237 238 239

print ============== step13: alter replica 2
sql alter database $db replica 2
H
Hui Li 已提交
240 241
sql show databases
print $data00  $data01  $data02  $data03  $data04  $data05  $data06  $data07   $data08  $data09 
H
Hui Li 已提交
242

H
Hui Li 已提交
243
if $data04 != 2 then
H
Hui Li 已提交
244
  print rplica is not modify to 2, error!!!!!!
H
Hui Li 已提交
245
  return -1
H
Hui Li 已提交
246 247
endi

H
Hui Li 已提交
248
print ============== step14: stop dnode4/dnode5
H
Hui Li 已提交
249
system sh/exec.sh -n dnode4 -s stop -x SIGINT
H
Hui Li 已提交
250
system sh/exec.sh -n dnode5 -s stop -x SIGINT
H
Hui Li 已提交
251
sleep 20000
H
Hui Li 已提交
252 253 254 255 256 257 258
#system sh/exec.sh -n dnode4 -s start
#system sh/exec.sh -n dnode5 -s start
#sleep 10000
#sql drop dnode $hostname4
#sql drop dnode $hostname5
#system rm -rf ../../../sim/dnode4/data
#system rm -rf ../../../sim/dnode5/data
H
Hui Li 已提交
259 260 261

print ============== step15: alter replica 1
sql alter database $db replica 1
H
Hui Li 已提交
262 263 264
sql show databases
print $data00  $data01  $data02  $data03  $data04  $data05  $data06  $data07   $data08  $data09
if $data04 != 1 then
H
Hui Li 已提交
265
  print rplica is not modify to 1, error!!!!!!
H
Hui Li 已提交
266
  return -1
H
Hui Li 已提交
267 268 269
endi

print ============== step16: alter replica 2
H
Hui Li 已提交
270 271 272 273
sql alter database $db replica 2
sql show databases
print $data00  $data01  $data02  $data03  $data04  $data05  $data06  $data07   $data08  $data09
if $data04 != 2 then
H
Hui Li 已提交
274
  print rplica is not modify to 2, error!!!!!!
H
Hui Li 已提交
275
  return -1
H
Hui Li 已提交
276 277
endi

H
Hui Li 已提交
278 279 280 281 282 283 284
#print ============== step17: start dnode1 and add into cluster, then wait dnode1 ready
#system sh/cfg.sh -n dnode1 -c first -v $hostname2
#system sh/cfg.sh -n dnode1 -c second -v $hostname3
#
#system sh/exec.sh -n dnode1 -s start
#sql create dnode $hostname1
#sleep 20000
H
Hui Li 已提交
285 286 287

print ============== step18: alter replica 3
sql alter database $db replica 3
H
Hui Li 已提交
288 289 290
sql show databases
print $data00  $data01  $data02  $data03  $data04  $data05  $data06  $data07   $data08  $data09
if $data04 != 3 then
H
Hui Li 已提交
291
  print rplica is not modify to 3, error!!!!!!
H
Hui Li 已提交
292
  return -1
H
Hui Li 已提交
293 294
endi

H
Hui Li 已提交
295
print **** **** **** (loop_cnt: $loop_cnt ) end, continue...... **** **** **** ****
H
Hui Li 已提交
296 297
$loop_cnt = $loop_cnt + 1
goto loop_cluster_do