Device Mapper Multipath(DM-Multipath)

Device Mapper Multipath(DM-Multipath)可以将服务器节点和存储阵列之间的多条I/O链路配置为一个单独的设备。这些I/O链路是由不同的线缆、交换机、控制器组成的SAN物理链路。Multipath将这些链路聚合在一起,生成一个单独的新的设备。

1.DM-Multipath概览:

(1)数据冗余

DM-Multipath可以实现在active/passive模式下的灾难转移。在active/passive模式下,只有一半的链路在工作,如果链路上的某一部分(线缆、交换机、控制器)出现故障,DM-Multipath就会切换到另一半链路上。

(2)提高性能

DM-Multipath也可以配置为active/active模式,从而I/O任务以round-robin的方式分布到所有的链路上去。通过配置,DM-Multipath还可以检测链路上的负载情况,动态地进行负载均衡。

DM-Multipath的存储阵列的支持情况可以查看multipath.conf.default。对于支持列表中没有的存储,可以在multipath的配置文件multipath.conf中自行添加。

2.DM-Multipath的组成:

(1)dm-multipath内核模块实现I/O重定向、支持failover以及链路的聚合

(2)mutilpath命令查看和配置multipath设备。它一般由/etc/rc.sysinit启动,也会在系统发现新的块设备时由udev启动,或者由initramfs在系统启动时执行。

(3)multipathd后台进程监控链路。当链路失效或者恢复时,它会发起链路组的切换。它实现了对multipath设备的动态修改。不过multipath.conf修改后,它需要重新启动。

(4)kpartx命令根据设备上分区表创建device mapper设备。当需要在DM-MP设备上使用基于DOS的分区时,这个命令是必须。

不使用DM-Multipath,每一条从服务器到存储的链路都被系统识别为一个单独的设备。DM-Multipath可以在这些底层的设备之上创建一个单一的multipath设备,实现对这些链路的组织和管理。

3.Multipath设备的标志符

每一个multipath设备都有一个WWID(World Wide Identifier),这个id是全球唯一而且不可更改的。默认情况下,multipath设备的名称被设置为它的WWID。不过也可以在配置文件中使用_friendly_names选项,为设备取一个别名,别名为mpath[n]。

例如,一台服务器节点有2块HBA卡,通过一台没有划分zone的交换机,连接到2个磁盘阵列控制器,服务器系统中会发现4个设备:/dev/sda、/dev/sdb、/dev/sdc、/dev/sdd。DM-Multipath会按照配置文件在这些底层设备上创建一个拥有一个唯一WWID号的multipath设备。如果配置文件中_friendly_names选项被设置为yes,则这个multipath设备会被命名为mpath[n]。

当新的设备被DM-Multipath接管之后,新的设备文件会在/dev/目录下3个不同的地方出现:/dev/mapper/mpath[n]、/dev/mpath/mpath[n]、/dev/dm-[n]。

(1)/dev/mapper/目录下的文件,是早在系统启动的过程中就创建了。访问multipath设备时就使用这些文件,例如创建lvm;

(2)/dev/mpath/目录下的文件,是为了可以方便的在同一个目录下查看所有的multipath设备。这个文件由udev创建。如果系统在启动过程中需要访问multipath设备,不要使用这些文件。不用在这些设备文件上建立lvm;

(3)/dev/dm-[n]只为了内部使用目的,永远不要对这些文件进行操作。

4.统一multipath设备的命名

当配置文件中_friendly_names被设置为yes,在该服务器节点上这个设备名是唯一而且确定的,但是不能保证在使用这些链路的其它服务器节点上的multipath设备的名称能够相互保持一致。如果只是建立lvm,那么这个问题不会有什么影响。但是如果希望不同服务器节点上的multipath设备的名称能够统一,必须使用下面其中一种方法:

(1)在配置文件中的multipaths段使用alias选项为设备设置别名,并在不同的服务器上保持一致;

(2)如果希望不同服务器上multipath设备的user-friendly名称保持一致,首先在一台服务器上建立所有multipath设备,然后把bindings文件拷贝到所有其它系统统一命名的服务器。binds文件的位置是/var/lib/multipath/bindings。在配置文件可以使用bindings_file参数修改bindings文件的位置。

5.Multipath设备上建立lv

创建multipath设备之后,可以像使用物理设备文件一样在multipath设备上建立pv。例如,假定multipath设备为/dev/mapper/mpath0,使用

pvscreate /dev/mapper/mpath0

即可将mpath0建立为物理卷。同样可以继续建立卷族和逻辑卷。

当在配置为active/passive模式的multipath设备上建立逻辑卷时,需要在lvm的配置文件lvm.conf中增加过滤器,将multipath设备下层的设备添加到过滤列表中。这时因为DM-Multipath会自动切换数据链路,当遇到failover和failback的情况时,如果下层的设备没有在配置文件中过滤,lvm会扫描这些passive状态下的数据链路。Passive状态的链路改变到active状态需要执行一些命令,所以lvm就会在这个时候报错。

为了过滤所有的SCSI设备,在lvm.conf中的devices段,添加下面的配置:

filter = [ "r/disk/", "r/sd.*/", "a/.*/"

6.部署DM-Multipath

6.1开始部署

(1)编辑/etc/multipath.conf,注释掉下面几行:

devnode_blacklist {

devnode "*"

}

(2)multipath的默认配置已经集成在系统之中,不需要在/etc/multipath.conf中重新配置。

path_grouping_policy的默认值为failover。在原始配置中default段设置了multipath设备的默认名称是mpath[n]的形式,如果没有这一段配置(即_friendly_names=yes),设备的默认名称是它的WWID号。

(3)保存配置文件并退出。

(4)执行下列命令:

modprobe dm-multipath

sevice multipathd start

multipath -v2

注:multipath -v2会打印出已经聚合的数据链路。

(5)使用 chkconfig multipathd on,让multipath服务开机自动启动。

6.2排除本地scsi磁盘

很多系统都安装有本地scsi磁盘,DM-Multipath是不建议在这些磁盘上使用的。可以按照下面的步骤取消对本地scsi磁盘的映射。

(1)使用 multipath -v2 确认本地磁盘的信息。如下面的示例(sda为本地scsi磁盘):

[[email protected] ~]# multipath -v2

create: SIBM-ESXSST336732LC____F3ET0EP0Q000072428BX1

[size=33 GB][features="0"][hwhandler="0"]

\_ round-robin 0

\_ 0:0:0:0 sda  8:0

device-mapper ioctl cmd 9 failed: Invalid argument

device-mapper ioctl cmd 14 failed: No such device or address

create: 3600a0b80001327d80000006d43621677

[size=12 GB][features="0"][hwhandler="0"]

\_ round-robin 0

\_ 2:0:0:0 sdb  8:16

\_ 3:0:0:0 sdf  8:80

create: 3600 a0b80001327510000009a436215ec

[size=12 GB][features="0"][hwhandler="0"]

\_ round-robin 0

\_ 2:0:0:1 sdc  8:32

\_ 3:0:0:1 sdg  8:96

create: 3600a0b80001327d800000070436216b3

[size=12 GB][features="0"][hwhandler="0"]

\_ round-robin 0

\_ 2:0:0:2 sdd  8:48

\_ 3:0:0:2 sdh  8:112

create: 3600a0b80001327510000009b4362163e

[size=12 GB][features="0"][hwhandler="0"]

\_ round-robin 0

\_ 2:0:0:3 sde  8:64

\_ 3:0:0:3 sdi  8:128

(2)为了防止DM-Multipath对/dev/sda做映射,编辑/etc/multipath.conf中的devnode_blacklist段。可以使用devnode的方式过滤sda,不过系统中sda的命名不一定是固定的,所以最好使用wwid的方式。从上面的输出中可以看到/dev/sda的wwid为“SIBM-ESXSST336732LC____F3ET0EP0Q000072428BX1”,在配置文件添加:

devnode_blacklist{

wwid SIBM-ESXSST336732LC____F3ET0EP0Q000072428BX1

}

(3)执行下面的命令使配置生效,并重新打印multipath设备列表。

multipath -F

multipath -v2

6.3在DM-Multipath中增加新的设备类型

DM-Multipath支持大部分的存储阵列。默认的配置,可以查看multipath.conf.default文件。

如果希望添加默认不支持的存储设备,可以在/etc/multipath.conf中添加相应的信息。例如在配置为鉴中添加HP Open-V:

devices {

device {

vendor "HP"

product "OPEN-V"

getuid_callout "/sbin/scsi_id -g -u -p0x80 -s /block/%n"

}

}

7.DM-Multipath配置文件

7.1概览

DM-Multipath的配置文件分为以下几个部分:

devnode_blacklist

不使用DM-Multipath的设备列表。默认的情况下,所有的设备都在列表中。启用DM-Multipath的时候一般会将devnote_blacklist段注释掉;

defaults

DM-Multipath的默认通用配置;

multipaths

单独配置每一个multipath设备的属性。这些配置会覆盖在defaults段和devices段的配置;

devices

单独配置每一个存储控制器。这些配置会覆盖defaults段的配置。如果使用的存储控制器不被DM-Multipath支持,那么就需要为这种类型的控制器加一个devices subsection。

DM-Multipath确定multipath设备的属性时,会首先使用multipaths段的内容,然后是devices段,最好读取defaults段。

7.2配置blacklist

devnode_blacklist指定了系统在配置multipath设备时不使用的设备,默认情况所有的设备都在这个列表中。注释掉默认的一行之后,可以在列表中加入某一种类型的设备或者某一特定的设备。禁用设备有2种方法:

(1)使用wwid:

可以使用wwid指定特定的设备,如:

blacklist {

wwid 26353900f02796769

}

(2)使用设备名:

如:

devnode_blacklist {

devnode "^sd[a-z]"

}

这一段配置会禁用所有的SCSI磁盘设备。虽然可以使用这种方法禁用单一特定的设备,但是并不建议这样做。因为除非是使用了udev固定了设备的设备名,则设备的名称在每次重启之后是有可能发生变化的。

因为一些设备并不支持DM-Multipath,所以下面列出的设备是默认禁用的:

blacklist {

devnode "^(ram|raw|loop|fd|md|dm-|sr|scd|st)[0-9]*"

devnode "^hd[a-z]"

devnode "^cciss!c[0-9]d[0-9]*"

}

device-mapper-multipathing,需要完全的升级操作系统。早期的红帽企业Linux 4

不包含这个功能。编辑文件/etc/multipath.conf。在文件头部注释掉如下内容:

devnode_blacklist {

devnode "*"

}

如下例:

# devnode_blacklist {

#        devnode "*"

# }

取消文件 /etc/multipath.conf中这段的注释,这段内容能让 device-mapper multipathing 不用扫描所有的设备。 etc/multipath.conf file:

defaults {

multipath_tool  "/sbin/multipath -v0"

udev_dir        /dev

polling_interval 10

default_selector        "round-robin 0"

default_path_grouping_policy    multibus

default_getuid_callout  "/sbin/scsi_id -g -u -s /block/%n"

default_prio_callout    "/bin/true"

default_features        "0"

rr_wmin_io              100

failback                immediate

}

devnode_blacklist {

wwid 26353900f02796769

devnode "^(ram|raw|loop|fd|md|dm-|sr|scd|st)[0-9]*"

devnode "^hd[a-z][[0-9]*]"

devnode "^cciss!c[0-9]d[0-9]*[p[0-9]*]"

}

这段设置了默认的 device-mapper 的动作,并且去出了通常不会有多路径的设备,如IDE硬盘和软盘。默认的hd*设备的黑名单存在这一个排印错误。需要修改。

devnode "^hd[a-z][[0-9]*]"

把上行修改为如下:

devnode "^hd[a-z][0-9]*"

为了实现简单的failover功能,下例中,defaults 组中的默认的 default_path_grouping_policy 选项被设置成为 failover。

defaults {

multipath_tool         "/sbin/multipath -v0"

udev_dir                /dev

polling_interval        10

default_selector        "round-robin 0"

default_path_grouping_policy    failover

default_getuid_callout  "/sbin/scsi_id -g -u -s /block/%n"

default_prio_callout    "/bin/true"

default_features        "0"

rr_wmin_io              100

failback                immediate

}

退出编辑并保存设置,执行如下命令

modprobe dm-multipath

modprobe dm-round-robin

service multipathd start

multipath -v2

命令 multipath -v2 能显示多路径,从而能知道那些设备工作在多路径下。如果没有所有输出,确认所有的SAN连接被正确的设置,系统有没有正确的开启多路径功能。执行如下命令确认多路径服务有无启动。

chkconfig multipathd on

设备的设备名会被生成,/dev/dm-#,#指代的是多路径组,如果/dev/sda是唯一的多路径设备,/dev/dm-0将会是

/dev/sda和/dev/sdb的多路径设备。注意:fdisk不能用于设备/dev/dm-#,使用fdisk只能操作基础磁盘,要在设备映射多路

径映射设备上创建/dev/dm-#分区的操作. 执行一下命令。

kpartx -a /dev/dm-#

注意: dmsetup ls ?target=multipath

是个协助侦测系统上多路径设备的命令。如果在多路径设备数据库中没有发现硬件,请查看文章“How can I add moreproducts

into the mutipathing database?”

device-mapper-multipath-0.4.7

=============================

RHEL4 U3 Device Mapper Multipath Usage

Maintainer

------------

Benjamin Marzinski

[email protected]

Overview

------------

Device Mapper Multipath (DM-MP) allows nodes to route I/O over multiple paths to

a storage controller. A path refers to the connection from an HBA port to a

storage controller port. As paths fail and new paths come up, DM-MP reroutes

the I/O over the available paths.

When there are multiple paths to a storage controller, each path

appears as a separate device.  DM-MP creates a new device on top of

those devices. For example, a node with two HBAs attached to a storage

controller with two ports via a single unzoned FC switch sees four

devices: /dev/sda, /dev/sdb, /dev/sdc, and /dev/sdd. DM-MP creates a

single device, /dev/mpath/mpath1 that reroutes I/O to those four

underlying devices.

DM-MP consists of the

following components:

o dm-multipath kernel module -- This module reroutes I/O and fails

over paths and path groups.

o multipath command -- This command configures, lists, and removes multipath

devices. The command is run in rc.sysinit during startup, and by

udev, whenever a block device is added.

o multipathd daemon --  This daemon monitors paths, checking to see if faulty

paths have been fixed. As paths come back up, multipathd may also

initiate path group switches to ensure that the optimal path group

is being used. Also, it is possible to interactively modify a

multipath device.

o kpartx command -- This command creates Device Mapper devices for the

partitions on a device. It is necessary to use this command for DOS-

based partitions with DM-MP.

DM-MP works with a variety of storage arrays. It

auto-configures the following storage arrays:

o 3PARdata VV

o Compaq HSV110

o Compaq MSA1000

o DDN SAN DataDirector

o DEC HSG80

o EMC SYMMETRIX

o EMC CLARiiON

o FSC CentricStor

o GNBD

o HITACHI DF400

o HITACHI DF500

o HITACHI DF600

o HP HSV110

o HP HSV210

o HP A6189A

o HP Open-

o IBM 3542

o IBM ProFibre 4000R

o NETAPP

o SGI TP9100

o SGI TP9300

o SGI TP9400

o SGI TP9500

o STK OPENstroage D280

o SUN StorEdge 3510

o SUN T4

Storage arrays not included in the list may require entries in the

/etc/multipath.conf file.

NOTE: Some storage arrays require special handling of I/O errors and

path-group switching. Those require separate hardware handler

kernel modules.

Terms and Concepts

---------------------

Hardware Handler:

A kernel module that performs hardware-specific actions when switching

path groups and dealing with I/O errors.

Path:

The connection from an HBA port to a storage controller port for a LUN.

Each path appears as a separate device. Paths can be in

various states (refer to "Path States").

Path States:

ready  - Path is able to handle I/O requests.

shaky  - Path is up, but temporarily not available for normal

operations.

faulty - Path is unable to handle I/O requests.

ghost  - Path is a passive path, on an active/passive controller.

NOTE: The shaky and ghost states only exist for certain

storage arrays.

Path Group:

A grouping of paths. With DM-MP, only one path group--the

active path group--receives I/O at any time. Within a path

group, DM-MP selects which ready path should receive I/O in a

round robin fashion. Path groups can be in various states (refer to

"Path Group States").

Path Group States:

active   - Path group currently receiving I/O requests.

enabled  - Path groups to try if the active path group has no paths

in the ready state.

disabled - Path groups to try if the active path group and all

enabled path groups have no paths in the active state.

NOTE: The disabled state only exists for certain storage arrays.

Path Priority:

Each path can have a priority assigned to it by a callout program.

Path priorities can be used to group paths by priority and change

their relative weights for the round robin path selector.

Path Group Priority:

Each path group has a priority that is equal to the sum of the

priorities of all the non-faulty paths in the group. By default, the

multipathd daemon tries to ensure that the path group with the

highest priority is always in the active state.

Failover:

When I/O to a path fails, the dm-multipath module tries to switch to

an enabled path group. If there are no enabled path groups with

any paths in the ready state, dm-multipath tries to switch to a disabled

path group. If necessary, dm-multipath runs the hardware handler for the

multipath device.

Failback:

At regular intervals, multipathd checks the current priority of

all path groups. If the current path group is not the highest priority

path group, multipathd reacts according to the failback mode.

By default, multipathd immediately switches to the highest priority

path group. Other options for multipathd are to (a) wait for a

user-defined length of time (for the path groups to stabilize)

and then switch or (b) for multipathd to do nothing and wait for

manual intervention.  Failback can be forced at any time by

running the multipath command.

Multipath device:

The multipath device is the device mapper device created by

dm-multipath. A multipath device can be identified by either

its WWID or its alias. A multipath device has one or more path

groups. It also has numerous attributes defined in the

following file:

/usr/share/doc/device-mapper-multipathd-0.4.5/multipath.conf.annotated

alias:

The alias is the name of a multipath device. By default, the

alias is set to the WWID. However, by setting the

"user_friendly_names" configuration option, the alias is set to a

unique name of the form mpath<n>. The alias name can also be

explicitly set for each multipath device in the configuration file.

NOTE: While the alias in guaranteed to be unique on a node, it

is not guaranteed to be the same on all nodes using the

multipath device. Also, it may change.

WWID:

The WWID (World Wide Identifier) is an identifier for the

multipath device that is guaranteed to be globally unique and

unchanging. It is determined by the getuid callout program.

Using DM-MP

------------------------------------

Initial setup:

1. If it is not already installed. Install the device-mapper-multipath

package.

2. Edit /etc/multipath.conf. For new installations, all devices are blacklisted.

The default blacklist is listed in the commented out section of

/etc/multipath.conf.  If you comment out or delete the following lines in

/etc/multipath.conf, the default blacklist takes effect:

devnode_blacklist {

devnode "*"

}

For some conditions, that may not be sufficient. If DM-MP is

multipathing devices that you do not want it to work on, you can

blacklist the devices by either device name or WWID.

NOTE: It is safest to blacklist individual devices by WWID, because

their device names may change.

Several other configuration options are detailed later in this

document. To check the  effects of configuration changes, you can

do a dry run with the following command:

# multipath -v2 -d

3. Set the multipathd init script to run at boot time. by issuing the commands

# chkconfig --add multipathd

# chkconfig multipathd on

4. start dm-multipath (This is only necessary the first time.  On

reboot, this should happen automatically).

# multipath

# /etc/init.d/multipathd start

After initial setup, all access to the multipathed storage should go through the

multipath device.

GNBD devices will not be automatically multipathed after they are imported.

The command

# multipath

must be run after every time the devices are imported. Otherwise the Multipath

devices will not be created.

Configuration File:

Many features of DM-MP are configurable using the configuration file,

/etc/multipath.conf.

For a complete list of all options with descriptions, refer to

/usr/share/doc/device-mapper-multipathd-0.4.5/multipath.conf.annotated

The configuration file is divided into four sections: system defaults,

blacklisted devices (devnode_blacklist), per storage array model settings

(devices), and per multipath device settings (multipaths).  The per multipath

device settings are used for the multipath device with a matching "wwid"

value. The per storage array model settings are used for all multipath devices

with matching "vendor" and "product" values. To determine the attributes of a

multipath device, first the per multipath settings are checked, then the per

controller settings, then the system defaults.  The blacklisted device section

is described setup step 2.

NOTE: There are compiled-in defaults for the "defaults", "devnode_blacklist",

and "devices" sections of the configuration file. To see what these

are, refer to the following file:

/usr/share/doc/device-mapper-multipathd-0.4.5/multipath.conf.defaults

If you are using one of the storage arrays listed in the preceding

text (in "Overview"), you probably do not need to modify the "devices"

subsection. If you are using a simple disk enclosure, the defaults

should work. If you are using a storage array that is not

listed, you may need to create a "devices" subsection for your array.

Reconfiguring a running system:

If any changes are make to the configuration file that will effect multipathd

(check /usr/share/doc/device-mapper-multipathd-0.4.5/multipath.conf.annotated

to see if mulipathd is in the options scope), you must restart multipathd

for these to take effect. To do that, run

# /etc/init.d/multipathd restart

Explanation of output

-----------------------

When you create, modify, or list a multipath device, you get a printout of

the current device setup. The format is as follows.

For each multipath device:

action_if_any: alias (wwid_if_different_from_alias)

[size][features][hardware_handler]

For each path group:

\_ scheduling_policy [path_group_priority_if_known][path_group_status_if_known]

For each path:

\_ host:channel:id:lun devnode major:minor [dm_status_if_known][path_status]

The dm status (dm_status_if_known) is like the path status

(path_status), but from the kernel‘s point of view.  The dm status has two

states: "failed", which is analogous to "faulty", and "active" which

covers all other path states. Occasionally, the path state and the

dm state of a device will temporarily not agree.

NOTE: When a multipath device is being created or modified, the path group

status and the dm status are not known.  Also, the features are not always

correct. When a multipath device is being listed, the path group priority is not

known.

Restrictions

---------------

DM-MP cannot be run on either the root or boot device.

Other Sources of information

----------------------------

Configuration file explanation:

/usr/share/doc/device-mapper-multipathd-0.4.5/multipath.conf.annotated

Upstream documentation:

http://christophe.varoqui.free.fr/wiki/wakka.php?wiki=Home

mailing list:

[email protected]

Subscribe to this from https://www.redhat.com/mailman/listinfo/dm-devel.

The list archives are at https://www.redhat.com/archives/dm-devel/

Man pages:

multipath.8, multipathd.8, kpartx.8 mpath_ctl.8

http://www.ibm.com/developerworks/cn/linux/l-devmapper/

Device Mapper Multipath(DM-Multipath),布布扣,bubuko.com

时间: 2024-10-10 07:20:55

Device Mapper Multipath(DM-Multipath)的相关文章

使用maven的mybatis-generator代码生成器插件生成实体类、mapper配置文件和mapper接口(使用idea)

接着之前创建的ssmMaven项目 一: 在pom文件中加入mybatis-generator插件 <plugins> <plugin> <groupId>org.mybatis.generator</groupId> <artifactId>mybatis-generator-maven-plugin</artifactId> <version>1.3.2</version> <configuratio

SpringBoot框架之通用mapper插件(tk.mybatis)

一.Tkmybatis的好处 Tkmybatis是在mybatis框架的基础上提供了很多工具,让开发更加高效.这个插件里面封装好了我们需要用到的很多sql语句,不过这个插件是通过我们去调用它封装的各种方法来实现sql语句的效果.对于单表查询不需要写SQL语句,这样就不用像mybatis那样每次写一个接口就要写一条sql语句.这样大大减少了我们的工作量. 拓展:IDEA中使用mybatis-generator自动生成mapper和pojo文件 使用maven命令即可使用:mvn mybatis-g

通用Mapper使用(Maven+SSM)

1.在pom.xml中导入jar包(引入Maven依赖) <!-- 通用mapper --> <dependency> <groupId>com.github.abel533</groupId> <artifactId>mapper</artifactId> <version>2.3.4</version> </dependency> 2.在resources源文件中创建mybatis.xml配置通

SQL映射器Mapper接口(MyBatis)

SQL映射器Mapper接口 MyBatis基于代理机制,可以让我们无需再写Dao的实现.直接把以前的dao接口定义成符合规则的Mapper. 注意事项: 1.接口必须以Mapper结尾,名字是DomainMapper 2.mapper.xml文件要和Mapper接口建立关系,通过namespace:要能连接到Mapper接口   3.mapper.xml中写查询语句的标签的传入参数类型(parameterType).返回结果类型(resultType)必须和mapper接口中对应方法的传入参数

4.MyBatis Mapper代理开发方式(推荐使用)

1 Mapper代理开发方式(推荐) Mapper代理的开发方式,程序员只需要编写mapper接口(相当于dao接口)即可.Mybatis会自动的为mapper接口生成动态代理实现类. 不过要实现mapper代理的开发方式,需要遵循一些开发规范. 1.1  Mapper开发规范 1. mapper接口的全限定名要和mapper映射文件的namespace的值相同. 2. mapper接口的方法名称要和mapper映射文件中的statement的id相同: 3. mapper接口的方法参数只能有一

Spring+SpringMVC+MyBatis深入学习及搭建(二)——MyBatis原始Dao开发和mapper代理开发(转发同上)

前面有写到Spring+SpringMVC+MyBatis深入学习及搭建(一)--MyBatis的基础知识.MybatisFirst中存在大量重复的代码.这次简化下代码: 原地址:http://www.cnblogs.com/shanheyongmu/p/7121016.html 使用MyBatis开发Dao,通常有两种方法,即原始Dao开发方法和Mapper接口开发方法. 1.SqlSession使用范围 1.1 SqlsessionFactoryBuilder 通过SqlSessionFac

mapper代理(十一)

原始 dao开发问题 1.dao接口实现类方法中存在大量模板方法,设想能否将这些代码提取出来,大大减轻程序员的工作量. 2.调用sqlsession方法时将statement的id硬编码了 3.调用sqlsession方法时传入的变量,由于sqlsession方法使用泛型,即使变量类型传入错误(传入的是泛型类),在编译阶段也不报错,不利于程序员开发. mapper代理方法(程序员只需要mapper接口(相当 于dao接口)) 思路(mapper代理开发规范): Mapper代理开发避免了原始的d

理解Device Tree Usage(续)

4 How Interrupts work 与遵循树的自然结构的地址范围转换不同, 中断信号可以起源于或者终止于板卡上的任何设备. 与设备树中自然表示的设备寻址不同,中断信号的表示独立于设备树节点之间的连接.通常用下面的四个属性来描述一个中断连接: interrupt-controller - 一个空属性,声明一个接收中断信号的设备节点 #interrupt-cells -  这是中断控制器节点的一个属性.它声明中断控制器的 interrupt specifier(中断描述符)占用多少单元格(类

Linux 内核中的 Device Mapper 机制

http://www.68idc.cn/help/server/linux/20141127133367.html 结合具体代码对 Linux 内核中的 device mapper 映射机制进行了介绍.Device mapper 是 Linux 2.6 内核中提供的一种从逻辑设备到物 简介: 本文结合具体代码对 Linux 内核中的 device mapper 映射机制进行了介绍.Device mapper 是 Linux 2.6 内核中提供的一种从逻辑设备到物理设备的映射框架机制,在该机制下,