cluster_main.sim 8.2 KB
Newer Older
H
Hui Li 已提交
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90
# scp -r root@114.116.252.220:/home/ubuntu/clusterSimCase unique/.

#taos> show dnodes;
#   id   |           end_point            | vnodes | cores  |     status     |   role   |       create_time       |
#==================================================================================================================
#      1 | ubuntu-OptiPlex-7060:7100      |      0 |     12 | ready          | mnode    | 2020-07-22 06:25:31.677 |
#      2 | ubuntu-OptiPlex-7060:7200      |      4 |     12 | ready          | vnode    | 2020-07-22 06:25:34.795 |
#      3 | ubuntu-OptiPlex-7060:7300      |      4 |     12 | ready          | vnode    | 2020-07-22 06:25:34.803 |
#Query OK, 3 row(s) in set (0.002448s)
#taos> show vgroups;
#    vgId     |   tables    |   status   | onlineVnodes | dnode  |   vstatus   | dnode  |   vstatus   |
#======================================================================================================
#           2 |        1024 | ready      |            2 |      3 | master      |      2 | slave       |
#           3 |        1024 | ready      |            2 |      3 | master      |      2 | slave       |
#           4 |        1024 | ready      |            2 |      3 | master      |      2 | slave       |
#           5 |         718 | ready      |            2 |      3 | master      |      2 | slave       |
#Query OK, 4 row(s) in set (0.002749s)
#
#taos> show mnodes
#   -> ;
#   id   |           end_point            |      role      |       create_time       |
#=====================================================================================
#      1 | ubuntu-OptiPlex-7060:7100      | master         | 2020-07-22 06:25:31.677 |
#Query OK, 1 row(s) in set (0.002126s)


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

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

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

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

system sh/cfg.sh -n dnode1 -c numOfTotalVnodes -v 256
system sh/cfg.sh -n dnode2 -c numOfTotalVnodes -v 256
system sh/cfg.sh -n dnode3 -c numOfTotalVnodes -v 256
system sh/cfg.sh -n dnode4 -c numOfTotalVnodes -v 256

#system sh/cfg.sh -n dnode1 -c maxVgroupsPerDb -v 1
#system sh/cfg.sh -n dnode2 -c maxVgroupsPerDb -v 1
#system sh/cfg.sh -n dnode3 -c maxVgroupsPerDb -v 1
#system sh/cfg.sh -n dnode4 -c maxVgroupsPerDb -v 1

#system sh/cfg.sh -n dnode1 -c mnodeEqualVnodeNum -v 256  
#system sh/cfg.sh -n dnode2 -c mnodeEqualVnodeNum -v 256  
#system sh/cfg.sh -n dnode3 -c mnodeEqualVnodeNum -v 256  
#system sh/cfg.sh -n dnode4 -c mnodeEqualVnodeNum -v 256

system sh/cfg.sh -n dnode1 -c role -v 1
system sh/cfg.sh -n dnode2 -c role -v 2
system sh/cfg.sh -n dnode3 -c role -v 2
system sh/cfg.sh -n dnode4 -c role -v 2

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 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

print ============== step0: start tarbitrator and dnode1
system sh/exec_tarbitrator.sh -s start
system sh/exec.sh -n dnode1 -s start

print ============== step2: start dnode2/dnode3
system sh/exec.sh -n dnode2 -s start
system sh/exec.sh -n dnode3 -s start
sleep 1000
sql connect

print ============== step1: add dnode2/dnode3 into cluster
sql create dnode $hostname2
sql create dnode $hostname3
H
Haojun Liao 已提交
91 92
sleep 2000
sleep 2000
H
Hui Li 已提交
93 94
print ============== step3: start back client-01.sim
#run_back unique/clusterSimCase/client-01.sim
H
Hui Li 已提交
95 96
#run_back unique/clusterSimCase/client-02.sim
#run_back unique/clusterSimCase/client-03.sim
H
Hui Li 已提交
97
#run_back unique/clusterSimCase/client-04.sim
H
Hui Li 已提交
98 99 100
#run_back unique/clusterSimCase/client-05.sim
#run_back unique/clusterSimCase/client-06.sim
#run_back unique/clusterSimCase/client-07.sim
H
Hui Li 已提交
101
run_back unique/clusterSimCase/client-08.sim
H
Hui Li 已提交
102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144
#run_back unique/clusterSimCase/client-01.sim
#run_back unique/clusterSimCase/client-01.sim
sleep 20000

$db = db
sql use $db

$loop_cnt = 0
loop_cluster_do:
print **** **** **** START loop cluster do (loop_cnt: $loop_cnt )**** **** **** ****

print ============== step4: stop dnode3
system sh/exec.sh -n dnode3 -s stop -x SIGINT

$checkCnt = 0
wait_vgroup_chang_0:
$checkCnt = $checkCnt + 1
if $loopCnt == 10 then
  return -1
endi
print show vgroups
sql show vgroups
#if $rows != 4 then
#  print rows: $rows
#  sleep 2000
#  goto wait_vgroup_chang_0
#endi
print $data0_1  $data1_1  $data2_1  $data3_1  $data4_1  $data5_1  $data6_1  $data7_1  $data8_1  $data9_1
print $data0_2  $data1_2  $data2_2  $data3_2  $data4_2  $data5_2  $data6_2  $data7_2  $data8_2  $data9_2
print $data0_3  $data1_3  $data2_3  $data3_3  $data4_3  $data5_3  $data6_3  $data7_3  $data8_3  $data9_3
$vg2Dnode3Status = $data5_2
$vg2Dnode2Status = $data7_2

if $vg2Dnode3Status != offline then
  sleep 2000
  goto wait_vgroup_chang_0
endi
if $vg2Dnode2Status != master then
  sleep 2000
  goto wait_vgroup_chang_0
endi


H
Haojun Liao 已提交
145
sleep 2000
H
Hui Li 已提交
146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176
print ============== step3: restart dnode3
system sh/exec.sh -n dnode3 -s start

$checkCnt = 0
wait_vgroup_chang_1:
$checkCnt = $checkCnt + 1
if $loopCnt == 10 then
  return -1
endi
print show vgroups
sql show vgroups
#if $rows != 4 then
#  print rows: $rows
#  sleep 2000
#  goto wait_vgroup_chang_1
#endi
print $data0_1  $data1_1  $data2_1  $data3_1  $data4_1  $data5_1  $data6_1  $data7_1  $data8_1  $data9_1
print $data0_2  $data1_2  $data2_2  $data3_2  $data4_2  $data5_2  $data6_2  $data7_2  $data8_2  $data9_2
print $data0_3  $data1_3  $data2_3  $data3_3  $data4_3  $data5_3  $data6_3  $data7_3  $data8_3  $data9_3
$vg2Dnode3Status = $data5_2
$vg2Dnode2Status = $data7_2

if $vg2Dnode3Status != slave then
  sleep 2000
  goto wait_vgroup_chang_1
endi
if $vg2Dnode2Status != master then
  sleep 2000
  goto wait_vgroup_chang_1
endi

H
Haojun Liao 已提交
177
sleep 2000
H
Hui Li 已提交
178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209
print ============== step4: stop dnode2
system sh/exec.sh -n dnode2 -s stop -x SIGINT

$checkCnt = 0
wait_vgroup_chang_2:
$checkCnt = $checkCnt + 1
if $loopCnt == 10 then
  return -1
endi
print show vgroups
sql show vgroups
#if $rows != 4 then
#  print rows: $rows
#  sleep 2000
#  goto wait_vgroup_chang_2
#endi
print $data0_1  $data1_1  $data2_1  $data3_1  $data4_1  $data5_1  $data6_1  $data7_1  $data8_1  $data9_1
print $data0_2  $data1_2  $data2_2  $data3_2  $data4_2  $data5_2  $data6_2  $data7_2  $data8_2  $data9_2
print $data0_3  $data1_3  $data2_3  $data3_3  $data4_3  $data5_3  $data6_3  $data7_3  $data8_3  $data9_3
$vg2Dnode3Status = $data5_2
$vg2Dnode2Status = $data7_2

if $vg2Dnode3Status != master then
  sleep 2000
  goto wait_vgroup_chang_2
endi
if $vg2Dnode2Status != offline then
  sleep 2000
  goto wait_vgroup_chang_2
endi


H
Haojun Liao 已提交
210
sleep 2000
H
Hui Li 已提交
211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241
print ============== step5: restart dnode2
system sh/exec.sh -n dnode2 -s start

$checkCnt = 0
wait_vgroup_chang_3:
$checkCnt = $checkCnt + 1
if $loopCnt == 10 then
  return -1
endi
print show vgroups
sql show vgroups
#if $rows != 4 then
#  print rows: $rows
#  sleep 2000
#  goto wait_vgroup_chang_3
#endi
print $data0_1  $data1_1  $data2_1  $data3_1  $data4_1  $data5_1  $data6_1  $data7_1  $data8_1  $data9_1
print $data0_2  $data1_2  $data2_2  $data3_2  $data4_2  $data5_2  $data6_2  $data7_2  $data8_2  $data9_2
print $data0_3  $data1_3  $data2_3  $data3_3  $data4_3  $data5_3  $data6_3  $data7_3  $data8_3  $data9_3
$vg2Dnode3Status = $data5_2
$vg2Dnode2Status = $data7_2

if $vg2Dnode2Status != slave then
  sleep 2000
  goto wait_vgroup_chang_3
endi
if $vg2Dnode3Status != master then
  sleep 2000
  goto wait_vgroup_chang_3
endi

H
Haojun Liao 已提交
242
sleep 2000
H
Hui Li 已提交
243 244
print **** **** **** (loop_cnt: $loop_cnt ) end, continue...... **** **** **** ****
$loop_cnt = $loop_cnt + 1
H
Hui Li 已提交
245 246 247
if $loop_cnt == 50 then
  return 0
endi
H
Hui Li 已提交
248
goto loop_cluster_do