Networking between Target and Initiator Nodes:
Edit '/etc/hosts':
Edit '/etc/hosts' of both the iSCSI Target(SAN) and iSCSI Initiator(RACNODE1) and add the following entries:
192.168.15.101 racnode1.sense.com racnode1
192.168.15.110 san.sense.com san
As shown below:


Ping Target and Initiator:
Ping initiator node from target node and vice-versa.
[root@san ~]# ping -c2 racnode1

[root@racnode1 ~]# ping -c2 san

Configure the Shared Storage on SAN (iSCSI Target):
Install scsi-target-utils package:
[root@san ~]# rpm -qa | grep scsi-target-utils*

If the package is not installed then install the above mentioned package.
Prepare shared storage:
For demonstration purposes, /dev/sdb1 is created and will be shared via iSCSI.
fdisk:
[root@san ~]# fdisk -l

Use fdisk to prepare the partition (/dev/sdb1). Create a new primary partition and save changes.
Don't make any filesystem on this partition.
[root@san ~]# fdisk /dev/sdb

[root@san ~]# fdisk -l

Volumegroup Creation:
[root@san ~]# pvcreate /dev/sdb1
[root@san ~]# vgcreate vg_racdb /dev/sdb1

[root@san ~]# vgdisplay

For the demonstration purpose, we shall create three logical volumes ( 3GB , 21GB , 20GB ). These partitions will be shared to the initiator node(s).
[root@san ~]# lvcreate -n lv_crs -L 3G vg_racdb
[root@san ~]# lvcreate -n lv_data -L 21G vg_racdb
[root@san ~]# lvcreate -n lv_fra -L 20G vg_racdb

[root@san ~]# lvdisplay



Edit the iSCSI target configuration file:
Edit the iSCSI target configuration file, '/etc/tgt/targets.conf'. Add the target and define the initiators for the target.
[root@san ~]# vim /etc/tgt/targets.conf


Add entries for the three volumegroups created above in the 'targets.conf' file.
#Added for Shared SAN Storage
<target iqn.2012-12.com.sense.com:san.lun0>
backing-store /dev/mapper/vg_racdb-lv_crs
initiator-address 192.168.15.101
</target>
<target iqn.2012-12.com.sense.com:san.lun1>
backing-store /dev/mapper/vg_racdb-lv_data
initiator-address 192.168.15.101
</target>
<target iqn.2012-12.com.sense.com:san.lun2>
backing-store /dev/mapper/vg_racdb-lv_fra
initiator-address 192.168.15.101
</target>
Start tgtd Service:
[root@san ~]# chkconfig tgtd on
This enables the tgtd service to start at the system boot.
[root@san ~]# service tgtd restart
[root@san ~]# service tgtd status

[root@san ~]# tgtadm --lld iscsi --mode target --op show



Configure the Shared Storage (iSCSI Initiator):
Install scsi-target-utils package:
Install iscsi-initiator-utils package, on the initiator node(s).
[root@racnode1 ~]# rpm -qa | grep scsi-target-utils*

chkconfig and start iscsid and iscsi services:
[root@racnode1 ~]# chkconfig iscsid on
[root@racnode1 ~]# chkconfig iscsi on
[root@racnode1 ~]# service iscsi stop
[root@racnode1 ~]# service iscsid stop
[root@racnode1 ~]# service iscsid start
[root@racnode1 ~]# servie isci start
Use iscsiadm to query the target:
Use iscsiadm to query the target ( use the ip address ).
[root@racnode1 ~]# iscsiadm --mode discovery --type sendtargets --portal192.168.15.110

Connect to shared storage from client Node (iSCSI Initiator):
[root@racnode1 ~]# cat /proc/partitions

[root@racnode1 ~]# iscsiadm --mode node --targetname iqn.2012-12.com.sense.com:san.lun0 --portal 192.168.15.110 --login
[root@racnode1 ~]# iscsiadm --mode node --targetname iqn.2012-12.com.sense.com:san.lun1 --portal 192.168.15.110 --login
[root@racnode1 ~]# iscsiadm --mode node --targetname iqn.2012-12.com.sense.com:san.lun2 --portal 192.168.15.110 --login

Verify that there is new block devices available on the client node (initiator).
[root@racnode1 ~]# cat /proc/partitions

This finishes the task of shared disk configuration for RHEL Servers using iSCSI Technology. Now we can create filesystem on these devices(sdb,sdc,sdd) as per our requirement. If we have more than one iSCSI Initiators(Clients) then we should repeat the above steps for all the Initiator nodes.
本文详细介绍了如何在RHEL服务器上使用iSCSI技术配置共享磁盘,包括目标节点和发起节点之间的网络设置、共享存储的创建及客户端连接等关键步骤。

被折叠的 条评论
为什么被折叠?



