1. 查看系统所需软件包
rpm -qa |grep mapper
2. 加载dm_multipath模块
modprobe dm_multipath
3. 编辑配置文件
vi /etc/multipath.conf
将下面三行注释掉,使之变成如下
#device_blacklist{
# devnode'*'
#}
4. 配置multipathd服务
chkconfig --list multipathd
chkconfig multipathd on
5. 启动multipathd
/etc/init.d/multipathd start
6. 查看多路径情况
multipath -ll
看是否都是 [active][ready]
7. 如果使用lvm, 则需要编辑下面文件
vi /etc/lvm/lvm.conf
新增了下面这行
types = [ "device-mapper", 1]
然后更改了filter, 使之成为
filter = [ "a/dev/sda2$/","a/dev/mpath/.*/", "r/.*/" ]
这里系统的本地硬盘是/dev/sda2, 并且作为lvm盘来使用的
8. 扫描可用硬盘
lvmdiskscan
9. 执行相应lvm命令创建文件系统等
pvcreate, vgcreate, lvcreate, mkfs.ext3, mount
10. 最后
测试failover, loadbalance
11. disable multipath
http://hi.baidu.com/cunbing168/blog/item/de0acbee5d13a5ccd439c9a4.html补充:
2.2. Consistent Multipath Device Names in a Cluster
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 not set the user_friendly_names option to yes 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 multipathd stop
# multipath -F
Copy the bindings file from the first machine to all the other machines in the cluster. By default, the location of this file is /var/lib/multipath/bindings. If /var is a separate partition on your system, however, you should change this value with the bindings_file option in the defaults section of the multipath.conf configuration file, as described in . This file needs to be located on your root file system partition, for example:
bindings_file "/etc/multipath_bindings"
Re-enable the multipathd daemon on all the other machines in the cluster by running the following command:
# service mutipathd start
If you add a new device, you will need to repeat this process.
[root@10.5.21.101 multipath]#scp root@10.5.21.103:/var/lib/multipath/bindings /var/lib/multipath2.4. 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/mpath0 is the name of a multipath device, the following command will mark /dev/mapper/mpath0 as a physical volume.
pvcreate /dev/mapper/mpath0
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.
阅读(1982) | 评论(0) | 转发(0) |