{"id":1036,"date":"2017-12-11T15:51:10","date_gmt":"2017-12-11T07:51:10","guid":{"rendered":"http:\/\/www.821121.com\/?p=1036"},"modified":"2020-12-11T15:53:44","modified_gmt":"2020-12-11T07:53:44","slug":"linux6-multipath-udev-%e9%85%8d%e7%bd%ae%e8%99%9a%e6%8b%9f%e6%9c%ba%e5%85%b1%e4%ba%ab%e5%ad%98%e5%82%a8","status":"publish","type":"post","link":"http:\/\/www.821121.com\/?p=1036","title":{"rendered":"linux6-multipath +udev \u914d\u7f6e\u865a\u62df\u673a\u5171\u4eab\u5b58\u50a8"},"content":{"rendered":"<h1>1.\u53cc\u8282\u70b9\u5b89\u88c5multipath\u7684\u5305,\u5148\u540e\u987a\u5e8f\u4e0d\u80fd\u4e71\uff1a<\/h1>\n<pre><code class=\"language-sql\">rpm -ivh device-mapper-multipath-libs-0.4.9-93.el6.x86_64.rpm\nrpm -ivh device-mapper-multipath-0.4.9-93.el6.x86_64.rpm<\/code><\/pre>\n<h1>2.\u542f\u52a8multipath\uff08rac1\u3001rac2\u90fd\u8dd1\uff09<\/h1>\n<pre><code class=\"language-sql\">modprobe dm-multipath\nmodprobe dm-round-robin\n\u68c0\u67e5\u5185\u6838\u6dfb\u52a0\u60c5\u51b5\uff1a\nlsmod |grep multipath\n\u5c06\u591a\u8def\u5f84\u8f6f\u4ef6multipath\u8bbe\u7f6e\u672a\u5f00\u673a\u81ea\u542f\u52a8\nchkconfig --level 2345 multipathd on \/\/ chkconfig multipathd on\nchkconfig --list|grep multipathd\nmultipathd   0:\u5173\u95ed 1:\u5173\u95ed 2:\u542f\u7528 3:\u542f\u7528 4:\u542f\u7528  5:\u542f\u7528  6:\u5173\u95ed\n\u542f\u52a8multipath\u670d\u52a1\uff1a\nservice multipathd restart<\/code><\/pre>\n<h1>3.\u591a\u8def\u5f84\u914d\u7f6e\uff08rac\u3001rac2\uff09<\/h1>\n<pre><code class=\"language-sql\">oracle RAC\u6240\u9700\u591a\u8def\u5f84\u914d\u7f6e\u8981\u70b9\u662f\u4e00\u4e2aRAC\u8282\u70b9\u4e00\u4e2aRAC\u8282\u70b9\u4e00\u6b21\u6267\u884c\u5982\u4e0b\u64cd\u4f5c\uff08\u5982\u679c\u9700\u8981\u518d\u6dfb\u52a0\u4f7f\u7528\u591a\u8def\u5f84\u7684\u5b58\u50a8\uff0c\u4e5f\u9700\u9075\u5faa\u5982\u4e0b\u6b65\u9aa4\uff09\uff1a\nservice multipathd stop\nmultipath -F\n\n\u6240\u5f97\u6240\u6709\u5b58\u50a8\u7684lun\u7684wwid\uff1a\nfor i in `cat \/proc\/partitions | awk {&#039;print $4&#039;} |grep sd`; do val=`\/sbin\/blockdev --getsize64 \/dev\/$i` ; val2=`expr $val \/ 1073741824`; echo &quot;\/dev\/$i: $val2 `scsi_id -gud \/dev\/$i`&quot; ; done\n\n\u5148\u67e5\u770b\u662f\u5426\u5b58\u5728\/etc\/multipath.conf\uff0c\u4e0d\u5b58\u5728\n\u65b9\u6cd51:\u521b\u5efa\u914d\u7f6e\u6587\u4ef6\uff1acp \/etc\/multipath_bak.conf   \/etc\/multipath.conf\nvi \/etc\/multipath.conf\n\ndefaults {\nuser_friendly_names yes\n}\n\ndevices {\ndevice {  \nvendor &quot;(COMPAQ|HP)&quot;\nproduct &quot;HSV1[01]1|HSV2[01]0|HSV300|HSV4[05]0&quot;\n#getuid_callout &quot;\/lib\/udev\/scsi_id --whitelisted --device=\/dev\/%n&quot;\nfeatures &quot;0&quot;\nhardware_handler &quot;0&quot;\npath_selector &quot;round-robin 0&quot;\npath_grouping_policy group_by_prio\nfailback immediate\nrr_weight uniform\nno_path_retry 12\nrr_min_io 1000\npath_checker tur\nprio alua\n}\n}\n\nmultipaths {\n\n        multipath {                                                                               \/\/\u6bcf\u591a\u4e00\u5757\u76d8\uff0c\u52a0\u8fd9\u4e2a\u4e00\u7ec4\u3002\n                wwid                    36000c29834a381e8a88835b639a373b5\n                alias                   OCR\n                path_grouping_policy    multibus\n                path_selector           &quot;round-robin 0&quot;\n                failback                immediate\n                rr_weight               priorities\n                no_path_retry           queue\n    }\n}\n\nmultipaths {\n\n        multipath {                                                                               \/\/\u6bcf\u591a\u4e00\u5757\u76d8\uff0c\u52a0\u8fd9\u4e2a\u4e00\u7ec4\u3002\n                wwid                    36000c296018de505012ccd5854db468f\n                alias                   DATA\n                path_grouping_policy    multibus\n                path_selector           &quot;round-robin 0&quot;\n                failback                immediate\n                rr_weight               priorities\n                no_path_retry           queue\n    }\n}\n\nmultipaths {\n\n        multipath {                                                                               \/\/\u6bcf\u591a\u4e00\u5757\u76d8\uff0c\u52a0\u8fd9\u4e2a\u4e00\u7ec4\u3002\n                wwid                    36000c297448260e8adee440316e9c11b\n                alias                   ARCH\n                path_grouping_policy    multibus\n                path_selector           &quot;round-robin 0&quot;\n                failback                immediate\n                rr_weight               priorities\n                no_path_retry           queue\n    }\n}\n\nblacklist {\n        devnode &quot;^(sda|ram|raw|loop|fd|md|dm-|sr|scd|st)[0-9]*&quot;\n        devnode &quot;^hd[a-z]&quot;\n        devnode &quot;^asm\/*&quot;         # Here\n        devnode &quot;ofsctl&quot;             # Here\n}\n\n#\u542f\u52a8\u591a\u8def\u5f84\uff1a\nservice multipathd restart\n\n\u542f\u52a8multipath\u914d\u7f6e\u540e\uff0c\u4f1a\u5728\/dev\/mapper\u4e0b\u751f\u6210\u591a\u8def\u5f84\u903b\u8f91\u76d8\ncd \/dev\/mapper\nll\n#\u67e5\u770b\u591a\u8def\u5f84\u7684\u72b6\u6001\uff1amultipath -ll<\/code><\/pre>\n<h1>4.\u914d\u7f6eudev\uff0c\u66f4\u6539\u5c5e\u7ec4<\/h1>\n<pre><code class=\"language-sql\">vi \/etc\/udev\/rules.d\/99-oracle-asmdevices.rules\nENV{DM_NAME}==&quot;OCR&quot;, OWNER:=&quot;grid&quot;, GROUP:=&quot;asmadmin&quot;, MODE:=&quot;0660&quot;, SYMLINK+=&quot;iscsi\/oraasm-$env{DM_NAME}&quot;\nENV{DM_NAME}==&quot;DATA&quot;, OWNER:=&quot;grid&quot;, GROUP:=&quot;asmadmin&quot;, MODE:=&quot;0660&quot;, SYMLINK+=&quot;iscsi\/oraasm-$env{DM_NAME}&quot;\nENV{DM_NAME}==&quot;ARCH&quot;, OWNER:=&quot;grid&quot;, GROUP:=&quot;asmadmin&quot;, MODE:=&quot;0660&quot;, SYMLINK+=&quot;iscsi\/oraasm-$env{DM_NAME}&quot;\n\n\u91cd\u542fudev\n[root@sanan1 rules.d]# start_udev\n\u6b63\u5728\u542f\u52a8 udev\uff1a                                            [\u786e\u5b9a]<\/code><\/pre>\n<h1>5\u3001\u9a8c\u8bc1\u662f\u5426\u6210\u529f<\/h1>\n<pre><code class=\"language-sql\">ls \/dev\/iscsi\/\noraasm-arch1   oraasm-mes1.2  oraasm-mes1.4  oraasm-mes2.2  oraasm-ocr2\noraasm-mes1.1  oraasm-mes1.3  oraasm-mes2.1  oraasm-ocr1    oraasm-ocr3\n---\u9a8c\u8bc1\u6743\u9650\n ls -l \/dev\/dm-*\n---\u9a8c\u8bc1\u547d\u540d\u7ed3\u679c\nls -l \/dev\/mapper\/*<\/code><\/pre>\n","protected":false},"excerpt":{"rendered":"<p>1.\u53cc\u8282\u70b9\u5b89\u88c5multipath\u7684\u5305,\u5148\u540e\u987a\u5e8f\u4e0d\u80fd<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[33],"tags":[],"class_list":["post-1036","post","type-post","status-publish","format-standard","hentry","category-linux"],"_links":{"self":[{"href":"http:\/\/www.821121.com\/index.php?rest_route=\/wp\/v2\/posts\/1036","targetHints":{"allow":["GET"]}}],"collection":[{"href":"http:\/\/www.821121.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/www.821121.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/www.821121.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/www.821121.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=1036"}],"version-history":[{"count":1,"href":"http:\/\/www.821121.com\/index.php?rest_route=\/wp\/v2\/posts\/1036\/revisions"}],"predecessor-version":[{"id":1037,"href":"http:\/\/www.821121.com\/index.php?rest_route=\/wp\/v2\/posts\/1036\/revisions\/1037"}],"wp:attachment":[{"href":"http:\/\/www.821121.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=1036"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/www.821121.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=1036"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/www.821121.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=1036"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}