dnodes.sim 2.3 KB
Newer Older
S
Shengliang Guan 已提交
1
############## config parameter  #####################
S
Shengliang Guan 已提交
2
$node1 = 192.168.0.201
S
Shengliang Guan 已提交
3
$node2 = 192.168.0.202
S
Shengliang Guan 已提交
4 5
$node3 = 192.168.0.203
$node4 = 192.168.0.204
S
Shengliang Guan 已提交
6 7

$self = $node1
S
Shengliang Guan 已提交
8
$num = 25
S
Shengliang Guan 已提交
9

S
Shengliang Guan 已提交
10 11 12 13 14 15 16 17 18 19 20
#deploy = 0, start = 1, stop = 2
$option = 0
print ===============  option:$option


###############  stop dnodes     #####################
if $option == 0 then
  system sh/stop_dnodes.sh
endi

###############  process firstEp #####################
S
Shengliang Guan 已提交
21 22 23

$firstEp = $node1 . :7100
$firstPort = 7100
S
Shengliang Guan 已提交
24
if $self == $node1 then 
S
Shengliang Guan 已提交
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
  if $option == 1 then
    system sh/exec.sh -n dnode1 -s start
  endi

  if $option == 2 then
    system sh/exec.sh -n dnode1 -s stop -x SIGINT
  endi
  
  if $option == 0 then
    system sh/deploy.sh -n dnode1 -i 1
    system sh/cfg.sh -n dnode1 -c firstEp -v $firstEp
    system sh/cfg.sh -n dnode1 -c secondEp -v $firstEp
    system sh/cfg.sh -n dnode1 -c fqdn -v $node1
    system sh/cfg.sh -n dnode1 -c serverPort -v $firstPort
    system sh/cfg.sh -n dnode1 -c supportVnodes -v 0

    system sh/exec.sh -n dnode1 -s start
    sql connect

    $i = 0
    while $i < $num
      $port = $i * 100
      $port = $port + 8100
      $i = $i + 1
      sql create dnode $node1 port $port
    endw

    $i = 0
    while $i < $num
      $port = $i * 100
      $port = $port + 8100
      $i = $i + 1
      sql create dnode $node2 port $port
    endw

    $i = 0
    while $i < $num
      $port = $i * 100
      $port = $port + 8100
      $i = $i + 1
      sql create dnode $node3 port $port
    endw

    $i = 0
    while $i < $num
      $port = $i * 100
      $port = $port + 8100
      $i = $i + 1
      sql create dnode $node4 port $port
    endw
  endi  
S
Shengliang Guan 已提交
76 77
endi

S
Shengliang Guan 已提交
78
###############  process nodes   #####################
S
Shengliang Guan 已提交
79 80 81 82 83

$i = 0
while $i < $num
  $index = $i + 80
  $port = $i * 100
S
Shengliang Guan 已提交
84
  $port = $port + 8100
S
Shengliang Guan 已提交
85 86 87
  $dnodename = dnode . $index
  $i = $i + 1 

S
Shengliang Guan 已提交
88 89 90 91 92 93 94 95 96 97 98 99 100 101
  if $option == 1 then
    system sh/exec.sh -n $dnodename -s start
  endi

  if $option == 2 then
    system sh/exec.sh -n $dnodename -s stop -x SIGINT
  endi

  if $option == 0 then
    system sh/deploy.sh -n $dnodename -i 1
    system sh/cfg.sh -n $dnodename -c firstEp -v $firstEp
    system sh/cfg.sh -n $dnodename -c secondEp -v $firstEp
    system sh/cfg.sh -n $dnodename -c fqdn -v $self
    system sh/cfg.sh -n $dnodename -c serverPort -v $port
S
Shengliang Guan 已提交
102

S
Shengliang Guan 已提交
103 104
    system sh/exec.sh -n $dnodename -s start
  endi  
S
Shengliang Guan 已提交
105
endw