In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-03-28 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/01 Report--
This article will explain in detail how to configure iSCSI storage and multi-path functions in Linux environment. The content of the article is of high quality, so the editor will share it with you for reference. I hope you will have some understanding of the relevant knowledge after reading this article.
one。 Overview
Large storage is encountered in the work, and multi-partition mount linux appears multi-path. According to this article, the method and steps of installation and configuration of iSCSI storage device connection under Linux OS environment are introduced, especially the Mutipath multi-path function provided by Linux operating system is one of the main options under Linux platform, which is mainly introduced and described in this article.
II. Steps and methods of installation and configuration
2.1 client installs iSCSI package
(1) the server installs the iscsi initiator package. The installation package is found on the OS installation CD. The success of the installation can be confirmed by the following command line
[root@localhost ~] # rpm-qa | grep iscsi
Iscsi-initiator-utils-6.2.0.872-10.el5
(2) under / etc/iscsi/ directory / etc/iscsi/initiatorname.iscsi
View this file to find the iqn number on the host side. It is needed when adding HOST to the magnetic array management software.
2.2 dividing disk array disk space
After configuring the RAID on the disk array based on the disk array device manual, and successfully mapping the LUN to the server, it is necessary to plan and use the disk space reasonably according to the application needs.
Disk array configuration steps and methods vary from device to device and need to be configured and used according to the corresponding equipment manual.
2.3 start the iSCSI device
(1) on the server side, start the ISCSI service:
[root@localhost ~] # service iscsi start
(2) query the iqn number of ISCSI device (HP storageworks P2000G3) target: (required)
[root@localhost] # iscsiadm-m discovery-t sendtargets-p 192.168.100.102
192.168.100.102purl 3260 iqn.1986-03.com.hp:storage.p2000g3.114513bbf6
(3) Log in to iSCSI storage device
[root@localhost] # iscsiadm-m node-T iqn.1986-03.com.hp:storage.p2000g3.114513bbf6-p
192.168.100.102pur3260-l
Where the iqn number is the number obtained by the above query, and ip is the address mapped to the iscsi port in the iscsi storage.
(4) View the disk:
[root@localhost ~] # fdisk-l
Disk / dev/cciss/c0d0: 146.7 GB, 146778685440 bytes
255 heads, 32 sectors/track, 35132 cylinders
Units = cylinders of 8160 * 512 = 4177920 bytes
Disk / dev/sda: 10999.9 GB, 10999999954944 bytes
255 heads, 63 sectors/track, 1337340 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Disk / dev/sda doesn't contain a valid partition table
Disk / dev/sdb: 10999.9 GB, 10999999954944 bytes
255 heads, 63 sectors/track, 1337340 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Disk / dev/sdb doesn't contain a valid partition table
(5) add the target of another ISCSI path in the same way.
(description: an ISCSI port of an iSCSI array has an iqn number and an ip address)
Fdisk-l should see two drive letters after the addition is successful. They all have the same capacity. These two drive letters correspond to the same LUN under the same disk array.
(6) after the mapping is completed, use the following command to view the mapping result:
[root@localhost] # iscsiadm-m node
192.168.100.102purl 3260 iqn.1986-03.com.hp:storage.p2000g3.114513bbf6
192.168.100.101purl 3260 iqn.1986-03.com.hp:storage.p2000g3.114513bbf6
2.4 install the DM-multipath package
Due to the need for multipath access and failover of storage devices, you need to run the multipath service, which is already installed in os. If the following command is not carried out. The principle of Multipath service is that a real virtual disk in an iSCSI array is mapped through ports connected to two redundant array controllers, so two physical disks can be seen on the server, but this disk corresponds to a real virtual disk, so failover and load balancing can be achieved between the two paths.
Rpm-ivh device-mapper-1.02.13-6.9.i686.rpm
Rpm-ivh multipath-tools-0.4.7-34.18.i686.rpm
After the installation is complete, use the command modprobe dm_multipath to load the appropriate module, and you can use the following command to check that the installation is normal:
Lsmod | grep dm_multipath
2.5 modification and creation of configuration files
(1) / etc/multipath.conf is the configuration file of multipath software, most of which are commented out. You can save it as a backup, and then create a new multipath.conf file and edit the new configuration file. What is actually useful are the following parameters: the rest of the parameters can be commented out:
Defaults {
User_friendly_names yes
Udev_dir / dev
Path_grouping_policy multibus
Failback immediate
No_path_retry fail} Save exit
(2) start the service:
After Service multipathd restart starts successfully, we will see the following directory under the dev directory:
/ dev/mapper/mpathn
/ dev/mpath/mpathn
/ dev/dm-n.
Description:
① / dev/mapper/mpathn is a multipath device virtualized by software, which can be used for mounting.
② / dev/mpath/mpathn this is created by udev device Manager and cannot be used for mounting.
③ / dev/dm-n is used by the software itself and cannot be used outside the software. Cannot be mounted.
(3) use the multipath-ll command to see the two active paths, and the relationship between them is the relationship between them. If one of the lines is disconnected, the system automatically switches to the other.
[root@localhost ~] # multipath-ll
Mpath3 (3600508b4000a5bfd0000b00000200000) dm-2 HP,P2000G3
[size=2.0T] [features=0] [hwhandler=0]
\ _ round-robin 0 [prio=2] [active]
\ _ 1 sdd 8:48 [active] [ready]
\ _ 2 sdf 8:80 [active] [ready]
Mpath2 (3600508b4000a5bfd0000b000001a0000) dm-1 HP,P2000G3
[size=2.0T] [features=0] [hwhandler=0]
\ _ round-robin 0 [prio=2] [active]
\ _ 1 sdb 8:16 [active] [ready]
\ _ 2 sdc 8:32 [active] [ready]
Mpath4 (3600508b4000a5bfd0000b00000350000) dm-3 HP,HSV300
[size=2.0T] [features=0] [hwhandler=0]
\ _ round-robin 0 [prio=2] [active]
Sde 8:64 [active] [ready]
\ _ 2 sdg 8:96 [active] [ready]
Description: the above blue font is the magnetic array manufacturer and product model identification, different manufacturers and different models of products related information will be different.
(4) after the multipath device is created, we can use the multipath device just like the actual physical device. The premise is that it needs to be marked as a physical volume with the following command. Pvcreate / dev/mapper/mpath2
(5) then partition and format the disk
Fdisk / dev/mapper/mpath2
After the partition, a new block device is created in the dev/mapper/ directory
/ dev/mapper/mpath2p1 this represents partition 1 under the mpath2 device.
If you don't see it or don't match, you need to use the multipath-F command to clear the cache information for the multipath device, and then reload it with the command multipath-v3.
After the partition, use the fdisk-l command to look at the disk and you will see that there is already partition information under the dm-1 disk.
Disk / dev/dm-1: 10982.1 GB, 10982198870016 bytes
255 heads, 63 sectors/track, 1335176 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Disk / dev/dm-1 doesn't contain a valid partition table
Mkfs.ext3 / dev/mapper/mpath0p1
(6) finally, mount the disk mount so that it can be used normally.
(7) set the multipathd service to boot automatically
Chkconfig multipathd on
(8) other points for attention:
① deletes invalid iscsi connections: if an iscsi correspondence is created due to misconfiguration and other reasons, the system will not delete it automatically and needs to delete it manually. For example:
[root@localhost] # iscsiadm-m node
192.168.1.252 3260 iqn.1986 3-03.com.hp:storage.p2000g3.114513bbf6
We can see that there is an iscsi correspondence above, but in practice, this correspondence has been invalidated and the system will not delete it automatically.
② delete naming:
Iscsiadm-m node-o delete-T iqn.1986-03.com.hp:storage.p2000g3-p 192.168.1.252 purl 3260
③ if one of the links fails, we can see similar information in the log as follows:
[root@localhost ~] # tail / var/log/messages
Dec 12 14:03:15 bhnfs1 kernel: iscsi: cmd 0x28 is not queued (8)
Dec 12 14:03:15 bhnfs1 kernel: iscsi: cmd 0x28 is not queued (8)
Dec 12 14:03:15 bhnfs1 multipathd: sdf: readsector0 checker reports path is down
Dec 12 14:03:15 bhnfs1 multipathd: sdg: readsector0 checker reports path is down
Dec 12 14:03:20 bhnfs1 kernel: iscsi: cmd 0x28 is not queued (8)
Dec 12 14:03:20 bhnfs1 multipathd: sdc: readsector0 checker reports path is down
Dec 12 14:03:20 bhnfs1 kernel: iscsi: cmd 0x28 is not queued (8)
Dec 12 14:03:20 bhnfs1 multipathd: sdf: readsector0 checker reports path is down
Dec 12 14:03:20 bhnfs1 kernel: iscsi: cmd 0x28 is not queued (8)
Dec 12 14:03:20 bhnfs1 multipathd: sdg: readsector0 checker reports path is down
View the multi-link status:
[root@localhost etc] # multipath-ll
Sdc: checker msg is "readsector0 checker reports path is down"
Sdf: checker msg is "readsector0 checker reports path is down"
Sdg: checker msg is "readsector0 checker reports path is down"
Mpath3 (3600508b4000a5bfd0000b00000200000) dm-2 HP,HSV300
[size=2.0T] [features=0] [hwhandler=0]
\ _ round-robin 0 [prio=1] [active]
\ _ 1 sdd 8:48 [active] [ready]
\ _ 2 sdf 8:80 [failed] [faulty]
Mpath2 (3600508b4000a5bfd0000b000001a0000) dm-1 HP,HSV300
[size=2.0T] [features=0] [hwhandler=0]
\ _ round-robin 0 [prio=1] [active]
\ _ 1 sdb 8:16 [active] [ready]
\ _ 2 sdc 8:32 [failed] [faulty]
Mpath4 (3600508b4000a5bfd0000b00000350000) dm-3 HP,HSV300
[size=2.0T] [features=0] [hwhandler=0]
\ _ round-robin 0 [prio=1] [active]
Sde 8:64 [active] [ready]
\ _ 2 sdg 8:96 [failed] [faulty]
III. Summary
With the development and popularization of iSCSI storage technology, there are more and more applications of iSCSI storage products in the telecommunications industry. It is very necessary to master the configuration and use of iSCSI storage in different application environments. As an open application solution, the multipath scheme provided by Linux also provides users with more flexible choices for application solutions.
Identification of LVM and LUN after machine restart:
1. Modify the queue of initrd initialization module and add FC driver module:
[root@localhost ~] # grep MOD / etc/sysconfig/kernel
INITRD_MODULES= "sata_nv mptsas reiserfs qla2xxx qla2400"
MODULES_LOADED_ON_BOOT= ""
2. Remake initrd:
# cd / boot/
[root@localhost boot] # cp initrd-2.6.5-7.244-smp initrd-2.6.5-7.244-smp-bak20090416
[root@localhost boot] # mkinitrd-k vmlinuz-2.6.5-7.244-smp-I initrd-2.6.5-7.244-smp
3. Restart the system to automatically identify LVM and other LUN devices:
[root@localhost boot] # reboot
On how to carry out Linux environment iSCSI storage and multi-path function configuration is shared here, I hope the above content can be of some help to you, can learn more knowledge. If you think the article is good, you can share it for more people to see.
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.