티스토리 뷰

 

Centos multipathd 데몬을 통한 iSCSI Storage Multipath 설정

 

[root@iSCSI-TEST ~]#
[root@iSCSI-TEST ~]#
[root@iSCSI-TEST ~]# for LIST in `ifconfig -a | grep eth | awk '{print $1}'`; do echo "${LIST} - `ethtool ${LIST} | grep 'Link detected'`"; done
eth0 - Link detected: yes
eth1 - Link detected: yes
eth2 - Link detected: yes
eth3 - Link detected: yes
[root@iSCSI-TEST ~]#
[root@iSCSI-TEST ~]#
[root@iSCSI-TEST ~]#
[root@iSCSI-TEST ~]#
[root@iSCSI-TEST ~]# route -n
Kernel IP routing table
Destination Gateway Genmask Flags Metric Ref Use Iface
192.168.20.0 0.0.0.0 255.255.255.128 U 0 0 0 eth2
192.168.20.128 0.0.0.0 255.255.255.128 U 0 0 0 eth1
192.168.10.0 0.0.0.0 255.255.255.0 U 0 0 0 eth3
172.27.0.0 0.0.0.0 255.255.0.0 U 0 0 0 eth0
0.0.0.0 172.27.0.1 0.0.0.0 UG 0 0 0 eth0
[root@iSCSI-TEST ~]#
[root@iSCSI-TEST ~]#
root@iSCSI-TEST ~]#
[root@iSCSI-TEST ~]# vi /etc/iscsi/initiatorname.iscsi
InitiatorName=iqn.2013-11.com.helperchoi:node01
[root@iSCSI-TEST ~]#
[root@iSCSI-TEST ~]#
[root@iSCSI-TEST ~]#
[root@iSCSI-TEST ~]#
[root@iSCSI-TEST ~]# vi /etc/iscsi/iscsid.conf
node.session.timeo.replacement_timeout = 30
node.session.timeo.noopout_timeout = 5
node.session.timeo.noopout_interval = 5
[root@iSCSI-TEST ~]#
[root@iSCSI-TEST ~]#
[root@iSCSI-TEST ~]#
[root@iSCSI-TEST ~]#
[root@iSCSI-TEST ~]# service iscsi restart
iscsiadm: No matching sessions found
Stopping iSCSI daemon: iscsiadm: can not connect to iSCSI daemon (111)!
iscsiadm: initiator reported error (20 - could not connect to iscsid)
iscsiadm: Could not stop iscsid. Trying sending iscsid SIGTERM or SIGKILL signals manually


iscsid is stopped [ OK ]
Starting iSCSI daemon: [ OK ]
[ OK ]
Setting up iSCSI targets: iscsiadm: No records found
[ OK ]
[root@iSCSI-TEST ~]#
[root@iSCSI-TEST ~]#
[root@iSCSI-TEST ~]# service iscsid restart
Stopping iSCSI daemon:
Starting iSCSI daemon: [ OK ]
[ OK ]
[root@iSCSI-TEST ~]#
[root@iSCSI-TEST ~]#
[root@iSCSI-TEST ~]#
[root@iSCSI-TEST ~]#
[root@iSCSI-TEST ~]#
[root@iSCSI-TEST ~]# iscsiadm -m discovery -t st -p 192.168.20.1
192.168.20.1:3260,1 iqn.2013-11.com.helperchoi:rsd.d10h.m.131122.0a002
[root@iSCSI-TEST ~]#
[root@iSCSI-TEST ~]#
[root@iSCSI-TEST ~]# iscsiadm -m discovery -t st -p 192.168.20.129
192.168.20.129:3260,1 iqn.2013-11.com.helperchoi:rsd.d10h.m.131122.1a002
[root@iSCSI-TEST ~]#
[root@iSCSI-TEST ~]#
[root@iSCSI-TEST ~]#
[root@iSCSI-TEST ~]# iscsiadm -m node -p 192.168.20.1:3260 -T iqn.2013-11.com.helperchoi:rsd.d10h.m.131122.0a002 --login
Logging in to [iface: default, target: iqn.2013-11.com.helperchoi:rsd.d10h.m.131122.0a002, portal: 192.168.20.1,3260] (multiple)
Login to [iface: default, target: iqn.2013-11.com.helperchoi:rsd.d10h.m.131122.0a002, portal: 192.168.20.1,3260] successful.
[root@iSCSI-TEST ~]#
[root@iSCSI-TEST ~]#
[root@iSCSI-TEST ~]# iscsiadm -m node -p 192.168.20.129:3260 -T iqn.2013-11.com.helperchoi:rsd.d10h.m.131122.1a002 --login
Logging in to [iface: default, target: iqn.2013-11.com.helperchoi:rsd.d10h.m.131122.1a002, portal: 192.168.20.129,3260] (multiple)
Login to [iface: default, target: iqn.2013-11.com.helperchoi:rsd.d10h.m.131122.1a002, portal: 192.168.20.129,3260] successful.
[root@iSCSI-TEST ~]#
[root@iSCSI-TEST ~]#
[root@iSCSI-TEST ~]#
[root@iSCSI-TEST ~]#
[root@iSCSI-TEST ~]# iscsiadm -m session
tcp: [1] 192.168.20.1:3260,1 iqn.2013-11.com.helperchoi:rsd.d10h.m.131122.0a002
tcp: [2] 192.168.20.129:3260,1 iqn.2013-11.com.helperchoi:rsd.d10h.m.131122.1a002
[root@iSCSI-TEST ~]#
[root@iSCSI-TEST ~]#
[root@iSCSI-TEST /]#
[root@iSCSI-TEST /]# vi /etc/multipath.conf ## HITACHI Storage 예시
[root@iSCSI-TEST /]#

 

blacklist {
        devnode "^xvda[0-9]"
}


defaults {
 user_friendly_names yes
}

devices {
 device {
  vendor   "HITACHI"
  product   "DF600F"
  path_grouping_policy multibus
  path_checker  "round-robin 0"
  hardware_handler "0"
 }
}

 

[root@iSCSI-TEST /]#
[[root@iSCSI-TEST ~]#
[root@iSCSI-TEST /]# modprobe dm-multipath
[root@iSCSI-TEST /]#
[root@iSCSI-TEST /]#
[root@iSCSI-TEST /]# modprobe -l | grep dm-multi
/lib/modules/2.6.18-164.el5xen/kernel/drivers/md/dm-multipath.ko
[root@iSCSI-TEST /]#
[root@iSCSI-TEST /]#
[root@iSCSI-TEST /]# service multipathd start
Starting multipathd daemon: [ OK ]
[root@iSCSI-TEST /]#
[root@iSCSI-TEST /]#
[root@iSCSI-TEST /]# chkconfig --level 35 multipathd on
[root@iSCSI-TEST /]#
[root@iSCSI-TEST /]#
[root@iSCSI-TEST ~]#
[root@iSCSI-TEST ~]# multipath -v2
[root@iSCSI-TEST ~]#
[root@iSCSI-TEST ~]# multipath -ll
mpath0 (360060e801005e910052fbb4100000000) dm-0 HITACHI,DF600F
[size=800G][features=0][hwhandler=0][rw]
\_ round-robin 0 [prio=2][active]
\_ 0:0:0:0 sda 8:0 [active][ready]
\_ 1:0:0:0 sdb 8:16 [active][ready]
[root@iSCSI-TEST ~]#
[root@iSCSI-TEST ~]#
[root@iSCSI-TEST ~]#
[root@iSCSI-TEST ~]#
[root@iSCSI-TEST ~]# ls -l /dev/mpath/
합계 0
lrwxrwxrwx 1 root root 7 11월 21 13:05 mpath0 -> ../dm-0
[root@iSCSI-TEST ~]#
[root@iSCSI-TEST ~]#
[root@iSCSI-TEST ~]# dmsetup info /dev/mpath/mpath0
Name: mpath0
State: ACTIVE
Read Ahead: 256
Tables present: LIVE
Open count: 0
Event number: 0
Major, minor: 253, 0
Number of targets: 1
UUID: mpath-360060e801005e910052fbb4100000000

[root@iSCSI-TEST ~]#
[root@iSCSI-TEST /]#
[root@iSCSI-TEST /]# mkdir -p /Data
[root@iSCSI-TEST /]#
[root@iSCSI-TEST ~]#
[root@iSCSI-TEST ~]#
[root@iSCSI-TEST ~]# mkfs.ext3 /dev/mpath/mpath0
mke2fs 1.39 (29-May-2006)
Filesystem label=
OS type: Linux
Block size=4096 (log=2)
Fragment size=4096 (log=2)
104857600 inodes, 209715200 blocks
10485760 blocks (5.00%) reserved for the super user
First data block=0
Maximum filesystem blocks=4294967296
6400 block groups
32768 blocks per group, 32768 fragments per group
16384 inodes per group
Superblock backups stored on blocks:
32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632, 2654208,
4096000, 7962624, 11239424, 20480000, 23887872, 71663616, 78675968,
102400000

Writing inode tables: done
Creating journal (32768 blocks): done
Writing superblocks and filesystem accounting information:
done

This filesystem will be automatically checked every 21 mounts or
180 days, whichever comes first. Use tune2fs -c or -i to override.
[root@iSCSI-TEST ~]#
[root@iSCSI-TEST ~]#
[root@iSCSI-TEST ~]#
[root@iSCSI-TEST ~]#
[root@iSCSI-TEST ~]# mount -t ext3 /dev/mpath/mpath0 /Data
[root@iSCSI-TEST ~]#
[root@iSCSI-TEST ~]#
[root@iSCSI-TEST ~]# touch /Data/aaa
[root@iSCSI-TEST ~]#
[root@iSCSI-TEST ~]#
[root@iSCSI-TEST ~]# ls -l /Data/
합계 16
-rw-r--r-- 1 root root 0 11월 21 13:14 aaa
drwx------ 2 root root 16384 11월 21 13:13 lost+found
[root@iSCSI-TEST ~]#
[root@iSCSI-TEST ~]#
[root@iSCSI-TEST ~]#
[root@iSCSI-TEST ~]# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/xvda2 20G 791M 18G 5% /
/dev/xvda6 20G 2.7G 16G 15% /usr
/dev/xvda5 20G 259M 19G 2% /var
/dev/xvda3 30G 14G 15G 49% /home
/dev/xvda1 996M 41M 904M 5% /boot
tmpfs 1.0G 0 1.0G 0% /dev/shm
/dev/dm-0 788G 197M 748G 1% /Data
[root@iSCSI-TEST ~]#
[root@iSCSI-TEST ~]#
[root@iSCSI-TEST ~]#
[root@iSCSI-TEST ~]#
[root@iSCSI-TEST ~]# iscsiadm -m session
tcp: [1] 192.168.20.1:3260,1 iqn.2013-11.com.helperchoi:rsd.d10h.m.131122.0a002
tcp: [2] 192.168.20.129:3260,1 iqn.2013-11.com.helperchoi:rsd.d10h.m.131122.1a002
[root@iSCSI-TEST ~]#
[root@iSCSI-TEST ~]#
[root@iSCSI-TEST /]#
[root@iSCSI-TEST ~]#
[root@iSCSI-TEST ~]# watch -n 1 -d 'multipath -ll'
[root@iSCSI-TEST ~]#
Every 1.0s: multipath -ll Mon Nov 25 14:47:00 2013

mpath0 (360060e801005e910052fbb4100000000) dm-0 HITACHI,DF600F
[size=800G][features=0][hwhandler=0][rw]
\_ round-robin 0 [prio=2][active]
\_ 0:0:0:0 sda 8:0 [active][ready]
\_ 1:0:0:0 sdb 8:16 [active][ready]


 

반응형
반응형
최근에 올라온 글
최근에 달린 댓글
Total
Today
Yesterday