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 2 system sh/cfg.sh -n dnode2 -c walLevel -v 2 system sh/cfg.sh -n dnode3 -c walLevel -v 2 system sh/cfg.sh -n dnode4 -c walLevel -v 2 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 4 system sh/cfg.sh -n dnode2 -c numOfTotalVnodes -v 4 system sh/cfg.sh -n dnode3 -c numOfTotalVnodes -v 4 system sh/cfg.sh -n dnode4 -c numOfTotalVnodes -v 4 system sh/cfg.sh -n dnode1 -c alternativeRole -v 1 system sh/cfg.sh -n dnode2 -c alternativeRole -v 2 system sh/cfg.sh -n dnode3 -c alternativeRole -v 2 system sh/cfg.sh -n dnode4 -c alternativeRole -v 2 system sh/cfg.sh -n dnode1 -c maxtablesPerVnode -v 4 system sh/cfg.sh -n dnode2 -c maxtablesPerVnode -v 4 system sh/cfg.sh -n dnode3 -c maxtablesPerVnode -v 4 system sh/cfg.sh -n dnode4 -c maxtablesPerVnode -v 4 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 system sh/exec_tarbitrator.sh -s start print ============== step1: start dnode1, only deploy mnode system sh/exec.sh -n dnode1 -s start sleep 3000 sql connect print ============== step2: start dnode2/dnode3/dnode4 and add into cluster , then create database with replica 3, and create table, insert data system sh/exec.sh -n dnode2 -s start system sh/exec.sh -n dnode3 -s start system sh/exec.sh -n dnode4 -s start sql create dnode $hostname2 sql create dnode $hostname3 sql create dnode $hostname4 sleep 3000 $totalTableNum = 10 $sleepTimer = 3000 $db = db sql create database $db replica 3 maxTables $totalTableNum sql use $db # create table , insert data $stb = stb sql create table $stb (ts timestamp, c1 int) tags(t1 int) $rowNum = 10 $tblNum = $totalTableNum $totalRows = 0 $tsStart = 1420041600000 $i = 0 while $i < $tblNum $tb = tb . $i sql create table $tb using $stb tags( $i ) $x = 0 while $x < $rowNum $ts = $tsStart + $x sql insert into $tb values ( $ts + 0a , $x ) ( $ts + 1a , $x ) ( $ts + 2a , $x ) ( $ts + 3a , $x ) ( $ts + 4a , $x ) ( $ts + 5a , $x ) ( $ts + 6a , $x ) ( $ts + 7a , $x ) ( $ts + 8a , $x ) ( $ts + 9a , $x ) $x = $x + 10 endw $totalRows = $totalRows + $x print info: inserted $x rows into $tb and totalRows: $totalRows $i = $i + 1 endw sql select count(*) from $stb print data00 $data00 if $data00 != $totalRows then return -1 endi print ============== step3: drop the middle table 5 sql drop table tb5 $totalRows = $totalRows - 10 sleep 6000 print ============== step4: insert data into other tables $tsStart = 1420041610000 $i = 0 $tblNum = 5 while $i < $tblNum $tb = tb . $i #sql create table $tb using $stb tags( $i ) $x = 0 while $x < $rowNum $ts = $tsStart + $x sql insert into $tb values ( $ts + 0a , $x ) ( $ts + 1a , $x ) ( $ts + 2a , $x ) ( $ts + 3a , $x ) ( $ts + 4a , $x ) ( $ts + 5a , $x ) ( $ts + 6a , $x ) ( $ts + 7a , $x ) ( $ts + 8a , $x ) ( $ts + 9a , $x ) $x = $x + 10 endw $totalRows = $totalRows + $x print info: inserted $x rows into $tb and totalRows: $totalRows $i = $i + 1 endw $i = 6 $tblNum = 10 while $i < $tblNum $tb = tb . $i #sql create table $tb using $stb tags( $i ) $x = 0 while $x < $rowNum $ts = $tsStart + $x sql insert into $tb values ( $ts + 0a , $x ) ( $ts + 1a , $x ) ( $ts + 2a , $x ) ( $ts + 3a , $x ) ( $ts + 4a , $x ) ( $ts + 5a , $x ) ( $ts + 6a , $x ) ( $ts + 7a , $x ) ( $ts + 8a , $x ) ( $ts + 9a , $x ) $x = $x + 10 endw $totalRows = $totalRows + $x print info: inserted $x rows into $tb and totalRows: $totalRows $i = $i + 1 endw sql select count(*) from $stb print data00 $data00 if $data00 != $totalRows then return -1 endi print ============== step5: create the middle table 5 and insert data sql create table tb5 using $stb tags( 5 ) sleep 3000 $tsStart = 1420041620000 $i = 5 $tblNum = 6 while $i < $tblNum $tb = tb . $i #sql create table $tb using $stb tags( $i ) $x = 0 while $x < $rowNum $ts = $tsStart + $x sql insert into $tb values ( $ts + 0a , $x ) ( $ts + 1a , $x ) ( $ts + 2a , $x ) ( $ts + 3a , $x ) ( $ts + 4a , $x ) ( $ts + 5a , $x ) ( $ts + 6a , $x ) ( $ts + 7a , $x ) ( $ts + 8a , $x ) ( $ts + 9a , $x ) $x = $x + 10 endw $totalRows = $totalRows + $x print info: inserted $x rows into $tb and totalRows: $totalRows $i = $i + 1 endw sql select count(*) from $stb print data00 $data00 if $data00 != $totalRows then return -1 endi sql select count(*) from tb5 print data00 $data00 if $data00 != 10 then return -1 endi print ============== step6: drop the first table 0 sql drop table tb0 $totalRows = $totalRows - 20 sleep 6000 print ============== step7: insert data into other tables $tsStart = 1420041630000 $i = 1 $tblNum = 10 while $i < $tblNum $tb = tb . $i #sql create table $tb using $stb tags( $i ) $x = 0 while $x < $rowNum $ts = $tsStart + $x sql insert into $tb values ( $ts + 0a , $x ) ( $ts + 1a , $x ) ( $ts + 2a , $x ) ( $ts + 3a , $x ) ( $ts + 4a , $x ) ( $ts + 5a , $x ) ( $ts + 6a , $x ) ( $ts + 7a , $x ) ( $ts + 8a , $x ) ( $ts + 9a , $x ) $x = $x + 10 endw $totalRows = $totalRows + $x print info: inserted $x rows into $tb and totalRows: $totalRows $i = $i + 1 endw sql select count(*) from $stb print data00 $data00 if $data00 != $totalRows then return -1 endi sql select count(*) from tb5 print data00 $data00 if $data00 != 20 then return -1 endi print ============== step8: create the first table 0 and insert data sql create table tb0 using $stb tags( 0 ) sleep 3000 $tsStart = 1420041640000 $i = 0 $tblNum = 10 while $i < $tblNum $tb = tb . $i #sql create table $tb using $stb tags( $i ) $x = 0 while $x < $rowNum $ts = $tsStart + $x sql insert into $tb values ( $ts + 0a , $x ) ( $ts + 1a , $x ) ( $ts + 2a , $x ) ( $ts + 3a , $x ) ( $ts + 4a , $x ) ( $ts + 5a , $x ) ( $ts + 6a , $x ) ( $ts + 7a , $x ) ( $ts + 8a , $x ) ( $ts + 9a , $x ) $x = $x + 10 endw $totalRows = $totalRows + $x print info: inserted $x rows into $tb and totalRows: $totalRows $i = $i + 1 endw sql select count(*) from $stb print data00 $data00 if $data00 != $totalRows then return -1 endi sql select count(*) from tb0 print data00 $data00 if $data00 != 10 then return -1 endi print ============== step9: drop the last table 9 sql drop table tb9 $totalRows = $totalRows - 40 sleep 6000 print ============== step10: insert data into other tables $tsStart = 1420041650000 $i = 0 $tblNum = 9 while $i < $tblNum $tb = tb . $i #sql create table $tb using $stb tags( $i ) $x = 0 while $x < $rowNum $ts = $tsStart + $x sql insert into $tb values ( $ts + 0a , $x ) ( $ts + 1a , $x ) ( $ts + 2a , $x ) ( $ts + 3a , $x ) ( $ts + 4a , $x ) ( $ts + 5a , $x ) ( $ts + 6a , $x ) ( $ts + 7a , $x ) ( $ts + 8a , $x ) ( $ts + 9a , $x ) $x = $x + 10 endw $totalRows = $totalRows + $x print info: inserted $x rows into $tb and totalRows: $totalRows $i = $i + 1 endw sql select count(*) from $stb print data00 $data00 if $data00 != $totalRows then return -1 endi print ============== step11: create the last table 9 and insert data sql create table tb9 using $stb tags( 9 ) sleep 3000 $tsStart = 1420041660000 $i = 0 $tblNum = 10 while $i < $tblNum $tb = tb . $i #sql create table $tb using $stb tags( $i ) $x = 0 while $x < $rowNum $ts = $tsStart + $x sql insert into $tb values ( $ts + 0a , $x ) ( $ts + 1a , $x ) ( $ts + 2a , $x ) ( $ts + 3a , $x ) ( $ts + 4a , $x ) ( $ts + 5a , $x ) ( $ts + 6a , $x ) ( $ts + 7a , $x ) ( $ts + 8a , $x ) ( $ts + 9a , $x ) $x = $x + 10 endw $totalRows = $totalRows + $x print info: inserted $x rows into $tb and totalRows: $totalRows $i = $i + 1 endw sql select count(*) from $stb print data00 $data00 if $data00 != $totalRows then return -1 endi sql select count(*) from tb9 print data00 $data00 if $data00 != 10 then return -1 endi