In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-30 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/01 Report--
This article mainly shows you "how to configure multipath software multipath.conf", the content is easy to understand, clear, hope to help you solve doubts, the following let the editor lead you to study and learn "how to configure multipath software multipath.conf" this article.
Multipath is referred to as multipath access, and its main function is to cooperate with storage devices to achieve three major functions: 1. Fault switching and recovery 2. Load balancing of IO traffic 3. Virtualization of disk
1. The basic configuration of multipath in redhat 7.2:
WKioL1hck-_A9WpgAADUF9Ah-cM128.png
As can be seen from the above prompts, there are no / etc/multipath,DM modules that are not loaded by default, and the configuration file can be generated with the command / sbin/mpathconf/-- enable in redhat linux 7.2.Configuration files can be generated using the command / module-- enable.
The content is commented out in the / etc/multipath.conf configuration file
WKiom1hclDyx0blSAAEcSNr1nl0957.png
Pay attention to all the things that need to be changed and remove the comments.
To save time, here are the configuration details of 6.2, which is not much different from 7.2
1. The basic configuration of multipath in redhat 6.2:
Check whether the installation is successful or not through the command: lsmod | grep dm_multipath. If there is no output description and no installation, then install the package through the yum function: yum-y install device-mapper device-mapper-multipath
Then use the command: multipath-ll to check the multipath status to see if the module is loaded successfully
[root@liujing ~] # multipath-ll to view multipath status
Mar 10 19:18:28 | / etc/multipath.conf does not exist, blacklisting alldevices.
Mar 10 19:18:28 | A sample multipath.conf file is located at
Mar 10 19:18:28 | / usr/share/doc/device-mapper-multipath-0.4.9/multipath.conf
Mar 10 19:18:28 | You can run / sbin/mpathconf to create or modify/etc/multipath.conf
Mar 10 19:18:28 | DM multipath kernel driver notloaded-DM module is not loaded
If the module does not load successfully, initialize the DM or restart the system with the following commands
-Use the following commands to initialize and start DM for the first time:
Modprobe dm-multipath
Modprobe dm-round-robin
Service multipathd start
Multipath-v2
After initialization, use the multipath-ll command to check whether the load is successful.
[root@liujing ~] # multipath-ll
Mar 10 19:21:14 | / etc/multipath.conf does not exist, blacklisting alldevices.
Mar 10 19:21:14 | A sample multipath.conf file is located at
Mar 10 19:21:14 | / usr/share/doc/device-mapper-multipath-0.4.9/multipath.conf
Mar 10 19:21:14 | You can run / sbin/mpathconf to create or modify/etc/multipath.conf
DM multipath kernel driver not loaded-this prompt is gone, indicating that the DM module has been loaded successfully.
As you can see from the above prompt, the DM module loaded successfully, but there is no multipath.conf configuration file under / etc/. The next step describes how to configure the multipath.conf file.
Configure multipath:
The path to the configuration file to create a Multipath through the vi command is / etc/multipath.conf. The simplest configuration to add multipath to the configuration file is as follows:
Vi / etc/multipath.conf
Blacklist {
Devnode "^ sda"
}
Defaults {
User_friendly_names yes
Path_grouping_policy multibus
Failback immediate
No_path_retry fail
}
Save the configuration after editing, and use the command:
/ etc/init.d/multipathd start # enable mulitipath service
If the service cannot be started, the OK is not prompted as follows:
[root@liujing mapper] # service multipathd start
Starting multipathd daemon: no prompt for OK
It can be solved by switching the service back on.
[root@liujing mapper] # / etc/init.d/multipathd stop
Stopping multipathddaemon: [OK]
[root@localhost mapper] # / etc/init.d/multipathd start
Starting multipathddaemon: [OK]-prompt OK to enable the service normally
View through the command:
[root@liujing mapper] # multipath-ll
Mpatha (360a9800064665072443469563477396c) dm-0NETAPP,LUN-creates a lun
Size=3.5G features='0' hwhandler='0' wp=rw
`- +-policy='round-robin 0' prio=4 status=active
|-1 sdb 0 sdb 8:16 active ready running-two drive letters sdb and sde in multipath
`- 2 virtual 0 sde 015 0 active ready running at 8:64
There are two more folders, mpatha and mpathap1, under the directory / dev/mapper/.
[root@liujing mapper] # cd / dev/mapper/
[root@liujing mapper] # ls
Control mpatha mpathap1
At the same time, there are two more device identifiers under the command of fdisk-l:
When multipathing is not configured:
[root@liujing~] # fdisk-l
Disk / dev/sda: 146.8 GB, 146815733760 bytes
255 heads, 63 sectors/track, 17849 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x000a6cdd
DeviceBoot Start End Blocks Id System
/ dev/sda1 * 1 26 204800 83 Linux
Partition 1 does not end on cylinder boundary.
/ dev/sda2 26 287 2097152 82 Linuxswap / Solaris
Partition 2 does not end on cylinder boundary.
/ dev/sda3 287 17850 141071360 83 Linux
Disk / dev/sdb: 3774 MB, 3774873600 bytes
117 heads, 62 sectors/track, 1016 cylinders
Units = cylinders of 7254 * 512 = 3714048 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I take O size (minimum/optimal): 4096 bytes / 65536 bytes
Disk identifier: 0xac956c3a
DeviceBoot Start End Blocks Id System
/ dev/sdb1 1 1016 3685001 83 Linux
Partition 1 does not start on physical sector boundary.
Disk / dev/sde: 3774 MB, 3774873600 bytes
117 heads, 62 sectors/track, 1016 cylinders
Units = cylinders of 7254 * 512 = 3714048 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I take O size (minimum/optimal): 4096 bytes / 65536 bytes
Disk identifier: 0xac956c3a
DeviceBoot Start End Blocks Id System
/ dev/sde1 1 1016 3685001 83 Linux
Partition 1 does not start on physical sector boundary.
Two CAN NICs get the same drive letter:
/ dev/sde and / dev/sdb.
/ dev/mapper/mpatha and / dev/mapper/mpathap1 are added after configuration:
[root@localhost mapper] # fdisk-l
Disk / dev/sda: 146.8 GB, 146815733760 bytes
255 heads, 63 sectors/track, 17849 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x000a6cdd
DeviceBoot Start End Blocks Id System
/ dev/sda1 * 1 26 204800 83 Linux
Partition 1 does not end on cylinder boundary.
/ dev/sda2 26 287 2097152 82 Linuxswap / Solaris
Partition 2 does not end on cylinder boundary.
/ dev/sda3 287 17850 141071360 83 Linux
Disk / dev/sdb: 3774 MB, 3774873600 bytes
117 heads, 62 sectors/track, 1016 cylinders
Units = cylinders of 7254 * 512 = 3714048 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I take O size (minimum/optimal): 4096 bytes / 65536 bytes
Disk identifier: 0xac956c3a
DeviceBoot Start End Blocks Id System
/ dev/sdb1 1 1016 3685001 83 Linux
Partition 1 does not start on physical sector boundary.
Disk / dev/sde: 3774 MB, 3774873600 bytes
117 heads, 62 sectors/track, 1016 cylinders
Units = cylinders of 7254 * 512 = 3714048 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I take O size (minimum/optimal): 4096 bytes / 65536 bytes
Disk identifier: 0xac956c3a
Device Boot Start End Blocks Id System
/ dev/sde1 1 1016 3685001 83 Linux
Partition 1 does not start on physical sector boundary.
Disk / dev/mapper/mpatha: 3774 MB, 3774873600 bytes
117 heads, 62 sectors/track, 1016 cylinders
Units = cylinders of 7254 * 512 = 3714048 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I take O size (minimum/optimal): 4096 bytes / 65536 bytes
Disk identifier: 0xac956c3a
DeviceBoot Start End Blocks Id System
/ dev/mapper/mpathap1 1 1016 3685001 83 Linux
Partition 1 does not start on physical sector boundary.
Disk / dev/mapper/mpathap1: 3773 MB, 3773441024 bytes
255 heads, 63 sectors/track, 458 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I take O size (minimum/optimal): 4096 bytes / 65536 bytes
Alignment offset: 1024 bytes
Disk identifier: 0x00000000
Disk / dev/mapper/mpathap1 doesn't contain a valid partition table
Multipath-F # Delete the existing path and two new paths will be deleted
Multipath-v2 # formatting path appears again after formatting
Basic operation of multipath disk
To operate on the disks generated by multipath software, you can directly manipulate the disks in the / dev/mapper/ directory.
It is a good idea to run the pvcreate command before partitioning disks generated by multipathing software:
Pvcreate / dev/mapper/mpatha
# use this directory / dev/mapper/mpatha when partitioning fdisk / dev/mapper/mpatha
When using fdisk to partition and save the disk generated by multipath software, there will be an error, which is ignored.
Ls-l / dev/mapper/
[root@liujing mnt] # ls-l / dev/mapper/
Total 0
Crw-rw----. 1 root root 10, 58 Mar 10 19:10 control
Lrwxrwxrwx. 1 root root 7 Mar 10 20:28mpatha->.. / dm-0
Lrwxrwxrwx. 1 root root 7 Mar 10 20:33 mpathap1- >.. / dm-1
The mpathap1 is the partition of the multipath disk.
Mkfs.ext4 / dev/mapper/mpathap1 # formats mpath2p1 partitions into ext4 file systems
Mount / dev/mapper/mpathap1 / mnt/ # Mount mpathap1 partition
Use / dev/mapper/mpathap1 when formatting and mounting
Partition disk:
It mentions using the directory / dev/mapper/mpatha when partitioning
[root@liujing~] # fdisk / dev/mapper/mpatha
Device contains neither a valid DOS partition table, nor Sun, SGI or OSFdisklabel
Building a new DOS disklabel with disk identifier 0xac956c3a.
Changes will remain in memory only, until you decide to write them.
After that, of course, the previous content won't be recoverable.
Warning: invalid flag 0x0000 of partition table 4 will be corrected byw (rite)
WARNING: DOS-compatible mode is deprecated. It's strongly recommended to
Switch off the mode (command 'c') and change display units to
Sectors (command'u').
Command (m for help): n Murray-New Partition
Command action
E extended
P primary partition (1-4)
PMI-Primary Partition
Partition number (1-4): 1
First cylinder (1-1016, default 1):
Using default value 1
Last cylinder, + cylinders or + size {KMagne Mpeng} (1-1016, default 1016):
Using default value 1016
Command (m for help): W-write list is equivalent to saving
The partition table has been altered!
Calling ioctl () to re-read partition table.
Syncing disks.
Note: if two node of the same device hang the same drive letter, the other drive letter needs to be written into w again. We don't need n anymore.
Format:
[root@liujing ~] # mkfs.ext4 / dev/mapper/mpathap1
Mke2fs 1.41.12 (17-May-2010)
/ dev/sdd1 alignment is offset by 1024 bytes.
This may result in very poor performance, (re)-partitioning suggested.
Filesystem label=
OS type: Linux
Block size=4096 (log=2)
Fragment size=4096 (log=2)
Stride=1 blocks, Stripe width=16 blocks
230608 inodes, 921250 blocks
46062 blocks (5.00%) reserved for the super user
First data block=0
Maximum filesystem blocks=943718400
29 block groups
32768 blocks per group, 32768 fragments per group
7952 inodes per group
Superblock backups stored on blocks:
32768, 98304, 163840, 229376, 294912, 819200, 884736
Writing inode tables: done
Creating journal (16384 blocks): done
Writing superblocks and filesystem accounting information: done
This filesystem will be automatically checked every 33 mounts or
180 days, whichever comes first. Use tune2fs-c or-I tooverride.
Mount / dev/mapper/mpathap1 to / mnt
[root@liujing ~] # mount / dev/mapper/mpathap1 / mnt
3. Prior to the advanced configuration of multipath, the default configuration of multipath is used to complete multipath, such as mapping device name and multipath load balancer method is the default setting. Is there any way to configure multipath according to our own definition? the answer is OK.
1. Configuration of multipath.conf file
The next job is to edit the configuration file for / etc/multipath.conf
Multipath.conf mainly includes the configuration of blacklist, multipaths and devices.
Blacklist configuration
Blacklist {
Devnode "^ sda"
}
The Multipaths part configures the configuration of multipaths and devices.
Multipaths {
Multipath {
Wwid * this value multipath-v3 can be seen
Alias after alias iscsi-dm0 # mapping, you can take whatever you want
Path_grouping_policy multibus # path Group Policy
Path_checker tur # method of determining path status
Path_selector "round-robin 0" # method of selecting that path for the next IO operation
}
}
Devices partial configuration
Devices {
Device {
Vendor "iSCSI-Enterprise" # Vendor name
Product "Virtual disk" # product model
Path_grouping_policy multibus # default path group policy
Getuid_callout "/ sbin/scsi_id-g-u-s / block/%n" # gets the default program for unique device numbers
Prio_callout "/ sbin/acs_prio_alua%d" # default program used to get finite order values
Path_checker readsector0 # method of determining path status
Path_selector "round-robin 0" # method of selecting that path for the next IO operation
Failback immediate # failure recovery mode
No_path_retry queue # the number of times the system attempted to use the failure path before disable queue
Rr_min_io 100 # the number of IO requests in the current user group before switching to another path
}
}
The following is an introduction to the standard documentation for the relevant parameters:
Attribute
Description
Wwid
Specifies the WWID of themultipath device to which themultipath attributes apply. This parameter is mandatory for this section of themultipath.conf file.
Alias
Specifies the symbolic name for themultipath device to which themultipath attributes apply. If you are usinguser_friendly_names, do not set this value tompathn; this may conflict with an automatically assigned user friendly name and give you incorrect device node names.
Path_grouping_policy
Specifies the default path grouping policy to apply to unspecified multipaths. Possible values include:
Failover = 1 path per priority group
Multibus = all valid paths in 1 priority group
Group_by_serial = 1 priority group per detected serial number
Group_by_prio = 1 priority group per path priority value
Group_by_node_name = 1 priority group per target node name
Path_selector
Specifies the default algorithm to use in determining what path to use for the next I/O operation. Possible values include:
Round-robin 0: Loop through every path in the path group, sending the same amount of I/O to each.
Queue-length 0: Send the next bunch of I/O down the path with the least number of outstanding I/O requests.
Service-time 0: Send the next bunch of I/O down the path with the shortest estimated service time, which is determined by dividing the total size of the outstanding I/O to each path by its relative throughput.
Failback
Manages path group failback.
A value of immediate specifies immediate failback to the highest priority path group that contains active paths.
A value of manual specifies that there should not be immediate failback but that failback can happen only with operator intervention.
A value of followover specifies that automatic failback should be performed when the first path of a path group becomes active. This keeps a node from automatically failing back when another node requested the failover.
A numeric value greater than zero specifies deferred failback, expressed in seconds.
Prio
Specifies the default function to call to obtain a path priority value. For example, the ALUA bits in SPC-3 provide an exploitableprio value. Possible values include:
Const: Set a priority of 1 to all paths.
Emc: Generate the path priority for EMC arrays.
Alua: Generate the path priority based on the SCSI-3 ALUA settings.
Tpg_pref: Generate the path priority based on the SCSI-3 ALUA settings, using the preferred port bit.
Ontap: Generate the path priority for NetApp arrays.
Rdac: Generate the path priority for LSI/Engenio RDAC controller.
Hp_sw: Generate the path priority for Compaq/HP controller in active/standby mode.
Hds: Generate the path priority for Hitachi HDS Modular storage arrays.
No_path_retry
A numeric value for this attribute specifies the number of times the system should attempt to use a failed path before disabling queueing.
A value of fail indicates immediate failure, without queueing.
A value of queue indicates that queueing should not stop until the path is fixed.
Rr_min_io
Specifies the number of I/O requests to route to a path before switching to the next path in the current path group. This setting is only for systems running kernels older that 2.6.31. Newer systems should userr_min_io_rq. The default value is 1000.
Rr_min_io_rq
Specifies the number of I/O requests to route to a path before switching to the next path in the current path group, using request-based device-mapper-multipath. This setting should be used on systems running current kernels. On systems running kernels older than 2.6.31, use rr_min_io. The default value is 1.
Rr_weight
If set to priorities, then instead of sending rr_min_iorequests to a path before calling path_selector to choose the next path, the number of requests to send is determined byrr_min_io times the path's priority, as determined by theprio function. If set to uniform, all path weights are equal.
Flush_on_last_del
If set to yes, then multipath will disable queueing when the last path to a device has been deleted.
A complete advanced configuration in my local area is as follows:
[root@liujing ~] # vi / etc/multipath.conf
Blacklist {
Devnode "^ sda"
}
Multipaths {
Multipath {
Wwid 360a98000646650724434697454546156
Alias mpathb_fcoe
Path_grouping_policy multibus
# path_checker "directio"
Prio "random"
Path_selector "round-robin0"
}
}
Devices {
Device {
Vendor "NETAPP"
Product "LUN"
Getuid_callout "/ lib/udev/scsi_id--whitelisted-- device=/dev/%n"
# path_checker "directio"
# path_selector "round-robin0"
Failback immediate
No_path_retry fail
}
}
Parameters such as wwid,vendor,product and getuid_callout can be obtained by: multipath-v3 command. If each wwid alias is set in / etc/multipath.conf, the alias overrides this setting.
4. Load balancing test:
You can use the dd command to read and write to the device, and at the same time use iostat to check the status of Imax 0 and the path from which the traffic is going out:
DD command: dd if=/dev/zero of=/mnt/1Gfile bs=8k count=131072 above we have mounted the disk under the / MNT folder, so we can read and write directly to the / mnt folder when reading and writing to the disk.
If you want to read and write repeatedly to the disk, you can use the following statement:
[root@liujing ~] # for ((item1transposition item1 | grep MB;done;-repeat reading and writing 5 times this value can be changed according to your test needs.
Enter iostat 2 10 on the other console to view the IO read and write status:
You can see that sdc and sdd are two multi-path drive letters, and the load with uniform traffic is in the two paths, and the load balancing is very successful.
Fifth, path redundancy backup test
Drop the port down of one of the paths, and all traffic will be switched directly to another path.
These are all the contents of the article "how to configure multipath Software multipath.conf". Thank you for reading! I believe we all have a certain understanding, hope to share the content to help you, if you want to learn more knowledge, welcome to follow the industry information channel!
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.