{"id":335,"date":"2013-08-12T16:00:40","date_gmt":"2013-08-12T16:00:40","guid":{"rendered":"f9b902fc3289af4dd08de5d1de54f68f"},"modified":"2013-08-12T16:00:40","modified_gmt":"2013-08-12T16:00:40","slug":"","status":"publish","type":"post","link":"https:\/\/www.xiaobo.li\/notes\/archives\/335","title":{"rendered":"DRBD"},"content":{"rendered":"<h3 id=\"DRBD\u4ecb\u7ecd\">DRBD\u4ecb\u7ecd<\/h3>\n<p><a title=\"DRBD\" href=\"http:\/\/www.centos.bz\/tag\/drbd\/\">DRBD<\/a>\u662f\u4e00\u4e2a\u7528\u8f6f\u4ef6\u5b9e\u73b0\u7684\u3001\u65e0\u5171\u4eab\u7684\u3001\u670d\u52a1\u5668\u4e4b\u95f4\u955c\u50cf\u5757\u8bbe\u5907\u5185\u5bb9\u7684\u5b58\u50a8\u590d\u5236\u89e3\u51b3\u65b9\u6848\u3002 DRBD Logo\u6570\u636e\u955c\u50cf\uff1a\u5b9e\u65f6\u3001\u900f\u660e\u3001\u540c\u6b65\uff08\u6240\u6709\u670d\u52a1\u5668\u90fd\u6210\u529f\u540e\u8fd4\u56de\uff09\u3001\u5f02\u6b65\uff08\u672c\u5730\u670d\u52a1\u5668\u6210\u529f\u540e\u8fd4\u56de\uff09\u3002DBRD\u7684\u6838\u5fc3\u529f\u80fd\u901a\u8fc7<a title=\"Linux\" href=\"http:\/\/www.centos.bz\/\">Linux<\/a>\u7684\u5185\u6838\u5b9e\u73b0\uff0c\u6700\u63a5\u8fd1\u7cfb\u7edf\u7684IO\u6808\uff0c\u4f46\u5b83\u4e0d\u80fd\u795e\u5947\u5730\u6dfb\u52a0\u4e0a\u5c42\u7684\u529f\u80fd\u6bd4\u5982\u68c0\u6d4b\u5230EXT3\u6587\u4ef6\u7cfb\u7edf\u7684\u5d29\u6e83\u3002DBRD\u7684\u4f4d\u7f6e\u5904\u4e8e\u6587\u4ef6\u7cfb\u7edf\u4ee5\u4e0b\uff0c\u6bd4\u6587\u4ef6\u7cfb\u7edf\u66f4\u52a0\u9760\u8fd1\u64cd\u4f5c\u7cfb\u7edf\u5185\u6838\u53caIO\u6808\u3002<\/p>\n<h3 id=\"DRBD\u7f16\u8bd1\u5b89\u88c5\">DRBD\u7f16\u8bd1\u5b89\u88c5<\/h3>\n<p>\u5b89\u88c5\u6240\u9700\u4f9d\u8d56:<\/p>\n<div class=\"hl-surround\">\n<ol class=\"hl-main ln-show\" title=\"Double click to hide line number.\">\n<li class=\"hl-firstline\">yum -y install gcc kernel-devel kernel-headers flex<\/li>\n<\/ol>\n<\/div>\n<p>\u5f00\u59cb\u5b89\u88c5drbd\uff0c\u4e0b\u8f7d\u5730\u5740\uff1a<a href=\"http:\/\/oss.linbit.com\/drbd\/\" target=\"_blank\">http:\/\/oss.linbit.com\/drbd\/<\/a><br \/>\n<strong>\u5b89\u88c5\u7528\u6237\u7a7a\u95f4\u5de5\u5177\uff1a<\/strong><\/p>\n<div class=\"hl-surround\">\n<ol class=\"hl-main ln-show\" title=\"Double click to hide line number.\">\n<li class=\"hl-firstline\">cd \/tmp<\/li>\n<li>wget http:\/\/oss.linbit.com\/drbd\/8.4\/drbd-8.4.1.tar.gz<\/li>\n<li>tar xzf drbd-8.4.1.tar.gz<\/li>\n<li>cd drbd-8.4.1<\/li>\n<li>.\/configure --prefix=\/usr\/local\/drbd --with-km<\/li>\n<li>make KDIR=\/usr\/src\/kernels\/2.6.18-274.18.1.el5-i686\/<\/li>\n<li>make install<\/li>\n<li>mkdir -p \/usr\/local\/drbd\/var\/run\/drbd<\/li>\n<li>cp \/usr\/local\/drbd\/etc\/rc.d\/init.d\/drbd \/etc\/rc.d\/init.d<\/li>\n<li>chkconfig --add drbd<\/li>\n<li>chkconfig drbd on<\/li>\n<\/ol>\n<\/div>\n<p><strong>\u5b89\u88c5drbd\u6a21\u5757:<\/strong><\/p>\n<div class=\"hl-surround\">\n<ol class=\"hl-main ln-show\" title=\"Double click to hide line number.\">\n<li class=\"hl-firstline\">cd drbd<\/li>\n<li>make clean<\/li>\n<li>make KDIR=\/usr\/src\/kernels\/2.6.18-274.18.1.el5-i686\/<\/li>\n<li>cp drbd.ko \/lib\/modules\/`uname -r`\/kernel\/lib\/<\/li>\n<li>depmod<\/li>\n<\/ol>\n<\/div>\n<p><span style=\"color:red;\">\u6ce8\uff1ausr\/src\/kernels\/2.6.18-274.18.1.el5-i686\/\u8fd9\u4e2a\u5185\u6838\u6e90\u7801\u6811\u8def\u5f84\u9700\u8981\u6839\u636e\u81ea\u5df1\u7684\u7cfb\u7edf\u4fee\u6539\u3002<\/span><\/p>\n<h3 id=\"DRBD\u914d\u7f6e\">DRBD\u914d\u7f6e<\/h3>\n<h4 id=\"\u5efa\u7acb\u5206\u533a\">\u5efa\u7acb\u5206\u533a<\/h4>\n<p>\u5047\u5982\u73b0\u5728\u6709\u7b2c\u4e8c\u5757\u786c\u76d8hdb\uff0c\u4e24\u4e2anode\u90fd\u8981\u5206\u533a\u3002<\/p>\n<div class=\"hl-surround\">\n<ol class=\"hl-main ln-show\" title=\"Double click to hide line number.\">\n<li class=\"hl-firstline\">#fdisk \/dev\/hdb&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; \/\/\u51c6\u5907\u4e3a hdb \u5efa\u7acb\u5206\u533a<\/li>\n<li>&nbsp;The number of cylinders for this disk is set to 20805.<\/li>\n<li>&nbsp;There is nothing wrong with that, but this is larger than 1024,<\/li>\n<li>&nbsp;and could in certain setups cause problems with:<\/li>\n<li>&nbsp;1) software that runs at boot time (e.g., old versions of LILO)<\/li>\n<li>&nbsp;2) booting and partitioning software from other OSs<\/li>\n<li>&nbsp;&nbsp; (e.g., DOS FDISK, OS\/2 FDISK)<\/li>\n<li>&nbsp;Command (m for help): n&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; \/\/\u952e\u5165 n \u8868\u793a\u8981\u5efa\u7acb\u5206\u533a<\/li>\n<li>&nbsp;Command action<\/li>\n<li>&nbsp;&nbsp; &nbsp;e&nbsp; &nbsp;extended<\/li>\n<li>&nbsp;&nbsp; &nbsp;p&nbsp; &nbsp;primary partition (1-4)<\/li>\n<li>&nbsp;p&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; \/\/\u952e\u5165 p \u8868\u793a\u5efa\u7acb\u4e3b\u8981\u5206\u533a<\/li>\n<li>&nbsp;Partition number (1-4): 1&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; \/\/\u952e\u5165 1 \u4e3a\u6b64\u4e3b\u8981\u5206\u533a\u4ee3\u53f7<\/li>\n<li>&nbsp;First cylinder (1-20805, default 1):&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;\/\/\u5f00\u59cb\u78c1\u67f1\u503c\uff0c\u6309\u4e0b enter \u5373\u53ef<\/li>\n<li>&nbsp;Using default value 1<\/li>\n<li>&nbsp;Last cylinder or +size or +sizeM or +sizeK (1-20805, default 20805): \/\/\u7ed3\u675f\u78c1\u67f1\u503c\uff0c\u6309\u4e0b enter \u5373\u53ef<\/li>\n<li>&nbsp;Using default value 20805<\/li>\n<li>&nbsp;Command (m for help): w&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; \/\/\u952e\u5165 w \u8868\u793a\u786e\u5b9a\u6267\u884c\u521a\u624d\u8bbe\u5b9a<\/li>\n<li>&nbsp;The partition table has been altered!<\/li>\n<li>&nbsp;Calling ioctl() to re-read partition table.<\/li>\n<li>&nbsp;Syncing disks.<\/li>\n<li>&nbsp;[root@node1 yum.repos.d]# partprobe&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; \/\/\u4f7f\u521a\u624d\u7684 partition table \u53d8\u66f4\u751f\u6548<\/li>\n<\/ol>\n<\/div>\n<p>\u5efa\u7acb\u5206\u533a\u5b8c\u6210\u540e\u4f7f\u7528\u6307\u4ee4 fdisk -l \u786e\u5b9a partition talbe \u72b6\u6001<\/p>\n<div class=\"hl-surround\">\n<ol class=\"hl-main ln-show\" title=\"Double click to hide line number.\">\n<li class=\"hl-firstline\">#fdisk -l<\/li>\n<li>&nbsp;Disk \/dev\/hda: 21.4 GB, 21474754560 bytes<\/li>\n<li>&nbsp;255 heads, 63 sectors\/track, 2610 cylinders<\/li>\n<li>&nbsp;Units = cylinders of 16065 * 512 = 8225280 bytes<\/li>\n<li>&nbsp;&nbsp; &nbsp;Device Boot&nbsp; &nbsp; &nbsp; Start&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;End&nbsp; &nbsp; &nbsp; Blocks&nbsp; &nbsp;Id&nbsp; System<\/li>\n<li>&nbsp;\/dev\/hda1&nbsp; &nbsp;*&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;1&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 13&nbsp; &nbsp; &nbsp; 104391&nbsp; &nbsp;83&nbsp; Linux<\/li>\n<li>&nbsp;\/dev\/hda2&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 14&nbsp; &nbsp; &nbsp; &nbsp; 2610&nbsp; &nbsp; 20860402+&nbsp; 8e&nbsp; Linux LVM<\/li>\n<li>&nbsp;Disk \/dev\/hdb: 10.7 GB, 10737377280 bytes<\/li>\n<li>&nbsp;16 heads, 63 sectors\/track, 20805 cylinders<\/li>\n<li>&nbsp;Units = cylinders of 1008 * 512 = 516096 bytes<\/li>\n<li>&nbsp;&nbsp; &nbsp;Device Boot&nbsp; &nbsp; &nbsp; Start&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;End&nbsp; &nbsp; &nbsp; Blocks&nbsp; &nbsp;Id&nbsp; System<\/li>\n<li>&nbsp;\/dev\/hdb1&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;1&nbsp; &nbsp; &nbsp; &nbsp;20805&nbsp; &nbsp; 10485688+&nbsp; 83&nbsp; Linux<\/li>\n<\/ol>\n<\/div>\n<p>\u5efa\u7acb\u5206\u533a\u5b8c\u6210\u540e\u8bf7\u5efa\u7acb \/db \u76ee\u5f55\u3002 (Node1 \u53ca Node2 \u90fd\u5fc5\u987b\u5efa\u7acb)<\/p>\n<div class=\"hl-surround\">\n<ol class=\"hl-main ln-show\" title=\"Double click to hide line number.\">\n<li class=\"hl-firstline\">#mkdir \/db<\/li>\n<\/ol>\n<\/div>\n<h4 id=\"\u5efa\u7acbdrbd\u914d\u7f6e\u6587\u4ef6\">\u5efa\u7acbdrbd\u914d\u7f6e\u6587\u4ef6<\/h4>\n<p>\u4e3b\u8981\u5b9a\u4e49\u4e24\u5757global\u548cresource\u3002<\/p>\n<div class=\"hl-surround\">\n<ol class=\"hl-main ln-show\" title=\"Double click to hide line number.\">\n<li class=\"hl-firstline\">vi \/usr\/local\/drbd\/etc\/drbd.conf<\/li>\n<\/ol>\n<\/div>\n<p>\u5199\u5165\uff1a<\/p>\n<div class=\"hl-surround\">\n<ol class=\"hl-main ln-show\" title=\"Double click to hide line number.\">\n<li class=\"hl-firstline\">include \"drbd.d\/global_common.conf\";<\/li>\n<li>include \"drbd.d\/*.res\";<\/li>\n<\/ol>\n<\/div>\n<div class=\"hl-surround\">\n<ol class=\"hl-main ln-show\" title=\"Double click to hide line number.\">\n<li class=\"hl-firstline\">vi \/usr\/local\/drbd\/etc\/drbd.d\/global_common.conf<\/li>\n<\/ol>\n<\/div>\n<p>\u5199\u5165\uff1a<\/p>\n<div class=\"hl-surround\">\n<ol class=\"hl-main ln-show\" title=\"Double click to hide line number.\">\n<li class=\"hl-firstline\">global {<\/li>\n<li>&nbsp; usage-count yes;<\/li>\n<li>}<\/li>\n<li>common {<\/li>\n<li>&nbsp; net {<\/li>\n<li>&nbsp;&nbsp; &nbsp;protocol C;<\/li>\n<li>&nbsp; }<\/li>\n<li>}<\/li>\n<\/ol>\n<\/div>\n<div class=\"hl-surround\">\n<ol class=\"hl-main ln-show\" title=\"Double click to hide line number.\">\n<li class=\"hl-firstline\">vi \/usr\/local\/drbd\/etc\/drbd.d\/r0.res<\/li>\n<\/ol>\n<\/div>\n<p>\u5199\u5165\uff1a<\/p>\n<div class=\"hl-surround\">\n<ol class=\"hl-main ln-show\" title=\"Double click to hide line number.\">\n<li class=\"hl-firstline\">resource r0 {<\/li>\n<li>&nbsp; on node1 {<\/li>\n<li>&nbsp;&nbsp; &nbsp;device&nbsp; &nbsp; \/dev\/drbd1;<\/li>\n<li>&nbsp;&nbsp; &nbsp;disk&nbsp; &nbsp; &nbsp; \/dev\/hdb1;<\/li>\n<li>&nbsp;&nbsp; &nbsp;address&nbsp; &nbsp;192.168.1.101:7789;<\/li>\n<li>&nbsp;&nbsp; &nbsp;meta-disk internal;<\/li>\n<li>&nbsp; }<\/li>\n<li>&nbsp; on node2 {<\/li>\n<li>&nbsp;&nbsp; &nbsp;device&nbsp; &nbsp; \/dev\/drbd1;<\/li>\n<li>&nbsp;&nbsp; &nbsp;disk&nbsp; &nbsp; &nbsp; \/dev\/hdb1;<\/li>\n<li>&nbsp;&nbsp; &nbsp;address&nbsp; &nbsp;192.168.1.103:7789;<\/li>\n<li>&nbsp;&nbsp; &nbsp;meta-disk internal;<\/li>\n<li>&nbsp; }<\/li>\n<li>}<\/li>\n<\/ol>\n<\/div>\n<h4 id=\"\u8bbe\u7f6ehostname\">\u8bbe\u7f6ehostname<\/h4>\n<p>\u6839\u636e\u4e0a\u9762\u7684resource\u914d\u7f6e\u6587\u4ef6\uff0c\u9700\u8981\u5bf9192.168.1.101\u548c192.168.1.103\u5206\u522b\u8bbe\u7f6ehostname\u4e3anode1\u548cnode2\uff0c\u8bbe\u7f6e\u65b9\u6cd5\u5982\u4e0b:<\/p>\n<div class=\"hl-surround\">\n<ol class=\"hl-main ln-show\" title=\"Double click to hide line number.\">\n<li class=\"hl-firstline\">vi \/etc\/sysconfig\/network<\/li>\n<\/ol>\n<\/div>\n<p>\u4fee\u6539HOSTNAME\u4e3anode1<\/p>\n<div class=\"hl-surround\">\n<ol class=\"hl-main ln-show\" title=\"Double click to hide line number.\">\n<li class=\"hl-firstline\">vi \/etc\/hosts<\/li>\n<\/ol>\n<\/div>\n<p>\u586b\u5165:<\/p>\n<div class=\"hl-surround\">\n<ol class=\"hl-main ln-show\" title=\"Double click to hide line number.\">\n<li class=\"hl-firstline\">192.168.1.101 node1<\/li>\n<li>192.168.1.103 node2<\/li>\n<\/ol>\n<\/div>\n<p>\u4f7fnode1 hostnmae\u4e34\u65f6\u751f\u6548<\/p>\n<div class=\"hl-surround\">\n<ol class=\"hl-main ln-show\" title=\"Double click to hide line number.\">\n<li class=\"hl-firstline\">hostname node1<\/li>\n<\/ol>\n<\/div>\n<p>node2\u673a\u5668\u8bbe\u7f6e\u7c7b\u4f3c\u3002<\/p>\n<h4 id=\"\u8bbe\u7f6eresource\">\u8bbe\u7f6eresource<\/h4>\n<p>\u4ee5\u4e0b\u64cd\u4f5c\u9700\u8981\u5728node1\u548cnode2\u64cd\u4f5c\u3002<\/p>\n<div class=\"hl-surround\">\n<ol class=\"hl-main ln-show\" title=\"Double click to hide line number.\">\n<li class=\"hl-firstline\">#modprobe drbd&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; \/\/\u8f7d\u5165 drbd \u6a21\u5757<\/li>\n<li>#lsmod|grep drbd&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; \/\/\u786e\u8ba4 drbd \u6a21\u5757\u662f\u5426\u8f7d\u5165<\/li>\n<li>&nbsp;drbd&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 228528&nbsp; 0<\/li>\n<li>&nbsp;#dd if=\/dev\/zero of=\/dev\/hdb1 bs=1M count=100&nbsp; &nbsp; &nbsp;\/\/\u628a\u4e00\u4e9b\u8d44\u6599\u585e\u5230 hdb \u5167 (\u5426\u5219 create-md \u65f6\u6709\u53ef\u80fd\u4f1a\u51fa\u73b0\u9519\u8bef)<\/li>\n<li>&nbsp;#drbdadm create-md r0&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;\/\/\u5efa\u7acb drbd resource<\/li>\n<li>&nbsp;#drbdadm up r0&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; \/\/\u542f\u52a8 resource r0<\/li>\n<\/ol>\n<\/div>\n<p>\u67e5\u770bnode1\u548cnode2\u7684\u72b6\u6001\u5e94\u8be5\u7c7b\u4f3c\u4e0b\u9762\u7684\uff1a<\/p>\n<div class=\"hl-surround\">\n<ol class=\"hl-main ln-show\" title=\"Double click to hide line number.\">\n<li class=\"hl-firstline\">cat \/proc\/drbd<\/li>\n<\/ol>\n<\/div>\n<div class=\"hl-surround\">\n<ol class=\"hl-main ln-show\" title=\"Double click to hide line number.\">\n<li class=\"hl-firstline\">version: 8.4.1 (api:1\/proto:86-100)<\/li>\n<li>GIT-hash: 91b4c048c1a0e06777b5f65d312b38d47abaea80 build by root@localhost.localdomain, 2012-02-12 06:05:36<\/li>\n<li>&nbsp;m:res&nbsp; cs&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;ro&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;ds&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;p&nbsp; mounted&nbsp; fstype<\/li>\n<li>&nbsp;0:r0&nbsp; &nbsp;Connected&nbsp; Secondary\/Secondary&nbsp; Inconsistent\/Inconsistent&nbsp; C<\/li>\n<\/ol>\n<\/div>\n<p>\u8868\u660e\u73b0\u5728\u5df2\u7ecf\u542f\u52a8\u670d\u52a1\uff0c\u4f46\u8fd8\u6ca1\u6709\u8bbe\u7f6e\u540c\u6b65\uff08\u5373\u9700\u8981\u8bbe\u7f6ePrimary Node\uff09<\/p>\n<h4 id=\"\u8bbe\u7f6ePrimary Node\">\u8bbe\u7f6ePrimary Node<\/h4>\n<p>\u4ee5\u4e0b\u64cd\u4f5c\u4ec5\u5728node1\u6267\u884c\u3002<br \/>\n\u8bbe\u7f6enode1\u4e3aprimary node:<\/p>\n<div class=\"hl-surround\">\n<ol class=\"hl-main ln-show\" title=\"Double click to hide line number.\">\n<li class=\"hl-firstline\">drbdadm primary --force r0<\/li>\n<\/ol>\n<\/div>\n<p>\u518d\u6b21\u67e5\u770bnode1\u7684\u72b6\u6001\uff1a<\/p>\n<div class=\"hl-surround\">\n<ol class=\"hl-main ln-show\" title=\"Double click to hide line number.\">\n<li class=\"hl-firstline\">#cat \/proc\/drbd<\/li>\n<li>version: 8.4.1 (api:1\/proto:86-100)<\/li>\n<li>GIT-hash: 91b4c048c1a0e06777b5f65d312b38d47abaea80 build by root@localhost.localdomain, 2012-02-12 06:47:37<\/li>\n<li>&nbsp;<\/li>\n<li>&nbsp;1: cs:Connected ro:Primary\/Secondary ds:UpToDate\/UpToDate C r-----<\/li>\n<li>&nbsp;&nbsp; &nbsp;ns:52892 nr:0 dw:0 dr:52892 al:0 bm:10 lo:0 pe:0 ua:0 ap:0 ep:1 wo:b oos:0<\/li>\n<\/ol>\n<\/div>\n<p>\u6211\u4eec\u770b\u5230\u72b6\u6001\u5df2\u7ecf\u53d8\u6210Primary\/Secondary\uff0c\u5373\u8bbe\u7f6eprimary node\u6210\u529f\u3002<\/p>\n<h4 id=\"\u521b\u5efaDRBD\u6587\u4ef6\u7cfb\u7edf\">\u521b\u5efaDRBD\u6587\u4ef6\u7cfb\u7edf<\/h4>\n<p>\u4ee5\u4e0b\u64cd\u4f5c\u4ec5\u5728node1\u6267\u884c\u3002<br \/>\n\u4e0a\u9762\u5df2\u7ecf\u5b8c\u6210\u4e86\/dev\/drbd1\u7684\u521d\u59cb\u5316\uff0c\u73b0\u5728\u6765\u628a\/dev\/drbd1\u683c\u5f0f\u5316\u6210ext3\u683c\u5f0f\u7684\u6587\u4ef6\u7cfb\u7edf\u3002<\/p>\n<div class=\"hl-surround\">\n<ol class=\"hl-main ln-show\" title=\"Double click to hide line number.\">\n<li class=\"hl-firstline\">#mkfs.ext3 \/dev\/drbd1<\/li>\n<\/ol>\n<\/div>\n<p>\u7136\u540e\u5c06\/dev\/drbd1\u6302\u8f7d\u5230\u4e4b\u524d\u521b\u5efa\u7684\/db\u76ee\u5f55\u3002<\/p>\n<div class=\"hl-surround\">\n<ol class=\"hl-main ln-show\" title=\"Double click to hide line number.\">\n<li class=\"hl-firstline\">#mount \/dev\/drbd1 \/db<\/li>\n<\/ol>\n<\/div>\n<p>\u73b0\u5728\u4f60\u53ea\u8981\u628a\u6570\u636e\u5199\u5165\/db\u76ee\u5f55\uff0cdrbd\u5373\u4f1a\u7acb\u523b\u628a\u6570\u636e\u540c\u6b65\u5230\u5907\u673a192.168.1.103\u7684\/dev\/hdb1\u5206\u533a\u4e0a\u3002<\/p>\n<h4 id=\"drbd\u540c\u6b65\u6d4b\u8bd5\">drbd\u540c\u6b65\u6d4b\u8bd5<\/h4>\n<p>\u5f53\u5728\u5907\u673anode2\u542f\u52a8drbd\u65f6\uff0c\u5b83\u662f\u65e0\u6cd5\u6302\u8f7d\/dev\/hdb1\u5206\u533a\u7684\uff0c\u6211\u4eec\u53ef\u4ee5\u5c1d\u8bd5\u5199\u4e9b\u6570\u636e\u5230node1\u7684\u76ee\u5f55\/db\u4e0a\uff0c\u7136\u540e\u505c\u6b62node2\u7684drbd\u3002<\/p>\n<div class=\"hl-surround\">\n<ol class=\"hl-main ln-show\" title=\"Double click to hide line number.\">\n<li class=\"hl-firstline\">drbdadm down r0<\/li>\n<\/ol>\n<\/div>\n<p>\u4e4b\u540e\u5c31\u53ef\u4ee5\u628anode2\u7684\/dev\/hdb1\u6302\u8f7d\u5230\u76ee\u5f55\/db<\/p>\n<div class=\"hl-surround\">\n<ol class=\"hl-main ln-show\" title=\"Double click to hide line number.\">\n<li class=\"hl-firstline\">mount -t ext3 \/dev\/hdb1 \/db<\/li>\n<\/ol>\n<\/div>\n<p>\u6211\u4eec\u5c31\u53ef\u4ee5\u67e5\u770bnode2\u7684\/db\u76ee\u5f55\u662f\u5426\u6709node1\u7684\u6570\u636e\u3002<\/p>\n<h4 id=\"\u624b\u52a8\u5207\u6362\u4e3b\u5907\u673a\">\u624b\u52a8\u5207\u6362\u4e3b\u5907\u673a<\/h4>\n<p>\u6211\u4eec\u53ef\u4ee5\u628anode1\u6539\u53d8\u4e3a\u5907\u673a\uff0c\u800cnode2\u6539\u53d8\u4e3a\u4e3b\u673a\u3002<br \/>\n\u5728node1\u4e0a\u64cd\u4f5c\uff1a<\/p>\n<div class=\"hl-surround\">\n<ol class=\"hl-main ln-show\" title=\"Double click to hide line number.\">\n<li class=\"hl-firstline\">umount \/dev\/drbd1<\/li>\n<li>drbdadm secondary r0<\/li>\n<\/ol>\n<\/div>\n<p>\u5728node2\u4e0a\u64cd\u4f5c\uff1a<\/p>\n<div class=\"hl-surround\">\n<ol class=\"hl-main ln-show\" title=\"Double click to hide line number.\">\n<li class=\"hl-firstline\">drbdadm primary r0<\/li>\n<\/ol>\n<\/div>\n<p>\u6b64\u65f6\u5e94\u8be5\u5df2\u7ecf\u5207\u6362\u6210\u529f<\/p>\n<p>&nbsp;<\/p>\n<p><strong><span style=\"color:#e53333;\">\u7279\u522b\u6ce8\u610f<\/span><span style=\"color:#e53333;\">\uff1a<\/span><\/strong><\/p>\n<p>\u4e00\u5b9a\u8981\u5728\u914d\u7f6e\u6587\u4ef6\u4e2d\u6dfb\u52a0\u4ee5\u4e0b\u4e24\u4e2a\u53c2\u6570\uff0c\u5426\u5219\u5c06\u4f1a\u5bfc\u81f4\u670d\u52a1\u542f\u52a8\u65f6\u65e0\u9650\u671f\u7b49\u5f85\u3002<\/p>\n<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; startup{<br \/>\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; wfc-timeout 120;<br \/>\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; degr-wfc-timeout 120;<br \/>\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }<\/p>\n<p>\u5982\u4e0b\u4e00\u4e2a\u914d\u7f6e\u5b9e\u4f8b\uff1a<br \/>\nglobal { usage-count no; }<br \/>\ncommon { syncer { rate 200M; } }<br \/>\nresource r0 {<br \/>\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; protocol C;<br \/>\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; net {<br \/>\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; cram-hmac-alg sha1;<br \/>\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; shared-secret \"MySQL_HA\";<br \/>\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }<\/p>\n<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; disk{<br \/>\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; on-io-error detach;<br \/>\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; fencing resource-only;<br \/>\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }<br \/>\n<span style=\"color:#e53333;\">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; startup{<\/span><br \/>\n<span style=\"color:#e53333;\">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; wfc-timeout 120;<\/span><br \/>\n<span style=\"color:#e53333;\">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; degr-wfc-timeout 120;<\/span><br \/>\n<span style=\"color:#e53333;\">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }<\/span><br \/>\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; on mysql-n1 {<br \/>\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; device&nbsp;&nbsp;&nbsp; \/dev\/drbd0;<br \/>\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; disk&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; \/dev\/sdb1;<br \/>\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; address&nbsp;&nbsp; 10.0.17.155:7898;<br \/>\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; meta-disk&nbsp; internal;<br \/>\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }<br \/>\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; on mysql-n2 {<br \/>\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; device&nbsp;&nbsp;&nbsp; \/dev\/drbd0;<br \/>\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; disk&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; \/dev\/sdb1;<br \/>\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; address&nbsp;&nbsp; 10.0.17.156:7898;<br \/>\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; meta-disk&nbsp; internal;<br \/>\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }<br \/>\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }\n<\/p>\n<p><strong>\u8bbe\u7f6eprimary\u8282\u70b9&amp;mkfs<br \/>\n<\/strong><span style=\"color:#f00000;\">[root@mysql-n1 ~]# drbdadm primary all\uff08\u62a5\u9519\uff0c\u6267\u884c\u4e0b\u9762\u64cd\u4f5c\uff09<\/span><br \/>\n0: State change failed: (-2) Need access to UpToDate data<br \/>\nCommand 'drbdsetup 0 primary' terminated with exit code 17<br \/>\n<span style=\"color:#f00000;\">[root@mysql-n1 ~]# drbdadm -- --overwrite-data-of-peer primary all<\/span><br \/>\n<span style=\"color:#f00000;\">[root@mysql-n1 ~]# mkfs.ext3 \/dev\/drbd0<\/span><\/p>\n<p>\n<strong>\u67e5\u770bdrbd\u7684\u72b6\u6001<br \/>\n<\/strong><span style=\"color:#f00000;\">[root@mysql-n1 ~]# cat \/proc\/drbd<\/span><br \/>\nversion: 8.3.13 (api:88\/proto:86-96)<br \/>\nGIT-hash: 83ca112086600faacab2f157bc5a9324f7bd7f77 build by <\/p>\n<p>mockbuild@builder10.centos.org, 2012-05-07 11:56:36<br \/>\n&nbsp;0: cs:SyncSource ro:Primary\/Secondary ds:UpToDate\/Inconsistent C r-----<br \/>\n&nbsp;&nbsp;&nbsp; ns:5043196 nr:0 dw:0 dr:5051264 al:0 bm:307 lo:1 pe:5 ua:64 ap:0 ep:1 wo:b <\/p>\n<p>oos:15921556<br \/>\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; [===&gt;................] sync'ed: 24.1% (15548\/20472)M<br \/>\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; finish: 0:02:02 speed: 129,304 (126,064) K\/sec<\/p>\n<p>\u5176\u4e2d\uff1aro\u662f\u89d2\u8272\u4fe1\u606f\uff1aPrimary\/Secondary\uff08\u4ee3\u8868\u8fd9\u4e2a\u662f\u4e3b\u8282\u70b9\uff09<br \/>\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Secondary\/Primary\uff08\u4ee3\u8868\u8fd9\u4e2a\u662f\u526f\u8282\u70b9\uff09<\/p>\n<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ds\u662f\u78c1\u76d8\u72b6\u6001\uff1aUpToDate\/Inconsistent\uff08\u6b63\u5728\u540c\u6b65\uff0c\u6570\u636e\u8fd8\u6ca1\u6709\u4e00\u81f4\uff09<br \/>\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; UpToDate\/UpToDate&nbsp;&nbsp;&nbsp; \uff08\u540c\u6b65\u5b8c\u6210\uff0c\u6570\u636e\u4e00\u81f4\uff09<br \/>\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ns\u662f\u7f51\u7edc\u4f20\u8f93\u7684\u6570\u636e\u5305\uff1a\u4ee5K\u4e3a\u5b57\u8282<br \/>\n&nbsp;&nbsp; &nbsp;<br \/>\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; dw\u662f\u78c1\u76d8\u5199\u64cd\u4f5c<br \/>\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; dr\u662f\u78c1\u76d8\u8bfb\u64cd\u4f5c<br \/>\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br \/>\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br \/>\n<strong>\u6302\u8f7dDRBD\u5206\u533a\u5230\/data\u76ee\u5f55\u4e0b<\/strong><br \/>\n<span style=\"color:#f00000;\">[root@mysql-n1 ~]# mkdir \/data<br \/>\n[root@mysql-n1 ~]# mount \/dev\/drbd0 \/data<br \/>\n[root@mysql-n1 ~]# df -h<\/span><br \/>\nFilesystem&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Size&nbsp; Used Avail Use% Mounted on<br \/>\n\/dev\/sda1&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 37G&nbsp; 4.5G&nbsp;&nbsp; 31G&nbsp; 13% \/<br \/>\ntmpfs&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 502M&nbsp;&nbsp;&nbsp;&nbsp; 0&nbsp; 502M&nbsp;&nbsp; 0% \/dev\/shm<br \/>\n\/dev\/drbd0&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 20G&nbsp; 173M&nbsp;&nbsp; 19G&nbsp;&nbsp; 1% \/data<\/p>\n<p>\n\u6ce8\uff1aDRBD\u7684\u82f1\u6587\u5168\u79f0\u5c31\u662fDistributed Replicated Block Device\uff08\u5206\u5e03\u5f0f\u5757\u8bbe\u5907\u590d\u5236\uff09,<br \/>\nSecondary\u8282\u70b9\u7684\/dev\/drbd<strong>X<\/strong>\u662f\u4e0d\u80fd\u8fdb\u884c\u6302\u8f7d<\/p>\n<p>&nbsp;<\/p>\n<p><strong>\u5176\u5b83\u7684\u63cf\u8ff0<\/strong><\/p>\n<p>more \/proc\/drbd <br \/>\nversion: 8.2.1 (api:86\/proto:86-87)<br \/>\nGIT-hash: 318925802fc2638479ad090b73d7af45503dd184 build by <a href=\"mailto:root@test-105\">root@test-105<\/a>, 2010-01-11 17:35:20<\/p>\n<p>&nbsp;1: cs:Connected st:Secondary\/Primary ds:UpToDate\/UpToDate C r---<br \/>\n&nbsp;&nbsp;&nbsp; ns:0 nr:1645688 dw:1645688 dr:0 al:0 bm:88 lo:0 pe:0 ua:0 ap:0<br \/>\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; resync: used:0\/31 hits:29120 misses:88 starving:0 dirty:0 changed:88<br \/>\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; act_log: used:0\/127 hits:0 misses:0 starving:0 dirty:0 changed:0<\/p>\n<p>Field&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; \u8bf4\u660e&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; \u503c\uff1a<br \/>\ncs&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; \u8fde\u63a5\u72b6\u6001&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; \u51fa\u73b0\u7684\u503c\uff1a<br \/>\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; o Unconfigured\uff1a\u8bbe\u5907\u5728\u7b49\u5f85\u914d\u7f6e\u3002<br \/>\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; o Unconnected\uff1a\u8fde\u63a5\u6a21\u5757\u65f6\u7684\u8fc7\u6e21\u72b6\u6001\u3002<br \/>\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; o WFConnection\uff1a\u8bbe\u5907\u7b49\u5f85\u53e6\u4e00\u6d4b\u7684\u914d\u7f6e\u3002<br \/>\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; o WFReportParams\uff1a\u8fc7\u6e21\u72b6\u6001\uff0c\u7b49\u5f85\u65b0TCP \u8fde\u63a5\u7684\u7b2c\u4e00\u4e2a\u6570\u636e\u5305\u65f6\u3002.<br \/>\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; o SyncingAll\uff1a\u6b63\u5c06\u4e3b\u8282\u70b9\u7684\u6240\u6709\u6a21\u5757\u590d\u5236\u5230\u6b21\u7ea7\u8282\u70b9\u4e0a\u3002.<br \/>\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; o SyncingQuick\uff1a\u901a\u8fc7\u590d\u5236\u5df2\u88ab\u66f4\u65b0\u7684\u6a21\u5757\uff08\u56e0\u4e3a\u73b0\u5728\u6b21\u7ea7\u8282\u70b9\u5df2\u7ecf\u79bb\u5f00\u4e86\u96c6\u7fa4\uff09\u6765\u66f4\u65b0\u6b21\u7ea7\u8282\u70b9\u3002<br \/>\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; o Connected\uff1a\u4e00\u5207\u6b63\u5e38\u3002<br \/>\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; o Timeout\uff1a\u8fc7\u6e21\u72b6\u6001\u3002<br \/>\nst&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; \u72b6\u6001\uff08\u8bbe\u5907\u7684\u4f5c\u7528\uff09&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; \u53ef\u80fd\u7684\u503c\u4e3a\uff1a<br \/>\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; o \u672c\u5730\/\u8fdc\u7a0b\u4e00\u7ea7\u72b6\u6001<br \/>\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; o \u4e8c\u7ea7\u72b6\u6001<br \/>\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; o \u672a\u77e5\uff08\u8fd9\u4e0d\u662f\u4e00\u79cd\u4f5c\u7528\uff09<br \/>\nns&nbsp;&nbsp;&nbsp; \u7f51\u7edc\u53d1\u9001&nbsp;&nbsp;&nbsp; \u6a21\u5757\u53f7\u7801<br \/>\nnr&nbsp;&nbsp;&nbsp; \u7f51\u7edc\u63a5\u6536&nbsp;&nbsp;&nbsp; \u6a21\u5757\u53f7\u7801<br \/>\ndw&nbsp;&nbsp;&nbsp; \u78c1\u76d8\u5199\u5165&nbsp;&nbsp;&nbsp; \u6a21\u5757\u53f7\u7801<br \/>\ndr&nbsp;&nbsp;&nbsp; \u78c1\u76d8\u8bfb\u53d6&nbsp;&nbsp;&nbsp; \u6a21\u5757\u53f7\u7801<br \/>\nof&nbsp;&nbsp;&nbsp; \u8fd0\u884c\u4e2d\uff08\u8fc7\u65f6\u7684\uff09\u6a21\u5757\u53f7\u7801<br \/>\npe&nbsp;&nbsp;&nbsp; \u5f85\u89e3\u51b3\u7684&nbsp;&nbsp;&nbsp; \u6a21\u5757\u53f7\u7801<br \/>\nua&nbsp;&nbsp;&nbsp; \u672a\u7b54\u590d\u7684&nbsp;&nbsp;&nbsp; \u6a21\u5757\u53f7\u7801\uff08\u6700\u597d\u4e3a0\uff09<\/p>\n<p>&nbsp;<\/p>\n<p><span style=\"font-size:small;\"><span style=\"color:#ff3333;\"><span style=\"font-family:\u534e\u6587\u7ec6\u9ed1;\">\u5b89<b>\u88c5\u8fc7\u7a0b\u4e2d\u53ef\u80fd\u9047\u5230\u7684\u4e00\u4e9b\u95ee\u9898<\/b><\/span><\/span><\/span><\/p>\n<p style=\"widows:2;text-transform:none;text-indent:0px;letter-spacing:normal;font:14px\/20px Verdana, Arial, Helvetica, sans-serif;white-space:normal;orphans:2;color:#000000;word-spacing:0px;-webkit-text-size-adjust:auto;-webkit-text-stroke-width:0px;\" align=\"left\"><span style=\"font-family:\u534e\u6587\u7ec6\u9ed1;\"><span style=\"font-size:x-small;\"><span style=\"font-size:11pt;\">1<\/span><\/span><span style=\"font-size:x-small;\"><span style=\"font-size:11pt;\">\u3001<\/span><\/span><span style=\"font-size:x-small;\"><span style=\"font-size:11pt;\">create-md<\/span><\/span><span style=\"font-size:x-small;\"><span style=\"font-size:11pt;\">\u7684\u65f6\u5019\u603b\u662f\u51fa\u73b0\u4e0b\u9762\u7684\u95ee\u9898<\/span><\/span><\/span><\/p>\n<p style=\"widows:2;text-transform:none;text-indent:0px;letter-spacing:normal;font:14px\/20px Verdana, Arial, Helvetica, sans-serif;white-space:normal;orphans:2;color:#000000;word-spacing:0px;-webkit-text-size-adjust:auto;-webkit-text-stroke-width:0px;\" align=\"left\"><span style=\"font-family:\u534e\u6587\u7ec6\u9ed1;\"><span style=\"font-size:x-small;\"><span style=\"font-size:11pt;\">\u6ce8\uff1a<\/span><\/span><\/span><span style=\"font-family:\u534e\u6587\u7ec6\u9ed1;\"><span style=\"font-size:x-small;\"><span style=\"font-size:11pt;\">mds1<\/span><\/span><\/span><span style=\"font-family:\u534e\u6587\u7ec6\u9ed1;\"><span style=\"font-size:x-small;\"><span style=\"font-size:11pt;\">\u5728<\/span><\/span><\/span><span style=\"font-family:\u534e\u6587\u7ec6\u9ed1;\"><span style=\"font-size:x-small;\"><span style=\"font-size:11pt;\">create-md<\/span><\/span><\/span><span style=\"font-family:\u534e\u6587\u7ec6\u9ed1;\"><span style=\"font-size:x-small;\"><span style=\"font-size:11pt;\">\u7684\u65f6\u5019\u603b\u662f\u51fa\u73b0\u4e0b\u9762\u7684\u95ee\u9898\uff0c<\/span><\/span><\/span><\/p>\n<p style=\"widows:2;text-transform:none;text-indent:0px;letter-spacing:normal;font:14px\/20px Verdana, Arial, Helvetica, sans-serif;white-space:normal;orphans:2;color:#000000;word-spacing:0px;-webkit-text-size-adjust:auto;-webkit-text-stroke-width:0px;\" align=\"left\"><span style=\"font-family:\u534e\u6587\u7ec6\u9ed1;\"><span style=\"font-size:x-small;\"><span style=\"font-size:11pt;\">[root@mds1 ~]# drbdadm create-md r0&nbsp;&nbsp;<br \/>\nmd_offset 2023411712<br \/>\nal_offset 2023378944<br \/>\nbm_offset 2023313408<\/span><\/span><\/span><\/p>\n<p style=\"widows:2;text-transform:none;text-indent:0px;letter-spacing:normal;font:14px\/20px Verdana, Arial, Helvetica, sans-serif;white-space:normal;orphans:2;color:#000000;word-spacing:0px;-webkit-text-size-adjust:auto;-webkit-text-stroke-width:0px;\" align=\"left\"><span style=\"font-family:\u534e\u6587\u7ec6\u9ed1;\"><span style=\"font-size:x-small;\"><span style=\"font-size:11pt;\">Found ext3 filesystem which uses 1975992 kB<br \/>\ncurrent configuration leaves usable 1975892 kB<\/span><\/span><\/span><\/p>\n<p style=\"widows:2;text-transform:none;text-indent:0px;letter-spacing:normal;font:14px\/20px Verdana, Arial, Helvetica, sans-serif;white-space:normal;orphans:2;color:#000000;word-spacing:0px;-webkit-text-size-adjust:auto;-webkit-text-stroke-width:0px;\" align=\"left\"><span style=\"font-family:\u534e\u6587\u7ec6\u9ed1;\"><span style=\"font-size:x-small;\"><span style=\"font-size:11pt;\">Device size would be truncated, which<br \/>\nwould corrupt data and result in<br \/>\n'access beyond end of device' errors.<br \/>\nYou need to either<br \/>\n&nbsp; &nbsp;* use external meta data (recommended)<br \/>\n&nbsp; &nbsp;* shrink that filesystem first<br \/>\n&nbsp; &nbsp;* zero out the device (destroy the filesystem)<br \/>\nOperation refused.<\/span><\/span><\/span><\/p>\n<p style=\"widows:2;text-transform:none;text-indent:0px;letter-spacing:normal;font:14px\/20px Verdana, Arial, Helvetica, sans-serif;white-space:normal;orphans:2;color:#000000;word-spacing:0px;-webkit-text-size-adjust:auto;-webkit-text-stroke-width:0px;\" align=\"left\"><span style=\"font-family:\u534e\u6587\u7ec6\u9ed1;\"><span style=\"font-size:x-small;\"><span style=\"font-size:11pt;\">Command 'drbdmeta 0 v08 \/dev\/sda3 internal create-md' terminated with exit code 40<br \/>\ndrbdadm create-md r0: exited with code 40<\/span><\/span><\/span><\/p>\n","protected":false},"excerpt":{"rendered":"<h3 id=\"DRBD\u4ecb\u7ecd\">DRBD\u4ecb\u7ecd<\/h3>\n<p><a title=\"DRBD\" href=\"http:\/\/www.centos.bz\/tag\/drbd\/\">DRBD<\/a>\u662f\u4e00\u4e2a\u7528\u8f6f\u4ef6\u5b9e\u73b0\u7684\u3001\u65e0\u5171\u4eab\u7684\u3001\u670d\u52a1\u5668\u4e4b\u95f4\u955c\u50cf\u5757\u8bbe\u5907\u5185\u5bb9\u7684\u5b58\u50a8\u590d\u5236\u89e3\u51b3\u65b9\u6848\u3002 DRBD Logo\u6570\u636e\u955c\u50cf\uff1a\u5b9e\u65f6\u3001\u900f\u660e\u3001\u540c\u6b65\uff08\u6240\u6709\u670d\u52a1\u5668\u90fd\u6210\u529f\u540e\u8fd4\u56de\uff09\u3001\u5f02\u6b65\uff08\u672c\u5730\u670d\u52a1\u5668\u6210\u529f\u540e\u8fd4\u56de\uff09\u3002DBRD\u7684\u6838\u5fc3\u529f\u80fd\u901a\u8fc7<a title=\"Linux\" href=\"http:\/\/www.centos.bz\/\">Linux<\/a>\u7684\u5185\u6838\u5b9e\u73b0\uff0c\u6700\u63a5\u8fd1\u7cfb\u7edf\u7684IO\u6808\uff0c\u4f46\u5b83\u4e0d\u80fd\u795e\u5947\u5730\u6dfb\u52a0\u4e0a\u5c42\u7684\u529f\u80fd\u6bd4\u5982\u68c0\u6d4b\u5230EXT3\u6587\u4ef6\u7cfb\u7edf\u7684\u5d29\u6e83\u3002DBRD\u7684\u4f4d\u7f6e\u5904\u4e8e\u6587\u4ef6\u7cfb\u7edf\u4ee5\u4e0b\uff0c\u6bd4\u6587\u4ef6\u7cfb\u7edf\u66f4\u52a0\u9760\u8fd1\u64cd\u4f5c\u7cfb\u7edf\u5185\u6838\u53caIO\u6808\u3002<\/p>\n<h3 id=\"DRBD\u7f16\u8bd1\u5b89\u88c5\">DRBD\u7f16\u8bd1\u5b89\u88c5<\/h3>\n<p>\u5b89\u88c5\u6240\u9700\u4f9d\u8d56:<\/p>\n<div class=\"hl-surround\">\n<ol class=\"hl-main ln-show\" title=\"Double click to hide line number.\">\n<li class=\"hl-firstline\">yum -y install gcc kernel-devel kernel-headers flex<\/li>\n<\/ol>\n<\/div>\n<p>\u5f00\u59cb\u5b89\u88c5drbd\uff0c\u4e0b\u8f7d\u5730\u5740\uff1a<a href=\"http:\/\/oss.linbit.com\/drbd\/\" target=\"_blank\">http:\/\/oss.linbit.com\/...<\/a><\/p>\n<p> <a href=\"https:\/\/www.xiaobo.li\/notes\/archives\/335\">\u7ee7\u7eed\u9605\u8bfb <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[287],"tags":[141],"class_list":["post-335","post","type-post","status-publish","format-standard","hentry","category-linux","tag-drbd"],"_links":{"self":[{"href":"https:\/\/www.xiaobo.li\/notes\/wp-json\/wp\/v2\/posts\/335","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.xiaobo.li\/notes\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.xiaobo.li\/notes\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.xiaobo.li\/notes\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.xiaobo.li\/notes\/wp-json\/wp\/v2\/comments?post=335"}],"version-history":[{"count":0,"href":"https:\/\/www.xiaobo.li\/notes\/wp-json\/wp\/v2\/posts\/335\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.xiaobo.li\/notes\/wp-json\/wp\/v2\/media?parent=335"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.xiaobo.li\/notes\/wp-json\/wp\/v2\/categories?post=335"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.xiaobo.li\/notes\/wp-json\/wp\/v2\/tags?post=335"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}