一、 xcat 简介     
      xcat (extreme cloud administration toolkit) 是一个开源的可扩展的高级集群管理和配置工具,允许使用者通过一个management节点单点控制和管理一个high performance computing (hpc) cluster高性能计算集群。xcat 最先是为 ibm xseries 系列 linux cluster 做的第三方软件,现在power小型机的aix系统中也使用。它在简化集群管理的同时,还使集群能够方便地实现快速扩展,从而提高了系统管理员的工作效率。值得一提的是,xcat 软件是根据客户需求由korn shell,perl和expect等脚本语言编写,所以使用者修改代码后不需要重新再编译和安装,而是可以很方便地根据自己的需求直接修改脚本来定制出自己需要的 xcat 软件。xcat扮演着重要的角色,其主要功能如下 
    1,automated installation 自动化安装 
        
        --network booting with pxe or etherboot/grub 
        --red hat installation with kickstart 
        --other os installation using imaging or cloning 
        --nodes automatically configured 
        --errata automatically installed   
    2,hardware management and monitoring 
      ——supports the advanced system mangagement features in ibm@server xseries 
        --remote power control 
        --remote vital statistics(fan speed,temperatures,voltages) 
        --remote inventory(serial numbers,bios levels) 
        --hardware event logs 
        --hardware alerts via snmp 
 二、xcat的下载与安装 
    xcat对ibm客户来说是免费软件,我们可以从 下载,现最新版本为v2.7.4(2012年),对于cluster,我们首先需配置一台管理节点master node(此节点通过以太网交换机与其他cluster相连,用来管理其他计算节点,该管理节点集成了安装节点,管理节点,控制节点,用户节点的身份),前一篇我们也讲过。现我们通过该管理上安装xcat来管理集群中的其他计算机节点。其次是os,系统环境我们选择安装red hat enterprise linux 6。 
   1. 安装 xcat测试程序 
     (1)在管理节点上创建路径/root/xcat/,  将 te 指定版本的 xcat 安装文件拷贝到该路径,一共两个文件(一个程序包加一个依赖包) 
     (2)通过命令"tar -xvf"解开两个安装文件,如果安装包为压缩文件则使用"tar -jxvf" 
        #tar -xvf xcat-core-xxxxx.xxx 
         #tar -xvf xcat-dep-xxxxx.xxx 
     (3)执行指定的脚本,为xcat的安装设置文件依赖关系 
        #cd /root/xcat/xcat-core 
        #./mklocalrepo.sh 
        #cd /root/xcat/xcat-dep/rh5/x86_64 
        #./mklocalrepo.sh 
  
    (4)通过命令"rpm -ivh"安装xcat所必需的软件包(已知的有"net-snmp-perl",可以在redhat linux安装光盘的server目录下找到,安装时如果还提示需要安装其他依赖包,则根据提示安装相应的依赖包) 
    (5)按如下步骤开始安装xcat 
      #yum clean all 
      #yum install xcat .x86_64 
      #/etc/profile.d/xcat.sh 
      #source /etc/profile.d/xcat.sh 
  (6)验证xcat是否安装成功并正常启动执行几个常用的xcat命令,比如"tabdump site",如果这些命令能正常执行,则说明xcat已安装成功. 
  #tabdump –v   //查看xcat版本 
    version 2.7.4 (svn r13604,build thu may 21 11:11:11 edt 2012) 
三、xcat常用命 
    --nodeadd                      //adds nodes to the xcat cluster database                                       eg.nodeadd switch1 groups=switch 
    --nodels                         //lists the nodes,and their attributes from the xcat database                  eg.nodels all 
    --noderm                       //remove the nodes in the noderange from all database table                  eg.noderm node 
    --nodeset                      //set the boot state for a noderange                                           eg.nodeset node01 netboot 
    --nodestat                    //disply the running status of each node in a noderange                           eg.nodestat node01 
    --pping                        //parallel ping the nodes                                                              eg. pping node01 
    --pscp                         //parallel remote copy                                                                  eg.pscp /home/file node1:/home 
    --psh                          //psrallel remote shell                                                                  eg.psh node1 reboot 
    --prsync                      // parallel rsync                                                                                   eg.prsync -v 
    --reventlog                  //retrieve or clear remote hardware event logs                                   eg.reventlog node1 clear 
    --rinstall                      //begin installation on a noderange                                                eg.rinstall all|node01 
    --rinv                         //remote hardware inventory                                                         eg.rinv node1 all|mprom 
    --rpower                    //remote power control of nodes                                                  eg.rpower node1 on|off|reset 
    --wcons                    //windowed remote console                                                                 eg.wcons all –t 
    --winstall                   //begin installation on a noderange and disply in wcons                         eg.winstall node01 
    --tabdump                 //display an xcat database table in csv format                                        eg.tabdump site
    --tabedit                   //view an xcat database table in an editor and make changes                             eg.tabedit nodetype
    --tabrestore              //replaces the contents of an xcat database table with the contents in a csv file   eg.tabrestore site.csv
    --dumpxcatdb          //dumps the xcat db tables                                                                eg.dumpxcatdb –p /tmp/db 
    --restorexcatdb        //restores the xcat db tables                                                               eg.restorexcatdb –p /tmp/table 
四、xcat表 
xcat要管理其他cluster节点,就必须配置好各tab表,实现统一管理,下面简单讲一下xcat表描述,如下图示 
                                
 
                                  
                                  
        
                        
   由于各节点都是由以太网交换机所连接,交换机的各个port分别接在不同的node上并分配ip,因此还有一个很重要的switch表和一个hosts 表,其中hosts表用来为我们所添加管理的节点和交换机提供ip,hostname,而switch表用来为不同的计算节点指定交换机的网口,而交换机的网所对应的ip便由该表所指定。注意:tab表的配置根据实际情况配置,其中可设计到正则表达式的应用。此外还有chain表,用来记录各节点当前的状态。 
五、配置管理节点的服务 
 -remote logging 
 -snmp tftp nfs ntp ssh dns and dhcp 
 -conserver 
 -network booting 
 -kickstart 
六、管理节点管理cluster
      当管理节点配置好,xcat表也根据实际配置妥当,此时我们可以通过管理节点的dhcp服务为各计算节点分配ip(当然这些ip是在管理节点的table表中已经指定好了的,可在/etc/hosts中查看到),当各计算节点获取了管理节点所分配的ip,此时我们算是大功告成,现在可以通过管理节点来管理其他各计算节点了。
      本文并未对xcat详细的配置做讲解,大家可参考redbooks, 并可找两台以上的机器做实验。