RedHatAdvancedServer2.1集群配置

发表于:2007-07-04来源:作者:点击数: 标签:
一. 宿主计算机硬件配置 P4 1.7G 384m内存 winxp系统 二. 虚拟硬件环境 两台vmware gsx server下安装的RedHat Advanced Server 2.1 主机1:主机名 linux one,网卡配置 ----------172.16.1.1(外部联网),1.1.1.1(心跳线)。 主机2:主机名 linuxtwo 网卡

  一. 宿主计算机硬件配置
  P4 1.7G 384m内存 winxp系统
  
  二. 虚拟硬件环境
  两台vmware gsx server下安装的RedHat Advanced Server 2.1
  主机1:主机名linuxone,网卡配置 ----------172.16.1.1(外部联网),1.1.1.1(心跳线)。
  主机2:主机名 linuxtwo 网卡配置 ----------172.16.1.2(外部联网),1.1.1.2(心跳线)。
  
  三. 系统安装
  所需软件:vmware-gsx-server-installer-2.5.1-5336.exe
  RedHat Advanced Server 2.1
  
  安装步骤:
  1. 安装vmware-gsx-server-installer-2.5.1-5336.exe后,在vmware中新建虚拟机(分配内存128M)并保存在d:\zhongguochun\linuxad1,用redhat光盘安装RedHat Advanced Server 2.1,为了加快安装,你可以在boot:后面输入text进入文本安装模式。别的地方不说了。在选择安装类型那里选择custom,然后在包列表那里要选择上kernel source.
  主机名设置为linuxone,ip地址设置为172.16.1.1 255.255.0.0
  2. ……….中间省略n多过程
  3. 安装完成
  4. 在d:\zhongguochun目录下新建目录linuxad2,并将d:\zhongguochun\linuxad1里面刚才安装好的虚拟操作系统复制一份到linuxad2
  这样子,我们就得到了两个虚拟的RedHat Advanced Server 2.1了,当然,他们是一样的,我们需要进行些修改。
  5. 进入d:\zhongguochun\linuxad2,用写字板打开linux.vmx,修改displayName = "Linuxad1"为displayName = "Linuxad2",这样子,在vmware控制台,你就看到两个不同的名字了。尽管如此,如果你同时启动两个虚拟机,这两个虚拟系统还是一样的,所以,我们需要修改他们的ip地址,主机名字等。
  6. 将linuxad2目录中的系统启动,修改主机名字
  #vi /etc/sysconfig/network
  将HOSTNAME=linuxone改为HOSTNAME=linuxtwo
  接下来修改ip地址:
  #vi /etc/sysconfig/network-scripts/ifcfg-eth0
  将IPADDR=172.16.1.1改为IPADDR=172.16.1.2
  改了名字,别忘记修改/etc/hosts哟
  #vi /etc/hosts
  加入
  172.16.1.2 linuxtwo
  7.Power off 这个虚拟机,这个样子,我们就得到了两个不同的系统拉,一个是linuxone,位于d:\zhongguochun\linuxad1,一个是linuxtwo 位于d:\zhongguochun\linuxad1
  
  一.添加硬件
  在两个系统都power off的状态下。我们需要分别给两个系统添加一块网卡,还要添加一个共享磁盘
  1.用vmware 打开linuxone,注意不是power on 哦。在setting菜单下选择configuration edtior
  ,点击add,添加一块网卡,这个就不需要讲了吧。还需要添加一个虚拟磁盘,还是点add,硬件类型是Hard disk,然后”Creat a new virtual disk”,大小我分配了0.5G,并选择上下面的“Allocate all disk space”.下一步是给共享磁盘起名字叫”sharedisk.pln”,然后确定。这样子就添加好了。
  2.用vmware 打开linuxtwo,注意不是power on 哦。同样添加一块网卡。接着添加虚拟磁盘,这次是”Use an existing virtual disk”,然后选择我们刚才在linuxone中创建的sharedisk.pln,按照提示就可以了。
  3.磁盘和网卡都添加好了。这里,还需要注意,由于vmware中的系统启动后会锁定磁盘,所以当你启动linuxone后共享磁盘被锁定了,你的linuxtwo就起不来了。因此,我们需要处理一下先。首先,到d:\zhongguochun\linuxad1下,用写字板打开linux.vmx,在最后一行加入
  Disk.locking = false
  然后到d:\zhongguochun\linuxad2,同样修改linux.vmx, 在最后一行加入
  Disk.locking = false
  保存退出。
  4.好了,到此为止,两个系统的硬件都配置好了呀
  
  注:最好在Configuration editor 里面修改共享磁盘的”Vitual disk node”为scsi 1:0
  
  二.为我们新添加的网卡配置ip地址先
  1.Power On linuxone,启动过程中kudzu就会检测到新网卡,但是尽管你选择配置新网卡,启动完成后,
  #ifconfig
  还是只显示一块网卡的。所以,我们需要执行下面的命令拉
  #cp /etc/sysconfig/network-scripts/ifcfg-eth0 /etc/sysconfig/network-scripts/ifcfg-eth1
  #vi /etc/sysconfig/network-scripts/ifcfg-eth1
  将里面的ip地址和mask改为:1.1.1.1 255.0.0.0
  #service network restart
  #ifconfig
  显示两块网卡的正确配置拉。
  2.同时Power On linuxtwo
  #cp /etc/sysconfig/network-scripts/ifcfg-eth0 /etc/sysconfig/network-scripts/ifcfg-eth1
  #vi /etc/sysconfig/network-scripts/ifcfg-eth1
  将里面的ip地址和mask改为:1.1.1.2 255.0.0.0
  #service network restart
  #ifconfig
  显示两块网卡的正确配置拉。
  
  三.修改两主机/etc/hosts
  #vi /etc/hosts
  172.16.1.1 linuxone
  172.16.1.2 linuxtwo
  1.1.1.1 linuxone
  1.1.1.2 linuxtwo
  172.16.1.3 redhatcluster
  注意,最后一个ip是集群管理用
  
  四。集群配置
  (一)配置我们的共享磁盘
  1. 切换到linuxone
  #fdisk /dev/sdb
  创建250m /dev/sdb1
  250m /dev/sdb2
  
  在两台服务器上分别编辑/etc/sysconfig/rawdevices文件,以便将分区绑定到裸设备。
  #vi /etc/sysconfig/rawdevices
  加入
  /dev/raw/raw1 /dev/sdb1
  /dev/raw/raw2 /dev/sdb2
  重启服务
  #service rawdevices restart
  看了些文档说要
  #cludiskutil –p验证Quoram分区
  我这里显示没有/etc/cluster.conf
  不过,不管它。
  2.切换到linuxtwo做同样的操作
  
  (二)配置集群
  切换到linuxone
  #/sbin/cluconfig
  你将看到以下输出:
  
  Enter cluster name [Cluster]:redhatcluster
  Enter IP address for cluster alias [x.x.x.x]: 172.16.1.1
  --------------------------------
  Information for Cluster Member 0
  --------------------------------
  Enter name of cluster member [linuxone]: linuxone
  Looking for host one (may take a few seconds)...
  Enter number of heartbeat channels (minimum = 1) [1]: 1
  Information about Channel 0
  Channel type: net or serial [net]:
  Enter hostname of the cluster member on heartbeat channel 0 \
  [linnuxone]: linnuxone
  Looking for host linnuxone (may take a few seconds)...
  Information about Quorum Partitions
  Enter Primary Quorum Partition [/dev/raw/raw1]: /dev/raw/raw1
  Enter Shadow Quorum Partition [/dev/raw/raw2]: /dev/raw/raw2
  Information About the Power Switch That Power Cycles Member ’ linnuxone’
  Choose one of the following power switches:
  o NONE
  o RPS10
  o BAYTECH
  o APCSERIAL
  o APCMASTER
  o WTI_NPS
  Power switch [NONE]: NONE
  
  Information for Cluster Member 1
  --------------------------------
  Enter name of cluster member [linuxtwo]: linuxtwo
  Looking for host linuxtwo (may take a few seconds)...
  Information about Channel 0
  Enter hostname of the cluster member on heartbeat channel 0 \
  [linuxtwo]: linuxtwo
  Looking for host linuxtwo (may take a few seconds)...
  Information about Quorum Partitions
  Enter Primary Quorum Partition [/dev/raw/raw1]: /dev/raw/raw1
  Enter Shadow Quorum Partition [/dev/raw/raw2]: /dev/raw/raw2
  Information About the Power Switch That Power Cycles Member ’ linuxtwo’
  Choose one of the following power switches:
  o NONE
  o RPS10
  o BAYTECH
  o APCSERIAL
  o APCMASTER
  o WTI_NPS
  Power switch [NONE]: NONE
  
  .
  .
  .
  省略部分输出--------------------
  Member 0 Information
  --------------------
  Name: linuxone
  Primary quorum partition: /dev/raw/raw1
  Shadow quorum partition: /dev/raw/raw2
  Heartbeat channels: 1
  Channel type: net, Name: linuxone
  Power switch IP address or hostname:linuxone
  --------------------
  Member 1 Information
  --------------------
  Name: linuxtwo
  Primary quorum partition: /dev/raw/raw1
  Shadow quorum partition: /dev/raw/raw2
  Heartbeat channels: 1
  Channel type: net, Name: linuxtwo
  Save the cluster member information? yes/no [yes]:
  Writing to configuration file...done
  Configuration information has been saved to /etc/cluster.conf.
  ----------------------------
  Setting up Quorum Partitions
  ----------------------------
  Running cludiskutil -I to initialize the quorum partitions: done
  Saving configuration information to quorum partitions: done
  Do you wish to allow remote monitoring of the cluster? yes/no \
  [yes]: yes
  ----------------------------------------------------------------
  Configuration on this member is complete.
  To configure the next member, invoke the following command on that system:
  # /sbin/cluconfig --init=/dev/raw/raw1
  See the manual to complete the cluster installation
  
  3.切换到linuxtwo
  #cluconfig --init=/dev/raw/raw1
  ………显示好多东西。。。直到出现
  Press to continue. --按回车继续
  ………又是好多东西,直到出现
  Save the cluster member information? yes/no [yes]: --回车继续
  ………最后的总结信息
  Configuration on this member is complete.
  Execute "/sbin/service cluster start" to start the cluster software.
  
  4.启动Cluster服务
  在linuxone上,linuxtwo上依次
  #service cluster start
  回到linuxone
  #cluadmin
  
  cluadmin>cluster status
  显示集群的两个节点
  Linuxone,linuxtwo的状态都是up,good

原文转自:http://www.ltesting.net