需要配置文件支持,nodes.conf一同放入目录
#!/bin/bash
for line in `cat nodes.conf|grep -v "^#"`
do
a=($(echo $line|tr "-" " "))
echo -e "${a[2]}\t${a[5]}-${a[0]}-${a[1]}.local\t${a[5]}-${a[0]}-${a[1]}\tc${a[0]}-${a[1]}" >> /etc/hosts
rocks add host ${a[5]}-${a[0]}-${a[1]} cpus=${a[4]} membership=${a[5]} os=${a[6]} rack=${a[0]} rank="${a[1]}"
echo "Add host OK"
sleep 1
rocks add host interface ${a[5]}-${a[0]}-${a[1]} iface=${a[3]} ip=${a[2]} name=${a[5]}-${a[0]}-${a[1]} subnet=private
echo "Add Ip OK"
done
rocks list host interface
==========================================================
nodes.conf文件内容
# NameRack NameRank Ip_Addr InterFace CoreNumber Membship Os Rack Rank
# | | | | | | | | |
#compute-0-0 compute-0-0 ip eth* or em* cpuNum membship os rack rank
#VarNum a[0] a[1] a[2] a[3] a[4] a[5] a[6] a[0] a[1]
#下面两个例子是compute-6-0 ip是10.1.56.100 网卡接口eth0 24个核心
6-0-10.1.56.100-eth0-24-Compute-linux
6-1-10.1.56.101-eth0-24-Compute-linux
阅读(1225) | 评论(0) | 转发(0) |