Это старая версия документа.
Содержание
Устройства множественного связывания
Без DM-Multipath каждый канал от серверного узла к контроллеру накопителя рассматривается системой как отдельное устройство, даже когда канал ввода/вывода соединяет тот же сервер с тем же контроллером накопителя. DM-Multipath предоставляет возможность организации каналов ввода/вывода локально через создание единого устройства множественного связывания поверх основных устройств.
Идентификаторы устройств множественного связывания
Каждое устройство множественного связывания имеет международный идентификатор (WWID), который гарантирует глобальную уникальность и неизменность. По умолчанию в имя устройства множественного связывания вставляется его WWID. В качестве альтернативы вы можете установить опцию user_frendly_names в конфигурационном файле, который предписывает DM-Multipath использовать алиас node-unique формы mpathn в качестве имени. Например, узел с двумя адаптерами шины (HBA) подключенными к контроллеру накопителя с двумя портами через единый беззоновый волоконный канал (FC) увидит четыре устройства: /dev/sda, /dev/sdb, /dev/sdc и /dev/sdd. DM-Multipath создает единое устройство с уникальным WWID, которое перенаправляет ввод/вывод на эти четыре зависимых устройства в зависимости от конфигурации. Когда настроечная опция user_friendly_names установлена в yes, имя множественного устройства устанавливается в mpathn. Когда новые устройства попадает под управление DM-Multipath, их можно увидеть в двух разных местах в каталоге /dev: /dev/mapper/mpathn и /dev/dm-n.
Устройства в /dev/mapper создаются раньше в процессе загрузки. Используйте эти имена для доступа к множественным устройствам, например, при создании логических томов.
Устройства в виде /dev/dm-n только для внутреннего использования и никогда не должны использоваться.
Для информации о настройках по умолчанию для множественных устройств, включая опцию настройки user_friendly_names, смотрите секцию Конфигурационный файл DM-Multipath.
Согласованные имена множественных устройств в кластере
When the user_friendly_names configuration option is set to yes, the name of the multipath device is unique to a node, but it is not guaranteed to be the same on all nodes using the multipath device. Similarly, if you set the alias option for a device in the multipaths section of the multipath.conf configuration file, the name is not automatically consistent across all nodes in the cluster. This should not cause any difficulties if you use LVM to create logical devices from the multipath device, but if you require that your multipath device names be consistent in every node it is recommended that you leave the user_friendly_names option set to no and that you not configure aliases for the devices. By default, if you do not set user_friendly_names to yes or configure an alias for a device, a device name will be the WWID for the device, which is always the same. If you want the system-defined user-friendly names to be consistent across all nodes in the cluster, however, you can follow this procedure:
Set up all of the multipath devices on one machine.
Disable all of your multipath devices on your other machines by running the following commands:
# service multipath-tools stop # multipath -F
Copy the /etc/multipath/bindings file from the first machine to all the other machines in the cluster.
Re-enable the multipathd daemon on all the other machines in the cluster by running the following command:
# service multipath-tools start
If you add a new device, you will need to repeat this process.
Similarly, if you configure an alias for a device that you would like to be consistent across the nodes in the cluster, you should ensure that the /etc/multipath.conf file is the same for each node in the cluster by following the same procedure:
Configure the aliases for the multipath devices in the in the multipath.conf file on one machine.
Disable all of your multipath devices on your other machines by running the following commands:
# service multipath-tools stop # multipath -F
Copy the multipath.conf file from the first machine to all the other machines in the cluster.
Re-enable the multipathd daemon on all the other machines in the cluster by running the following command:
# service multipath-tools start
When you add a new device you will need to repeat this process.
Multipath Device attributes
In addition to the user_friendly_names and alias options, a multipath device has numerous attributes. You can modify these attributes for a specific multipath device by creating an entry for that device in the multipaths section of the multipath configuration file. For information on the multipaths section of the multipath configuration file, see Section, «Configuration File Multipath Attributes».
Multipath Devices in Logical Volumes
After creating multipath devices, you can use the multipath device names just as you would use a physical device name when creating an LVM physical volume. For example, if /dev/mapper/mpatha is the name of a multipath device, the following command will mark /dev/mapper/mpatha as a physical volume.
# pvcreate /dev/mapper/mpatha
You can use the resulting LVM physical device when you create an LVM volume group just as you would use any other LVM physical device.
If you attempt to create an LVM physical volume on a whole device on which you have configured partitions, the pvcreate command will fail.
When you create an LVM logical volume that uses active/passive multipath arrays as the underlying physical devices, you should include filters in the lvm.conf to exclude the disks that underlie the multipath devices. This is because if the array automatically changes the active path to the passive path when it receives I/O, multipath will failover and failback whenever LVM scans the passive path if these devices are not filtered. For active/passive arrays that require a command to make the passive path active, LVM prints a warning message when this occurs. To filter all SCSI devices in the LVM configuration file (lvm.conf), include the following filter in the devices section of the file.
filter = [ «r/block/», «r/disk/», «r/sd.*/», «a/.*/» ]
After updating /etc/lvm.conf, it's necessary to update the initrd so that this file will be copied there, where the filter matters the most, during boot. Perform:
update-initramfs -u -k all
Every time either /etc/lvm.conf or /etc/multipath.conf is updated, the initrd should be rebuilt to reflect these changes. This is imperative when blacklists and filters are necessary to maintain a stable storage configuration.