星期二, 1月 08, 2008

Use iscsi driver to integrate NAS storage in Linux system

##### Environment Settings############
OS: RedHat AS2.1 u5
Kernel: 2.4.9-e.49smp
rpm file: clumanager-1.0.27-1

node1 --> 10.1.1.101
node2 --> 10.1.1.102
Service IP --> 10.1.1.254 (Public IP)
################################

#### iSCSI settings with NAS Storage #########
Install NAS with linux-iscsi-.tgz from http://sourceforge.net/index.php
uncompress the file and into the iscsi directory
make
make install
Do next 3 steps

#vi /etc/iscsi.conf
----------------------------------------------------------------------
DiscoveryAddress=10.1.1.1:3260 --> your NAS' IP and port number
----------------------------------------------------------------------

#vi /etc/initiatorname.iscsi
----------------------------------------------------------------------------
InitiatorName=host1--> your NAS’ share hosts name
---------------------------------------------------------------------------

#/etc/init.d/iscsi start
You should find out your NAS share disk in /proc/partition as /dev/sda
##########################################



####### raw devices settings ##########
fdisk /dev/sda as /dev/sda1 and /dev/sda2
***Don't use mke2fs or something to format these 2 partition.***
Modify /etc/sysconfig/rawdevices file to add:
/dev/raw/raw1 /dev/sda1
/dev/raw/raw2 /dev/sda2
/etc/rc.d/init.d/rawdevices start
Until now your 2 raw devices are workable.
##########################################


########## Cluster HA settings #########
You can use relative softwares like clu* to manage cluster members.
*** The sample settings below focus on node1, if you use node2 will be reversed.
#cluconfig
Enter cluster name: ha1
Enter IP address for cluster alias: 10.1.1.254 --> This is your service IP, NOT real IP for NIC.
---- Next step is configure your Member 0 --> yourself ----
Enter name of cluster member: node1
Enter number of heartbeat channels:1 --> We only use 1 NIC to connect to another node
Channel type:net
Enter hostname of the cluster member on heartbeat channel 0: node1
---- Next step is configure your raw devices ----
Enter Primary Quorum Partition: /dev/raw/raw1 --> such as your raw devices list in /etc/sysconfig/rawdevices
Enter Shadow Quorum Partition: /dev/raw/raw2 --> such as your raw devices list in /etc/sysconfig/rawdevices
Power switch: NONE

---- Next step is configure your Member 1 --> node2 ----
Enter name of cluster member: node2
Enter hostname of the cluster member on heartbeat channel 0: node2
---- Next step is configure its raw devices ----
Enter Primary Quorum Partition: /dev/raw/raw1 --> such as its raw devices list in /etc/sysconfig/rawdevices
Enter Shadow Quorum Partition: /dev/raw/raw2 --> such as its raw devices list in /etc/sysconfig/rawdevices
Power switch: NONE

*** It will save your configuration in /etc/cluster.conf
Remember if you want to remove the cluster.rpm file, delete the /etc/cluster.conf after you remove.
########################################


Now you can use ifconfig to show your NIC information.
It should add a virtual IP address eth0:0 as 10.1.1.254. --> Your service IP is in eth0:0.


Test procedure
1. Shutdown the node2 directly (power off).
2. Use ifconfig in node1 to observe if its NIC will add a eth0:0 directly.
3. It should less than 30 sec and under my testing is 15 sec.



Reference site:
http://www.redhat.com/docs/manuals/enterprise/RHEL-AS-2.1-Manual/cluster-manager/

沒有留言: