Diferencias entre las revisiones 1 y 2
Versión 1 con fecha 2017-07-21 13:53:36
Tamaño: 4594
Editor: FabioDuran
Comentario:
Versión 2 con fecha 2017-07-21 13:55:48
Tamaño: 4655
Editor: FabioDuran
Comentario:
Los textos eliminados se marcan así. Los textos añadidos se marcan así.
Línea 2: Línea 2:
Línea 22: Línea 21:
rocks set network servedns ibnet True  rocks set network servedns ibnet True
Línea 28: Línea 27:
Línea 30: Línea 28:
[[attachment:infiniband-clustertalca2.sh|Descargar script]]
Línea 34: Línea 32:
{{{
#! /bin/bash
{{{#! /bin/bash
Línea 40: Línea 37:
 
Línea 43: Línea 40:
  original_string="$@"               
  first_character=${original_string:0:1}   
  rest_of_the_string=${original_string:1}       
  original_string="$@"
  first_character=${original_string:0:1}
  rest_of_the_string=${original_string:1}
Línea 47: Línea 44:
  echo "${first_character_uc}${rest_of_the_string}"     echo "${first_character_uc}${rest_of_the_string}"
Línea 49: Línea 46:
 
 
# Necessary variables 


# Necessary variables
Línea 54: Línea 51:
 
Línea 60: Línea 57:
 
Línea 63: Línea 60:
 
Línea 72: Línea 69:
 
Línea 76: Línea 73:
# echo "MYHOSTNAME_ETH0"  # echo "MYHOSTNAME_ETH0"
Línea 85: Línea 82:
 
Línea 100: Línea 97:
 
Línea 105: Línea 102:
 
Línea 110: Línea 107:
 
Línea 115: Línea 112:
 
Línea 118: Línea 115:
 
Línea 121: Línea 118:
Línea 123: Línea 119:
[[attachment:infiniband-nodes.sh|Descargar script]]

La red privada de Infiniband es 192.168.20.x con máscara 16

A continuación se encuentra el script que se ha diseñado para levantar la interfaz (ib0) para el nodo master

# Commands below need to be run from the front end as root.
# Front end usually has the IP address 192.168.10.1 for eth0.

#
# Network
rocks add network ibnet subnet=192.168.20.0 netmask=255.255.0.0
rocks set host interface ip     localhost iface=ib0 ip=192.168.20.1
rocks set host interface subnet localhost iface=ib0 subnet=ibnet
rocks set host interface module localhost iface=ib0 module=ip_ipoib
rocks set host interface name   localhost iface=ib0 name=clustertalca2
rocks sync host network localhost
#
# Firewall
rocks add firewall host=localhost chain=INPUT protocol=all service=all action=ACCEPT network=ibnet iface=ib0 rulename="A80-IB0-PRIVATE"
rocks sync host firewall localhost
rocks set network servedns ibnet True

#
# /etc/hosts.local
echo "# Front end" > /etc/hosts.local
printf "%-14s  %-20s  %-14s\n"  "192.168.20.1"  "clustertalca2.ibnet" "ib-clustertalca2" >> /etc/hosts.local

Descargar script

La configuración de los nodos:

# BASH script to configure IPoIB for non front end nodes in a Rocks 6.1 cluster.
# IP address scheme for InfiniBand (ib0) will reflect that of Ethernet (eth0).
# Must be root to run this script.

# Function to convert the first character in a string to uppercase
function ucfirst_character () {
  original_string="$@"
  first_character=${original_string:0:1}
  rest_of_the_string=${original_string:1}
  first_character_uc=`echo "$first_character" | tr a-z A-Z`
  echo "${first_character_uc}${rest_of_the_string}"
}


# Necessary variables
# Remove login and/or nas from the list below if the cluster does not have login and/or NAS nodes
export MYNODETYPES="compute"

# Outer for loop begins
for x in $MYNODETYPES
do

  echo $x

  # List of nodes of given type (login, nas or compute)
  export MYNODES=`rocks list host | grep "$x" | awk -F ':' '{ print $1 }' | sort -t- -k 2,2n -k 3,3n`

  # /etc/hosts.local header for a given type of node
  if [ $x == "nas" ]
  then
    export y=`echo $x | tr a-z A-Z`
  else
    export y=`ucfirst_character $x`
  fi
  echo "# $y node(s)" >> /etc/hosts.local

  # Inner for loop begins
  for MYHOSTNAME_ETH0 in $MYNODES
  do
#    echo "MYHOSTNAME_ETH0"
#    echo $MYHOSTNAME_ETH0
    #
    # Additiional necessary variables
    export MYHOSTNAME_IB0="ib-$MYHOSTNAME_ETH0"
    export MYHOSTIP_ETH0=`rocks list host interface $MYHOSTNAME_ETH0 | grep "eth0" | awk '{ print $4 }'`
    export MYHOSTIP_IB0=`echo $MYHOSTIP_ETH0 | sed 's/192.168.255/192.168.20/g'`
    export MYSHORTNAME_ETH0=`echo $MYHOSTNAME_ETH0 | sed 's/compute/c/g' | sed 's/login/l/g' | sed 's/nas/n/g'`
    export MYSHORTNAME_IB0=`echo $MYHOSTNAME_IB0   | sed 's/compute/c/g' | sed 's/login/l/g' | sed 's/nas/n/g'`

    #
    # Network
    rocks add host interface $MYHOSTNAME_ETH0 ib0
    echo "1"
    rocks set host interface ip $MYHOSTNAME_ETH0 iface=ib0 ip=$MYHOSTIP_IB0
    echo "2"
    echo $MYHOSTNAME_ETH0
    rocks set host interface subnet $MYHOSTNAME_ETH0 iface=ib0 subnet=ibnet
    echo "3"
    rocks set host interface module $MYHOSTNAME_ETH0 iface=ib0 module=ip_ipoib
    echo "4"
    rocks set host interface name $MYHOSTNAME_ETH0 iface=ib0 name=$MYHOSTNAME_ETH0
    echo "5"
    rocks sync host network $MYHOSTNAME_ETH0

    #
    # Firewall
    rocks add firewall host=$MYHOSTNAME_ETH0 chain=INPUT protocol=all service=all action=ACCEPT network=ibnet iface=ib0 rulename="A80-IB0-PRIVATE"
    rocks sync host firewall $MYHOSTNAME_ETH0

    #
    # For debugging purposes only
    printf "%-14s  %-20s  %-14s  %-18s  %-10s\n"  "${MYHOSTIP_ETH0}" "${MYHOSTNAME_ETH0}.local" "${MYSHORTNAME_ETH0}.local" "${MYHOSTNAME_ETH0}" "${MYSHORTNAME_ETH0}"
    printf "%-14s  %-20s  %-14s  %-18s  %-10s\n"  "${MYHOSTIP_IB0}"  "${MYHOSTNAME_ETH0}.ibnet" "${MYSHORTNAME_ETH0}.ibnet" "${MYHOSTNAME_IB0}"  "${MYSHORTNAME_IB0}"

    #
    # /etc/hosts.local
    printf "%-14s  %-20s  %-14s  %-18s  %-10s\n"  "${MYHOSTIP_ETH0}" "${MYHOSTNAME_ETH0}.local" "${MYSHORTNAME_ETH0}.local" "${MYHOSTNAME_ETH0}" "${MYSHORTNAME_ETH0}" >> /etc/hosts.local
    printf "%-14s  %-20s  %-14s  %-18s  %-10s\n"  "${MYHOSTIP_IB0}"  "${MYHOSTNAME_ETH0}.ibnet" "${MYSHORTNAME_ETH0}.ibnet" "${MYHOSTNAME_IB0}"  "${MYSHORTNAME_IB0}"  >> /etc/hosts.local

  done
  # Inner for loop ends

done
# Outer for loop ends

Descargar script

cluster/clustertalca2/configuracion/infiniband (última edición 2017-07-21 13:55:48 efectuada por FabioDuran)