system sh/stop_dnodes.sh
system sh/deploy.sh -n dnode1 -i 1
system sh/deploy.sh -n dnode2 -i 2

print ========== step1
system sh/exec.sh -n dnode1 -s start
sql connect
sql create dnode $hostname port 7200

sql select * from information_schema.ins_dnodes
print dnode1 off: $data(1)[7]
print dnode2 off: $data(2)[7]

if $data(2)[7] != @status not received@ then
	return -1
endi

print ========== step2
system sh/exec.sh -n dnode2 -s start

$x = 0
step2:
	$x = $x + 1
	sleep 1000
	if $x == 10 then
	  print ====> dnode not ready!
		return -1
	endi
sql select * from information_schema.ins_dnodes
print ===> $data00 $data01 $data02 $data03 $data04 $data05
print ===> $data10 $data11 $data12 $data13 $data14 $data15
if $rows != 2 then
  return -1
endi
if $data(1)[4] != ready then
  goto step2
endi
if $data(2)[4] != ready then
  goto step2
endi

print ========== step3
system sh/exec.sh -n dnode2 -s stop 

$x = 0
step3: 
	$x = $x + 1
	sleep 1000
	if $x == 10 then
		return -1
	endi
sql select * from information_schema.ins_dnodes
print dnode1 off: $data(1)[7]
print dnode2 off: $data(2)[7]
if $data(2)[7] != @status msg timeout@ then
	goto step3
endi

print ========== step4
sql drop dnode 2 force
sql select * from information_schema.ins_dnodes
if $rows != 1 then
	return -1
endi

print ========== step5
sql create dnode $hostname port 7200
system sh/exec.sh -n dnode2 -s start

return
$x = 0
step5: 
	$x = $x + 1
	sleep 1000
	if $x == 10 then
		return -1
	endi

sql select * from information_schema.ins_dnodes
print dnode1 off: $data(1)[7]
print dnode2 off: $data(3)[7]
if $data(3)[7] != @dnodeId not match@ then
	goto step5
endi

print ========== step6
system sh/deploy.sh -n dnode4 -i 4
system sh/cfg.sh -n dnode4 -c statusInterval -v 4
system sh/exec.sh -n dnode4 -s start
sql create dnode $hostname port 7400

$x = 0
step6: 
	$x = $x + 1
	sleep 1000
	if $x == 10 then
		return -1
	endi

sql select * from information_schema.ins_dnodes
print dnode1 off: $data(1)[7]
print dnode2 off: $data(3)[7]
print dnode3 off: $data(4)[67
if $data(4)[7] != @interval not match@ then
	goto step6
endi

print ========== step7
system sh/deploy.sh -n dnode5 -i 5
system sh/cfg.sh -n dnode5 -c locale -v zn_CH.UTF-8
system sh/exec.sh -n dnode5 -s start
sql create dnode $hostname port 7500

$x = 0
step7: 
	$x = $x + 1
	sleep 1000
	if $x == 10 then
		return -1
	endi

sql select * from information_schema.ins_dnodes
print dnode1 off: $data(1)[7]
print dnode3 off: $data(3)[7]
print dnode4 off: $data(4)[7]
print dnode5 off: $data(5)[7]
if $data(5)[7] != @locale not match@ then
	goto step7
endi

print ========== step8
system sh/deploy.sh -n dnode6 -i 6
system sh/cfg.sh -n dnode6 -c charset -v UTF-16
system sh/exec.sh -n dnode6 -s start
sql create dnode $hostname port 7600

$x = 0
step8: 
	$x = $x + 1
	sleep 1000
	if $x == 10 then
		return -1
	endi

sql select * from information_schema.ins_dnodes
print dnode1 off: $data(1)[7]
print dnode3 off: $data(3)[7]
print dnode4 off: $data(4)[7]
print dnode5 off: $data(5)[7]
print dnode6 off: $data(6)[7]
if $data(6)[7] != @charset not match@ then
	goto step8
endi

system sh/exec.sh -n dnode1 -s stop  -x SIGINT
system sh/exec.sh -n dnode2 -s stop  -x SIGINT
system sh/exec.sh -n dnode3 -s stop  -x SIGINT
system sh/exec.sh -n dnode4 -s stop  -x SIGINT
system sh/exec.sh -n dnode5 -s stop  -x SIGINT
system sh/exec.sh -n dnode6 -s stop  -x SIGINT
system sh/exec.sh -n dnode7 -s stop  -x SIGINT
system sh/exec.sh -n dnode8 -s stop  -x SIGINT