Chinaunix首页 | 论坛 | 博客
  • 博客访问: 39196
  • 博文数量: 12
  • 博客积分: 10
  • 博客等级: 民兵
  • 技术积分: 131
  • 用 户 组: 普通用户
  • 注册时间: 2011-03-21 09:16
个人简介

如果我的能力只能让我穷困潦倒,那么穷困潦倒就是我的价值。

文章分类
文章存档

2015年(12)

我的朋友

分类: LINUX

2015-07-23 21:29:47

需要配置文件支持,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
阅读(1207) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~