system sh/stop_dnodes.sh system sh/deploy.sh -n dnode1 -i 1 system sh/deploy.sh -n dnode2 -i 2 system sh/exec.sh -n dnode1 -s start system sh/exec.sh -n dnode2 -s start sql connect print =============== show dnodes sql show mnodes; if $rows != 1 then return -1 endi if $data00 != 1 then return -1 endi if $data02 != LEADER then return -1 endi print =============== create dnodes sql create dnode $hostname port 7200 $x = 0 step1: $x = $x + 1 sleep 500 if $x == 20 then return -1 endi sql show dnodes -x step1 if $data(1)[4] != ready then goto step1 endi if $data(2)[4] != ready then goto step1 endi print =============== create mnode 2 sql create mnode on dnode 2 $x = 0 step2: $x = $x + 1 sleep 1000 if $x == 20 then return -1 endi sql show mnodes print $data(1)[0] $data(1)[1] $data(1)[2] print $data(2)[0] $data(2)[1] $data(2)[2] if $rows != 2 then return -1 endi if $data(1)[0] != 1 then return -1 endi if $data(1)[2] != LEADER then return -1 endi if $data(2)[0] != 2 then return -1 endi if $data(2)[2] != FOLLOWER then goto step2 endi print =============== create user sql create user user1 PASS 'user1' sql show users if $rows != 2 then return -1 endi sql create database db sql show databases if $rows != 3 then return -1 endi sleep 5000 print =============== restart system sh/exec.sh -n dnode1 -s stop system sh/exec.sh -n dnode2 -s stop system sh/exec.sh -n dnode1 -s start system sh/exec.sh -n dnode2 -s start sql connect sql show mnodes if $rows != 2 then return -1 endi sql show users if $rows != 2 then return -1 endi sql show databases if $rows != 3 then return -1 endi $x = 0 step3: $x = $x + 1 sleep 500 if $x == 20 then return -1 endi sql show dnodes -x step3 if $data(1)[4] != ready then goto step3 endi if $data(2)[4] != ready then goto step3 endi print =============== insert data sql create table db.stb (ts timestamp, c1 int, c2 binary(4)) tags(t1 int, t2 float, t3 binary(16)) comment "abd" sql create table db.ctb using db.stb tags(101, 102, "103") sql insert into db.ctb values(now, 1, "2") sql select * from db.ctb print $data[0][0] $data[0][1] $data[0][2] $data[0][3] $data[0][4] $data[0][5] $data[0][6] if $rows != 1 then return -1 endi system sh/exec.sh -n dnode1 -s stop system sh/exec.sh -n dnode2 -s stop