Это старая версия документа.


Конфигурационный файл DM-Multipath

По умолчанию DM-Multipath предоставляет конфигурации для большинства множественных устройств. В дополнение к этому DM-Multipath включает поддержку большинства массивов хранения, которые поддерживают DM-Multipath. Значения конфигураций по умолчанию и поддерживаемые устройства можно найти в файле multipath.conf.defaults.

Вы можете переопределить настроенные значения по умолчанию для DM-Multipath, изменив конфигурационный файл /etc/multipath.conf. Если необходимо, вы можете также добавить массив хранения, который не поддерживается по умолчанию, в конфигурационный файл. Эта глава предоставляет информацию по разбору иизменению файла multipath.conf. Она содержит следующие секции:

В файле конфигурации multipath вам нужно определить только те секции, которые вам потребуются для ваших настройек или те, для которых вы захотите изменить значения по умолчанию, определенные в multipath.conf.defaults. Если в файле присутствуют секции не относящиеся к вашему оборудованию или для которых вы не хотите менять значения по умолчанию, вы можете оставить их закомментированными, как в изначальном файле.

Файл конфигурации допускает синтаксис регулярных выражений.

Версию конфигурационного файла с комментариями можно найти в [архиве] /usr/share/doc/multipath-tools/examples/multipath.conf.annotated.gz.

Обзор файла конфигурации

Конфигурационный файл multipath разделяется на следующие секции:

blacklist
Перечисляет специфические устройства, которые не принимаются во внимание multipath.

blacklist_exceptions
Перечисляет кандидатов в множественные устройства, которые иначе будут блокироваться согласно параметрам секции blacklist.

defaults
Общие настройки по умолчанию для DM-Multipath.

multipath
Параметры настроек по характеристикам отдельных множественных устройств. Эти значения переопределяют те, что определены в секциях defaults и devices.

devices
Параметры настроек для отдельных контроллеров хранилищ. Эти значения переопределяют те, что определены в секции defaults. Если вы ииспользуете дисковый массив, который не поддерживается по умолчанию, вам может потребоваться создать для него подсекцию в разделе devices.

Когда система определяет атрибут множественного устройства, сначала она ищет совпадения в секции multipath, потом в devices, и только затем использует значения по умолчанию.

"Черный список" в файле конфигурации

Секция blacklist конфигурационного файла multipath определяет устройства, которые не будут использоваться, когда система настраивает множественные устройства. Устройства, внесенные в список блокировки, не будут группироваться в множественные устройства.

Если вам действительно нужно заблокировать устройства, вы можете сделать это, используя следующие критерии:

  1. По WWID, как описано в секции Блокировка по WWID

  2. По имени устройства, как описано в секции Блокировка по имени устройства

  3. По типу устройства, как описано в секции Блокировка по типу устройства

По умолчанию множество типов устройств блокируются даже если вы комментируете изначальную секцию blacklist конфигурационного файла. Для информации смотрите Блокировка по имени устройства.

Блокировка по WWID

Вы можете задать определенные устройства для блокирования по их международному идентификатору (WWID) с использованием метки wwid в секции blacklist конфигурационного файла.

Следующий пример показывает строки конфигурационного файла, которые будут блокировать устройство с WWID 26353900f02796769.

blacklist {
       wwid 26353900f02796769
}

Блокировка по имени устройства

Вы можете заблокировать типы устройств по их именам так, что они не будут использоваться для группировки в множественные устройства, задав метку devnode в секции blacklist.

Следующий пример показывает строки конфигурационного файла, которые заблокируют все SCSI устройства, поскольку они блокируют все устройства sd*.

blacklist {
       devnode "^sd[a-z]"
}

Вы можете использовать метку devnode в секции blacklist для определения отдельных блокируемых устройств вместо всех устройств определенного типа. Тем не менее, это не рекомендуется, поскольку, несмотря на то, что они статично определены в правилах udev, нет гарантии что определенное устройство будет иметь то же имя после перезагрузки. Например, после перезагрузки имя устройства может поменяться с /dev/sda на /dev/sdb.

По умолчанию следующие метки devnode включены в список blacklist. Устройства, определяемые в этой секции, как правило не поддерживают DM-Multipath. Чтобы разрешить любое из перечисленного при создании множественных устройств, вы можете определить их в секции blacklist_exceptions как показано в секции Исключения блокировки.

blacklist {
       devnode "^(ram|raw|loop|fd|md|dm-|sr|scd|st)[0-9]*"
       devnode "^hd[a-z]"
}

Блокировка по типу устройства

Вы можете определить отдельные типы устройств в секцию blacklist файла конфигурации с помощью секций device. Следующий пример блокирует все устройства IBM DS4200 и любые производства HP.

blacklist {
       device {
               vendor  "IBM"
               product "3S42"       #DS4200 Product 10
       }
       device {
               vendor  "HP"
               product "*"
       }
}

Исключения блокировки

Вы можете использовать секцию blacklist_exceptions конфигурационного файла для разрешения множественных устройств, заблокированных по умолчанию.

Например, если у вас множество устройств и вы хотите разрешить только одно из них (с WWID 3600d0230000000000e13955cc3757803), вместо того, чтобы блокировать каждое из них отдельно за исключением требуемого, можно заблокировать все и затем разрешить только одно, добавив следующие строки в файл /etc/multipath.conf:

blacklist {
        wwid "*"
}

blacklist_exceptions {
        wwid "3600d0230000000000e13955cc3757803"
}

Когда добавляете устройства в секцию blacklist_exceptions конфигурационного файла, вы должны указывать исключения тем же способом, что и в секции blacklist. Например, исключение по WWID не сработает для устройств, определенных в blacklist с помощью devnode, даже если заблокированное устройство ассоциируется с данным WWID. Точно так же исключения по devnode применимы только к меткам devnode, а исключения по device - к меткам device.

Значения по умолчанию в файле конфигурации

FIXME Убрать после выяснения ошибки с заголовком таблицы

Атрибут Описание
polling_interval Определяет интервал между двумя проверками маршрутов в секундах. Для правильной работы маршрутов, проверки постепенно увеличиваются до значения (4 * polling_interval). Значение по умолчанию 5.

Файл конфигурации /etc/multipath.conf включает секцию defaults, которая устанавливает параметр user_friendly_names в yes, как показано ниже:

defaults {
        user_friendly_names yes
}

Это переопределяет значение параметра user_friendly_names по умолчанию.

Конфигурационный файл содержит шаблоны настроек по умолчанию. Эта секция комментируется как показано ниже:

#defaults {
#       udev_dir                /dev
#       polling_interval        5
#       selector                "round-robin 0"
#       path_grouping_policy    failover
#       getuid_callout          "/lib/dev/scsi_id --whitelisted --device=/dev/%n"
#	prio			const
#	path_checker		directio
#	rr_min_io		1000
#	rr_weight		uniform
#	failback		manual
#	no_path_retry		fail
#	user_friendly_names	no
#}

Для переопределения значения по умолчанию любого настраиваемого параметра вы можете скопировать соответствующую строку из этого шаблона в секцию defaults и снять комментарий. Например, чтобы переустановить параметр path_grouping_policy в multibus вместо определенного по умолчанию failover, скопируйте соответствующую строку из шаблона и раскомментируйте ее, как показано ниже:

defaults {
        user_friendly_names     yes
        path_grouping_policy    multibus
}

Таблица настроек Multipath по умолчанию определяет атрибуты, которые устанавливаются в секции defaults файла multipath.conf. Эти значения используются DM-Multipath пока они не переопределены атрибутами, заданными в секциях devices и multipaths в этом же файле.

Настройки Multipath по умолчанию

^ Атрибут ^ Описание ^

polling_interval Определяет интервал между двумя проверками маршрутов в секундах. Для правильной работы маршрутов, проверки постепенно увеличиваются до значения (4 * polling_interval). Значение по умолчанию 5.
udev_dir Каталог, где создаются узлы устройств udev. По умолчанию /dev.
multipath_dir Каталог, где сохраняются динамические объекты общего доступа. Значение по умолчанию зависит от системы, обычно /lib/multipath.
verbosity Значение уровня комментариев по умолчанию. Большее значение увеличивает количество комментариев. Допустимые значения от 0 до 6. Значение по умолчанию 2.
path_selector Определяет алгоритм определения следующего маршрута ввода/вывода по умолчанию. Возможные значения:
1. round-robin 0: Цикл по всем маршрутам в группе маршрутов, посылая одинаковый поток в каждый.
2. queue-length 0: Посылать следующую порцию данных по маршруту с наименьшим количеством невыполненных запросов.
3. service-time 0: Посылать следующую порцию данных по маршруту с наименьшими задержками, которые определяются делением общего объема невыполненного ввода/вывода на каждом маршруте на их относительную пропускную способность.
Значение по умолчанию round-robin 0.
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. The default value is failover. |

getuid_callout Specifies the default program and arguments to call out to obtain a unique path identifier. An absolute path is required. The default value is /lib/udev/scsi_id --whitelisted --device=/dev/%n.
prio Specifies the default function to call to obtain a path priority value. For example, the ALUA bits in SPC-3 provide an exploitable prio 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. netapp: 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. The default value is const.
prio_args The arguments string passed to the prio function Most prio functions do not need arguments. The datacore prioritizer need one. Example, «timeout=1000 preferredsds=foo». The default value is (null) «».
features The extra features of multipath devices. The only existing feature is queue_if_no_path, which is the same as setting no_path_retry to queue. For information on issues that may arise when using this feature, see Section, «Issues with queue_if_no_path feature».
path_checker Specifies the default method used to determine the state of the paths. Possible values include: readsector0: Read the first sector of the device. tur: Issue a TEST UNIT READY to the device. emc_clariion: Query the EMC Clariion specific EVPD page 0xC0 to determine the path. hp_sw: Check the path state for HP storage arrays with Active/Standby firmware. rdac: Check the path stat for LSI/Engenio RDAC storage controller. directio: Read the first sector with direct I/O. The default value is directio.
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 numeric value greater than zero specifies deferred failback, expressed in seconds. The default value is manual.
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. The default value is 1000.
rr_weight If set to priorities, then instead of sending rr_min_io requests to a path before calling path_selector to choose the next path, the number of requests to send is determined by rr_min_io times the path's priority, as determined by the prio function. If set to uniform, all path weights are equal. The default value is uniform.
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. The default value is 0.
user_friendly_names If set to yes, specifies that the system should use the /etc/multipath/bindings file to assign a persistent and unique alias to the multipath, in the form of mpathn. If set to no, specifies that the system should use the WWID as the alias for the multipath. In either case, what is specified here will be overridden by any device-specific aliases you specify in the multipaths section of the configuration file. The default value is no.
queue_without_daemon If set to no, the multipathd daemon will disable queueing for all devices when it is shut down. The default value is yes.
flush_on_last_del If set to yes, then multipath will disable queueing when the last path to a device has been deleted. The default value is no.
max_fds Sets the maximum number of open file descriptors that can be opened by multipath and the multipathd daemon. This is equivalent to the ulimit -n command. A value of max will set this to the system limit from /proc/sys/fs/nr_open. If this is not set, the maximum number of open file descriptors is taken from the calling process; it is usually 1024. To be safe, this should be set to the maximum number of paths plus 32, if that number is greater than 1024.
checker_timer The timeout to use for path checkers that issue SCSI commands with an explicit timeout, in seconds. The default value is taken from /sys/block/sdx/device/timeout, which is 30 seconds as of 12.04 LTS
fast_io_fail_tmo The number of seconds the SCSI layer will wait after a problem has been detected on an FC remote port before failing I/O to devices on that remote port. This value should be smaller than the value of dev_loss_tmo. Setting this to off will disable the timeout. The default value is determined by the OS.
dev_loss_tmo The number of seconds the SCSI layer will wait after a problem has been detected on an FC remote port before removing it from the system. Setting this to infinity will set this to 2147483647 seconds, or 68 years. The default value is determined by the OS.

Атрибуты множественности в файле конфигурации

Table Multipath Attributes shows the attributes that you can set in the multipaths section of the multipath.conf configuration file for each specific multipath device. These attributes apply only to the one specified multipath. These defaults are used by DM-Multipath and override attributes set in the defaults and devices sections of the multipath.conf file. Multipath Attributes Attribute Description wwid Specifies the WWID of the multipath device to which the multipath attributes apply. This parameter is mandatory for this section of the multipath.conf file. alias Specifies the symbolic name for the multipath device to which the multipath attributes apply. If you are using user_friendly_names, do not set this value to mpathn; this may conflict with an automatically assigned user friendly name and give you incorrect device node names.

In addition, the following parameters may be overridden in this multipath section

  path_grouping_policy
  path_selector
  failback
  prio
  prio_args
  no_path_retry
  rr_min_io
  rr_weight
  flush_on_last_del

The following example shows multipath attributes specified in the configuration file for two specific multipath devices. The first device has a WWID of 3600508b4000156d70001200000b0000 and a symbolic name of yellow.

The second multipath device in the example has a WWID of 1DEC_321816758474 and a symbolic name of red. In this example, the rr_weight attributes is set to priorities.

multipaths {

     multipath {
            wwid                  3600508b4000156d70001200000b0000
            alias                 yellow
            path_grouping_policy  multibus
            path_selector         "round-robin 0"
            failback              manual
            rr_weight             priorities
            no_path_retry         5
     }
     multipath {
            wwid                  1DEC_____321816758474
            alias                 red
            rr_weight             priorities
      }

}

Устройства в файле конфигурации

Table Device Attributes shows the attributes that you can set for each individual storage device in the devices section of the multipath.conf configuration file. These attributes are used by DM-Multipath unless they are overwritten by the attributes specified in the multipaths section of the multipath.conf file for paths that contain the device. These attributes override the attributes set in the defaults section of the multipath.conf file.

Many devices that support multipathing are included by default in a multipath configuration. The values for the devices that are supported by default are listed in the multipath.conf.defaults file. You probably will not need to modify the values for these devices, but if you do you can overwrite the default values by including an entry in the configuration file for the device that overwrites those values. You can copy the device configuration defaults from the multipath.conf.annotated.gz or if you wish to have a brief config file, multipath.conf.synthetic file for the device and override the values that you want to change.

To add a device to this section of the configuration file that is not configured automatically by default, you must set the vendor and product parameters. You can find these values by looking at /sys/block/device_name/device/vendor and /sys/block/device_name/device/model where device_name is the device to be multipathed, as in the following example:

# cat /sys/block/sda/device/vendor WINSYS # cat /sys/block/sda/device/model SF2372

The additional parameters to specify depend on your specific device. If the device is active/active, you will usually not need to set additional parameters. You may want to set path_grouping_policy to multibus. Other parameters you may need to set are no_path_retry and rr_min_io, as described in Table Multipath Attributes.

If the device is active/passive, but it automatically switches paths with I/O to the passive path, you need to change the checker function to one that does not send I/O to the path to test if it is working (otherwise, your device will keep failing over). This almost always means that you set the path_checker to tur; this works for all SCSI devices that support the Test Unit Ready command, which most do.

If the device needs a special command to switch paths, then configuring this device for multipath requires a hardware handler kernel module. The current available hardware handler is emc. If this is not sufficient for your device, you may not be able to configure the device for multipath. Device Attributes Attribute Description vendor Specifies the vendor name of the storage device to which the device attributes apply, for example COMPAQ. product Specifies the product name of the storage device to which the device attributes apply, for example HSV110 (C)COMPAQ. revision Specifies the product revision identifier of the storage device. product_blacklist Specifies a regular expression used to blacklist devices by product. hardware_handler

Specifies a module that will be used to perform hardware specific actions when switching path groups or handling I/O errors. Possible values include:

  1 emc: hardware handler for EMC storage arrays
  1 alua: hardware handler for SCSI-3 ALUA arrays.
  1 hp_sw: hardware handler for Compaq/HP controllers.
  1 rdac: hardware handler for the LSI/Engenio RDAC controllers.

In addition, the following parameters may be overridden in this device section

  path_grouping_policy
  getuid_callout
  path_selector
  path_checker
  features
  failback
  prio
  prio_args
  no_path_retry
  rr_min_io
  rr_weight
  fast_io_fail_tmo
  dev_loss_tmo
  flush_on_last_del

Whenever a hardware_handler is specified, it is your responsibility to ensure that the appropriate kernel module is loaded to support the specified interface. These modules can be found in /lib/modules/`uname -r`/kernel/drivers/scsi/device_handler/ . The requisite module should be integrated into the initrd to ensure the necessary discovery and failover-failback capacity is available during boot time. Example,

# cat scsi_dh_alua » /etc/initramfs-tools/modules ## append module to file # update-initramfs -u -k all

The following example shows a device entry in the multipath configuration file.

#devices { # device { # vendor «COMPAQ » # product «MSA1000 » # path_grouping_policy multibus # path_checker tur # rr_weight priorities # } #}

The spacing reserved in the vendor, product, and revision fields are significant as multipath is performing a direct match against these attributes, whose format is defined by the SCSI specification, specifically the Standard INQUIRY command. When quotes are used, the vendor, product, and revision fields will be interpreted strictly according to the spec. Regular expressions may be integrated into the quoted strings. Should a field be defined without the requisite spacing, multipath will copy the string into the properly sized buffer and pad with the appropriate number of spaces. The specification expects the entire field to be populated by printable characters or spaces, as seen in the example above

  vendor: 8 characters
  product: 16 characters
  revision: 4 characters

To create a more robust configuration file, regular expressions can also be used. Operators include ^ $ [ ] . * ? +. Examples of functional regular expressions can be found by examining the live multipath database and multipath.conf example files found in /usr/share/doc/multipath-tools/examples:

# echo 'show config' | multipathd -k