{"id":297,"date":"2013-03-24T16:34:20","date_gmt":"2013-03-24T16:34:20","guid":{"rendered":"9fd81843ad7f202f26c1a174c7357585"},"modified":"2013-03-24T16:34:20","modified_gmt":"2013-03-24T16:34:20","slug":"","status":"publish","type":"post","link":"https:\/\/www.xiaobo.li\/notes\/archives\/297","title":{"rendered":"\u96c6\u7fa4\u7cfb\u7edf heartbeat &#038; lvs"},"content":{"rendered":"<p style=\"text-align:left;padding-bottom:0px;widows:2;text-transform:none;background-color:#ffffff;text-indent:0px;margin:0px 0px 10px;padding-left:0px;letter-spacing:normal;padding-right:0px;font:13px\/21px \u5fae\u8f6f\u96c5\u9ed1, Verdana, sans-serif, \u5b8b\u4f53;white-space:normal;orphans:2;color:#000000;word-spacing:0px;padding-top:0px;-webkit-text-size-adjust:auto;-webkit-text-stroke-width:0px;\">\u4e00\u822c\u6211\u4eec\u7528\u5230\u7684\u96c6\u7fa4\u7cfb\u7edf\u4e3b\u8981\u67092\u79cd:<\/p>\n<p style=\"text-align:left;padding-bottom:0px;widows:2;text-transform:none;background-color:#ffffff;text-indent:0px;margin:0px 0px 10px;padding-left:0px;letter-spacing:normal;padding-right:0px;font:13px\/21px \u5fae\u8f6f\u96c5\u9ed1, Verdana, sans-serif, \u5b8b\u4f53;white-space:normal;orphans:2;color:#000000;word-spacing:0px;padding-top:0px;-webkit-text-size-adjust:auto;-webkit-text-stroke-width:0px;\">1\u3001\u9ad8\u53ef\u7528(High Availability)HA\u96c6\u7fa4, \u4f7f\u7528Heartbeat\u5b9e\u73b0;\u4e5f\u4f1a\u79f0\u4e3a\u201d\u53cc\u673a\u70ed\u5907\u201d, \u201c\u53cc\u673a\u4e92\u5907\u201d, \u201c\u53cc\u673a\u201d\u3002<br style=\"padding-bottom:0px;margin:0px;padding-left:0px;padding-right:0px;padding-top:0px;\" \/><br \/>\n2\u3001\u8d1f\u8f7d\u5747\u8861\u7fa4\u96c6(Load Balance Cluster)\uff0c\u4f7f\u7528Linux Virtual Server(LVS)\u5b9e\u73b0;<\/p>\n<p style=\"text-align:left;padding-bottom:0px;widows:2;text-transform:none;background-color:#ffffff;text-indent:0px;margin:0px 0px 10px;padding-left:0px;letter-spacing:normal;padding-right:0px;font:13px\/21px \u5fae\u8f6f\u96c5\u9ed1, Verdana, sans-serif, \u5b8b\u4f53;white-space:normal;orphans:2;color:#000000;word-spacing:0px;padding-top:0px;-webkit-text-size-adjust:auto;-webkit-text-stroke-width:0px;\">&nbsp;<\/p>\n<p style=\"text-align:left;padding-bottom:0px;widows:2;text-transform:none;background-color:#ffffff;text-indent:0px;margin:0px 0px 10px;padding-left:0px;letter-spacing:normal;padding-right:0px;font:13px\/21px \u5fae\u8f6f\u96c5\u9ed1, Verdana, sans-serif, \u5b8b\u4f53;white-space:normal;orphans:2;color:#000000;word-spacing:0px;padding-top:0px;-webkit-text-size-adjust:auto;-webkit-text-stroke-width:0px;\">heartbeat \uff08Linux-HA\uff09\u7684\u5de5\u4f5c\u539f\u7406\uff1aheartbeat\u6700\u6838\u5fc3\u7684\u5305\u62ec\u4e24\u4e2a\u90e8\u5206\uff0c\u5fc3\u8df3\u76d1\u6d4b\u90e8\u5206\u548c\u8d44\u6e90\u63a5\u7ba1\u90e8\u5206\uff0c\u5fc3\u8df3\u76d1\u6d4b\u53ef\u4ee5\u901a\u8fc7\u7f51\u7edc\u94fe\u8def\u548c\u4e32\u53e3\u8fdb\u884c\uff0c\u800c\u4e14\u652f\u6301\u5197 \u4f59\u94fe\u8def\uff0c\u5b83\u4eec\u4e4b\u95f4\u76f8\u4e92\u53d1\u9001\u62a5\u6587\u6765\u544a\u8bc9\u5bf9\u65b9\u81ea\u5df1\u5f53\u524d\u7684\u72b6\u6001\uff0c\u5982\u679c\u5728\u6307\u5b9a\u7684\u65f6\u95f4\u5185\u672a\u53d7\u5230\u5bf9\u65b9\u53d1\u9001\u7684\u62a5\u6587\uff0c\u90a3\u4e48\u5c31\u8ba4\u4e3a\u5bf9\u65b9\u5931\u6548\uff0c\u8fd9\u65f6\u9700\u542f\u52a8\u8d44\u6e90\u63a5\u7ba1\u6a21\u5757\u6765\u63a5\u7ba1\u8fd0 \u884c\u5728\u5bf9\u65b9\u4e3b\u673a\u4e0a\u7684\u8d44\u6e90\u6216\u8005\u670d\u52a1\u3002<\/p>\n<p style=\"text-align:left;padding-bottom:0px;widows:2;text-transform:none;background-color:#ffffff;text-indent:0px;margin:0px 0px 10px;padding-left:0px;letter-spacing:normal;padding-right:0px;font:13px\/21px \u5fae\u8f6f\u96c5\u9ed1, Verdana, sans-serif, \u5b8b\u4f53;white-space:normal;orphans:2;color:#000000;word-spacing:0px;padding-top:0px;-webkit-text-size-adjust:auto;-webkit-text-stroke-width:0px;\">\u53e6\u4e00\u79cd\u53c2\u8003\uff1a &nbsp;Keepalived<\/p>\n<p style=\"text-align:left;padding-bottom:0px;widows:2;text-transform:none;background-color:#ffffff;text-indent:0px;margin:0px 0px 10px;padding-left:0px;letter-spacing:normal;padding-right:0px;font:13px\/21px \u5fae\u8f6f\u96c5\u9ed1, Verdana, sans-serif, \u5b8b\u4f53;white-space:normal;orphans:2;color:#000000;word-spacing:0px;padding-top:0px;-webkit-text-size-adjust:auto;-webkit-text-stroke-width:0px;\">&nbsp;<\/p>\n<p style=\"text-align:left;padding-bottom:0px;widows:2;text-transform:none;background-color:#ffffff;text-indent:0px;margin:0px 0px 10px;padding-left:0px;letter-spacing:normal;padding-right:0px;font:13px\/21px \u5fae\u8f6f\u96c5\u9ed1, Verdana, sans-serif, \u5b8b\u4f53;white-space:normal;orphans:2;color:#000000;word-spacing:0px;padding-top:0px;-webkit-text-size-adjust:auto;-webkit-text-stroke-width:0px;\">LVS\u8be6\u89e3:http:\/\/www.linuxidc.com\/Linux\/2012-09\/71474.htm<\/p>\n<p style=\"text-align:left;padding-bottom:0px;widows:2;text-transform:none;background-color:#ffffff;text-indent:0px;margin:0px 0px 10px;padding-left:0px;letter-spacing:normal;padding-right:0px;font:13px\/21px \u5fae\u8f6f\u96c5\u9ed1, Verdana, sans-serif, \u5b8b\u4f53;white-space:normal;orphans:2;color:#000000;word-spacing:0px;padding-top:0px;-webkit-text-size-adjust:auto;-webkit-text-stroke-width:0px;\"><a href=\"http:\/\/linux.chinaunix.net\/techdoc\/net\/2009\/07\/21\/1125256.shtml\">http:\/\/linux.chinaunix.net\/techdoc\/net\/2009\/07\/21\/1125256.shtml<\/a><\/p>\n<p style=\"text-align:left;padding-bottom:0px;widows:2;text-transform:none;background-color:#ffffff;text-indent:0px;margin:0px 0px 10px;padding-left:0px;letter-spacing:normal;padding-right:0px;font:13px\/21px \u5fae\u8f6f\u96c5\u9ed1, Verdana, sans-serif, \u5b8b\u4f53;white-space:normal;orphans:2;color:#000000;word-spacing:0px;padding-top:0px;-webkit-text-size-adjust:auto;-webkit-text-stroke-width:0px;\">&nbsp;<\/p>\n<p style=\"text-align:left;padding-bottom:0px;widows:2;text-transform:none;background-color:#ffffff;text-indent:0px;margin:0px 0px 10px;padding-left:0px;letter-spacing:normal;padding-right:0px;font:13px\/21px \u5fae\u8f6f\u96c5\u9ed1, Verdana, sans-serif, \u5b8b\u4f53;white-space:normal;orphans:2;color:#000000;word-spacing:0px;padding-top:0px;-webkit-text-size-adjust:auto;-webkit-text-stroke-width:0px;\"><strong>\u57fa\u4e8eheartbeat v2\u548cldirectord\u5b9e\u73b0director\u9ad8\u53ef\u7528<\/strong><\/p>\n<p style=\"widows:2;text-transform:none;background-color:#efefef;text-indent:0px;letter-spacing:normal;font:14px\/22px tahoma, \u5b8b\u4f53;white-space:normal;orphans:2;color:#333333;word-spacing:0px;-webkit-text-size-adjust:auto;-webkit-text-stroke-width:0px;\">\u4e00\u3001\u73af\u5883\u62d3\u6251\u4ecb\u7ecd<\/p>\n<p style=\"widows:2;text-transform:none;background-color:#efefef;text-indent:0px;letter-spacing:normal;font:14px\/22px tahoma, \u5b8b\u4f53;white-space:normal;orphans:2;color:#333333;word-spacing:0px;-webkit-text-size-adjust:auto;-webkit-text-stroke-width:0px;\"><a id=\"ematt:200\" href=\"\/notes\/content\/uploadfile\/201303\/4a471364114876.png\" target=\"_blank\"><img decoding=\"async\" border=\"0\" alt=\"\u70b9\u51fb\u67e5\u770b\u539f\u56fe\" src=\"\/notes\/content\/uploadfile\/201303\/4a471364114876.png\" \/><\/a><\/p>\n<p style=\"widows:2;text-transform:none;background-color:#efefef;text-indent:0px;letter-spacing:normal;font:14px\/22px tahoma, \u5b8b\u4f53;white-space:normal;orphans:2;color:#333333;word-spacing:0px;-webkit-text-size-adjust:auto;-webkit-text-stroke-width:0px;\">\u8bf4\u660e\uff1a\u524d\u7aef\u4e24\u53f0\u8c03\u5ea6\u670d\u52a1\u5668Director1\u548cDirector2\uff0c\u4e24\u8005\u4e4b\u95f4\u53ef\u4ee5\u5b9e\u73b0\u6545\u969c\u8f6c\u79fb\uff0c\u4f8b\u5982\u5f53Director1\u8282\u70b9\u51fa\u73b0\u6545\u969c\u65f6Director2\u8282\u70b9\u53ef\u4ee5\u81ea\u52a8\u63a5\u7ba1\u8c03\u5ea6\u670d\u52a1\u5668\u7684\u8d44\u6e90\uff0c\u80fd\u591f\u7ee7\u7eed\u4e3a\u4e3a\u5ba2\u6237\u7aef\u8f6c\u53d1\u8bf7\u6c42\u5230\u540e\u7aefReal Server\uff1b\u800c\u4e14\u5f53\u540e\u53f0\u7684node1\u6216\u7740node2\u51fa\u73b0\u6545\u969c\u65f6\u80fd\u591f\u628a\u6545\u969c\u8282\u70b9\u81ea\u52a8\u8e22\u51fa\u5217\u8868\uff0c\u5f53\u6062\u590d\u6b63\u5e38\u65f6\u80fd\u591f\u81ea\u52a8\u52a0\u5165\u3002<br \/>\n\u6ce8\u610f\uff1a<br \/>\n&nbsp; &nbsp; &nbsp; 1\u3001\u8bbe\u7f6e\u5404\u4e2a\u8282\u70b9\u95f4\u7684\u65f6\u95f4\u540c\u6b65<br \/>\n&nbsp; &nbsp; &nbsp; 2\u3001\u57fa\u4e8ehosts\u6587\u4ef6\u5b9e\u73b0\u80fd\u591f\u4e92\u76f8\u7528\u4e3b\u673a\u540d\u8bbf\u95ee<br \/>\n&nbsp; &nbsp; &nbsp; 3\u3001\u4f7f\u7528uname -n\u6267\u884c\u7ed3\u679c\u8981\u548c\u4e3b\u673a\u540d\u76f8\u540c<br \/>\n&nbsp; &nbsp; &nbsp; 4\u3001\u786e\u4fddipvsadm\u670d\u52a1\u548chttpd\u670d\u52a1\u5173\u95ed\u5f00\u673a\u542f\u52a8<br \/>\n&nbsp;<br \/>\n\u4e8c\u3001\u5b89\u88c5\u76f8\u5173\u8f6f\u4ef6\u5305<br \/>\n\u9700\u8981\u7684\u8f6f\u4ef6\uff1a<br \/>\n&nbsp;ipvsadm<br \/>\n&nbsp;heartbeat&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class=\"Apple-converted-space\">&nbsp;<\/span><br \/>\n&nbsp;heartbeat-ldirectord&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class=\"Apple-converted-space\">&nbsp;<\/span><br \/>\n&nbsp;heartbeat-pils&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class=\"Apple-converted-space\">&nbsp;<\/span><br \/>\n&nbsp;heartbeat-stonith&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class=\"Apple-converted-space\">&nbsp;<\/span><br \/>\n&nbsp;libnet&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class=\"Apple-converted-space\">&nbsp;<\/span><br \/>\n&nbsp;perl-MailTools&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class=\"Apple-converted-space\">&nbsp;<\/span><br \/>\n&nbsp;libtool-ltdl&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class=\"Apple-converted-space\">&nbsp;<\/span><br \/>\n&nbsp;openhpi-libs&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class=\"Apple-converted-space\">&nbsp;<\/span><br \/>\n&nbsp;perl-Compress-Zlib&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class=\"Apple-converted-space\">&nbsp;<\/span><br \/>\n&nbsp;perl-HTML-Parser&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class=\"Apple-converted-space\">&nbsp;<\/span><br \/>\n&nbsp;perl-HTML-Tagset&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class=\"Apple-converted-space\">&nbsp;<\/span><br \/>\n&nbsp;perl-TimeDate&nbsp; &nbsp;<span class=\"Apple-converted-space\">&nbsp;<\/span><br \/>\n&nbsp;perl-libwww-perl<span class=\"Apple-converted-space\">&nbsp;<\/span><br \/>\n&nbsp;<br \/>\n\u4e09\u3001\u914d\u7f6eDirector\u8282\u70b9\u4e4b\u95f4\u9ad8\u53ef\u7528<br \/>\n1\u3001\u590d\u5236\u914d\u7f6e\u6587\u4ef6\u6837\u4f8b<br \/>\n[root@director1 ~]# cd \/usr\/share\/doc\/heartbeat-2.1.4\/<br \/>\n[root@director1 heartbeat-2.1.4]# cp authkeys ha.cf haresources \/etc\/ha.d\/<br \/>\n&nbsp;<br \/>\n2\u3001\u7f16\u8f91\u914d\u7f6e\u6587\u4ef6<br \/>\n[root@director1 heartbeat-2.1.4]# cd \/etc\/ha.d\/<br \/>\n[root@director1 ha.d]# vim ha.cf<span class=\"Apple-converted-space\">&nbsp;<\/span><br \/>\n--------------------------\u6dfb\u52a0\u5982\u4e0b\u884c------------------------------------<br \/>\nbcast&nbsp; eth1 &nbsp; \/\/\u5b9a\u4e49\u53d1\u9001\u5fc3\u8df3\u4fe1\u606f\u7684\u5e7f\u64ad\u63a5\u53e3\uff0c\u6211\u8fd9\u91cc\u662feth1<br \/>\nnode&nbsp; &nbsp; director1&nbsp;\/\/\u5b9a\u4e49\u8282\u70b9<br \/>\nnode&nbsp; &nbsp; director2<br \/>\n-------------------------\u7ed3\u675f--------------------------------------------<br \/>\n&nbsp;<br \/>\n\u7f16\u8f91\u914d\u7f6e\u6587\u4ef6authkeys<br \/>\n[root@director1 ha.d]# vim authkeys&nbsp; &nbsp;<span class=\"Apple-converted-space\">&nbsp;<\/span><br \/>\n-------------------------\u6dfb\u52a0\u5982\u4e0b\u884c---------------------------------<br \/>\nauth 1<br \/>\n1 md5 124hddhu56d8yd8&nbsp; \/\/\u540e\u8fb9\u7684\u4e3a\u968f\u673a\u6570\u503c<br \/>\n--------------------------\u7ed3\u675f-------------------------------------<br \/>\n[root@director1 ha.d]# chmod 600 authkeys&nbsp; \/\/\u8bbe\u7f6e\u6743\u9650\u4e3a600<span class=\"Apple-converted-space\">&nbsp;<\/span><br \/>\n&nbsp;<br \/>\n\u7f16\u8f91\u914d\u7f6e\u6587\u4ef6haresources<br \/>\n[root@director1 ha.d]# vim haresources&nbsp; &nbsp; \/\/\u7f16\u8f91\u8d44\u6e90\u914d\u7f6e\u6587\u4ef6\u6dfb\u52a0\u5982\u4e0b\u884c<br \/>\ndirector1&nbsp; &nbsp; &nbsp; 192.168.56.200\/32\/eth1\/192.168.56.200 ldirectord&nbsp;\/\/\u5b9a\u4e49\u8d44\u6e90VIP\uff0cldirectord\u670d\u52a1<br \/>\n&nbsp;<br \/>\n\u7f16\u8f91ldriectord\u914d\u7f6e\u6587\u4ef6<br \/>\n[root@director1 ha.d]# vim ldirectord.cf<span class=\"Apple-converted-space\">&nbsp;<\/span><br \/>\n--------------------------------\u4fee\u6539\u4e3a\u4ee5\u4e0b\u5185\u5bb9----------------------------<br \/>\nchecktimeout=3&nbsp; &nbsp; \/\/\u68c0\u6d4b\u8d85\u65f6\u65f6\u95f4<br \/>\ncheckinterval=1&nbsp; &nbsp; \/\/\u68c0\u6d4b\u95f4\u9694<br \/>\nautoreload=yes&nbsp; &nbsp; \/\/\u8be5\u914d\u7f6e\u6587\u4ef6\u4fee\u6539\u540e\u80fd\u591f\u81ea\u52a8\u91cd\u8f7d<br \/>\nquiescent=yes&nbsp;<br \/>\nvirtual=192.168.56.200:80&nbsp;\/\/\u5b9a\u4e49VIP\u5730\u5740\u548c\u7aef\u53e3<br \/>\n&nbsp; &nbsp; &nbsp; &nbsp; real=192.168.56.103:80 gate&nbsp;\/\/\u5b9a\u4e49real server\u7684IP\u548c\u7aef\u53e3<br \/>\n&nbsp; &nbsp; &nbsp; &nbsp; real=192.168.56.104:80 gate&nbsp;\/\/\u5b9a\u4e49\u7b2c\u4e8c\u4e2areal server<br \/>\n&nbsp; &nbsp; &nbsp; &nbsp; fallback=127.0.0.1:80 gate&nbsp;\/\/\u5982\u679c\u6240\u6709\u540e\u7aef\u8282\u70b9\u4e0d\u53ef\u7528\u65f6\u8bf7\u6c42\u8fde\u63a5\u7684\u8f6c\u53d1\u4f4d\u7f6e\uff0c\u6b64\u5904\u8bbe\u7f6e\u8f6c\u53d1\u7ed9director\u81ea\u8eab\u768480\u7aef\u53e3<br \/>\n&nbsp; &nbsp; &nbsp; &nbsp; service=http&nbsp; &nbsp; \/\/\u5b9a\u4e49\u670d\u52a1\u7c7b\u578b<br \/>\n&nbsp; &nbsp; &nbsp; &nbsp; request=\".test.html\"&nbsp;\/\/\u68c0\u6d4b\u540e\u7aef\u8282\u70b9\u65f6\u4f7f\u7528\u7684\u9875\u9762<br \/>\n&nbsp; &nbsp; &nbsp; &nbsp; receive=\"ok\"&nbsp; &nbsp; \/\/\u68c0\u6d4b\u7684\u5173\u952e\u5b57\uff0c\u8fd9\u91cc\u7684\u8bbe\u7f6e\u8868\u793a\u6d4b\u8bd5\u8bbf\u95ee.test.html\u9875\u9762\u662f\u5426\u5305\u542bok\u5173\u952e\u5b57\uff0c\u5982\u679c\u6709\u5219\u8bf4\u660e\u8be5\u8282\u70b9\u6b63\u5e38\uff0c\u5426\u5219\u8ba4\u5b9a\u4e3a\u6545\u969c<br \/>\n&nbsp; &nbsp; &nbsp; &nbsp; scheduler=wlc&nbsp;\/\/\u6307\u5b9a\u7b97\u6cd5<br \/>\n&nbsp; &nbsp; &nbsp; &nbsp; protocol=tcp&nbsp;\/\/\u5b9a\u4e49\u534f\u8bae\u4e3atcp<br \/>\n&nbsp; &nbsp; &nbsp; &nbsp; checktype=negotiate&nbsp;\/\/\u68c0\u6d4b\u7c7b\u578b<br \/>\n&nbsp; &nbsp; &nbsp; &nbsp; checkport=80&nbsp; &nbsp; \/\/\u68c0\u6d4b\u7684\u7aef\u53e3<br \/>\n-----------------------------------\u7ed3\u675f------------------------------------------<br \/>\n&nbsp;<br \/>\n3\u3001\u628a\u914d\u7f6e\u6587\u4ef6\u62f7\u8d1d\u5230director2\u8282\u70b9<br \/>\n[root@director1 ha.d]# scp -p ha.cf authkeys ldirectord.cf haresources director2:\/etc\/ha.d\/<\/p>\n<p style=\"widows:2;text-transform:none;background-color:#efefef;text-indent:0px;letter-spacing:normal;font:14px\/22px tahoma, \u5b8b\u4f53;white-space:normal;orphans:2;color:#333333;word-spacing:0px;-webkit-text-size-adjust:auto;-webkit-text-stroke-width:0px;\">\u56db\u3001\u914d\u7f6e\u540e\u7aef\u670d\u52a1\u8282\u70b9<br \/>\n&nbsp;<br \/>\n\u5b89\u88c5apache\u914d\u7f6e\u6d4b\u8bd5\u4e3b\u9875<br \/>\n[root@node1 ~]# yum -y install httpd<br \/>\n[root@node1 ~]# echo node1 &gt; \/var\/www\/html\/index.html<br \/>\n[root@node1 ~]# echo ok &gt; \/var\/www\/html\/.test.html<br \/>\n\u914d\u7f6e\u8282\u70b9\u7684\u5176\u4ed6\u53c2\u6570\u8bf7\u53c2\u770bLVS\u7684\u6587\u6863\u4ecb\u7ecd\uff0c\u8fd9\u91cc\u6267\u884c\u5728LVS\u6587\u6863\u4e2d\u4ecb\u7ecd\u7684real server\u4e0a\u6267\u884c\u7684\u811a\u672c(\u53c2\u89c1\u53e6\u5916\u4e00\u7bc7\u535a\u5ba2\uff1aLVS\u8d1f\u8f7d\u5747\u8861\u96c6\u7fa4\u8be6\u89e3\uff09\uff1a<br \/>\n[root@node1 ~]# bash realserver.sh start<br \/>\n&nbsp;<br \/>\n\u5728node2\u4e0a\u6267\u884c\u4e0enode1\u8282\u70b9\u76f8\u540c\u7684\u64cd\u4f5c\uff0c\u4e3a\u4e86\u6f14\u793a\u65b9\u4fbf\u53ef\u4ee5\u770b\u51fa\u6548\u679c\u5728node2\u8282\u70b9\u4e0a\u7684index.html\u9875\u9762\u8f93\u5165\u4e0enode1\u4e0d\u540c\u7684\u5185\u5bb9\u4ee5\u793a\u533a\u5206\u3002<br \/>\n&nbsp;<br \/>\n\u4e94\u3001\u542f\u52a8heartbeat\u670d\u52a1\u6d4b\u8bd5<br \/>\n[root@director1 ha.d]# service heartbeat start<br \/>\n[root@director1 ha.d]# ssh director2 'service heartbeat start'&nbsp;\/\/director\u8282\u70b9\u901a\u8fc7SSH\u542f\u52a8heartbeat\u670d\u52a1<br \/>\n&nbsp;<br \/>\n\u6d4b\u8bd5Director1\u8282\u70b9\u6545\u969c<br \/>\n[root@director1 ha.d]# \/usr\/lib\/heartbeat\/hb_standby&nbsp;\/\/\u8be5\u811a\u672c\u4e3aheartbeat\u81ea\u5e26\u7684\u811a\u672c\u53ef\u4ee5\u4f7f\u8be5\u8282\u70b9\u8f6c\u4e3a\u5907\u7528\u8282\u70b9\u3002<\/p>\n<p style=\"widows:2;text-transform:none;background-color:#efefef;text-indent:0px;letter-spacing:normal;font:14px\/22px tahoma, \u5b8b\u4f53;white-space:normal;orphans:2;color:#333333;word-spacing:0px;-webkit-text-size-adjust:auto;-webkit-text-stroke-width:0px;\"><a id=\"ematt:201\" href=\"\/notes\/content\/uploadfile\/201303\/59b21364114877.png\" target=\"_blank\"><img decoding=\"async\" border=\"0\" alt=\"\u70b9\u51fb\u67e5\u770b\u539f\u56fe\" src=\"\/notes\/content\/uploadfile\/201303\/59b21364114877.png\" \/><\/a><br \/>\n&nbsp;<br \/>\n\u6d4b\u8bd5node1\u8282\u70b9\u6545\u969c<br \/>\n[root@node1 ~]# service httpd stop<\/p>\n<p style=\"widows:2;text-transform:none;background-color:#efefef;text-indent:0px;letter-spacing:normal;font:14px\/22px tahoma, \u5b8b\u4f53;white-space:normal;orphans:2;color:#333333;word-spacing:0px;-webkit-text-size-adjust:auto;-webkit-text-stroke-width:0px;\"><a id=\"ematt:202\" href=\"\/notes\/content\/uploadfile\/201303\/9eb61364114877.png\" target=\"_blank\"><img decoding=\"async\" border=\"0\" alt=\"\u70b9\u51fb\u67e5\u770b\u539f\u56fe\" src=\"\/notes\/content\/uploadfile\/201303\/9eb61364114877.png\" \/><\/a><\/p>\n<p style=\"widows:2;text-transform:none;background-color:#efefef;text-indent:0px;letter-spacing:normal;font:14px\/22px tahoma, \u5b8b\u4f53;white-space:normal;orphans:2;color:#333333;word-spacing:0px;-webkit-text-size-adjust:auto;-webkit-text-stroke-width:0px;\">\u5728director2\u8282\u70b9\u4e0a\u4f7f\u7528ipvsadm -Ln\u547d\u4ee4\u53ef\u4ee5\u770b\u5230\u5df2\u7ecf\u81ea\u52a8\u628anode1\u8282\u70b9\u76f8\u5173\u6761\u76ee\u79fb\u9664<\/p>\n<p style=\"widows:2;text-transform:none;background-color:#efefef;text-indent:0px;letter-spacing:normal;font:14px\/22px tahoma, \u5b8b\u4f53;white-space:normal;orphans:2;color:#333333;word-spacing:0px;-webkit-text-size-adjust:auto;-webkit-text-stroke-width:0px;\">\u6d4b\u8bd5node1\u548cnode2\u8282\u70b9\u540c\u65f6\u6545\u969c\uff0c\u7531\u4e8e\u5728ldirectord\u914d\u7f6e\u6587\u4ef6\u4e2d\u8bbe\u7f6e\u4e86\u5f53\u6240\u6709\u540e\u7aef\u8282\u70b9\u6545\u969c\u65f6\u8bf7\u6c42\u8f6c\u53d1\u81f3director\u672c\u8eab\u768480\u7aef\u53e3\uff0c\u6240\u4ee5\u8fd9\u91cc\u9700\u8981director\u4e5f\u5b89\u88c5httpd\u670d\u52a1\uff0c\u6216\u8005\u4fee\u6539\u8be5\u914d\u7f6e\u6587\u4ef6\u8f6c\u5411\u5176\u4ed6Web\u670d\u52a1\u5668\u3002<br \/>\n&nbsp;<br \/>\n\u603b\u7ed3\uff1a\u81f3\u6b64\u4e00\u4e2a\u9ad8\u53ef\u7528\u7684Director\u8c03\u5ea6\u670d\u52a1\u5668\u96c6\u7fa4\u5df2\u7ecf\u5b8c\u6210\uff0c\u540c\u65f6\u4e5f\u8981\u6ce8\u610f\u5728\u73b0\u5b9e\u73af\u5883\u4e2d\u81f3\u5c11\u89812\u6761\u7ebf\u8def\u6765\u540c\u65f6\u5e7f\u64ad\u8282\u70b9\u5fc3\u8df3\u4fe1\u606f\uff0c\u907f\u514d\u56e0\u4e3a\u7ebf\u8def\u7684\u6545\u969c\u9020\u6210\u8282\u70b9\u95f4\u7684\u8d44\u6e90\u4e89\u593a\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p style=\"text-align:left;padding-bottom:0px;widows:2;text-transform:none;background-color:#ffffff;text-indent:0px;margin:0px 0px 10px;padding-left:0px;letter-spacing:normal;padding-right:0px;font:13px\/21px \u5fae\u8f6f\u96c5\u9ed1, Verdana, sans-serif, \u5b8b\u4f53;white-space:normal;orphans:2;color:#000000;word-spacing:0px;padding-top:0px;-webkit-text-size-adjust:auto;-webkit-text-stroke-width:0px;\">\u4e00\u822c\u6211\u4eec\u7528\u5230\u7684\u96c6\u7fa4\u7cfb\u7edf\u4e3b\u8981\u67092\u79cd:<\/p>\n<p style=\"text-align:left;padding-bottom:0px;widows:2;text-transform:none;background-color:#ffffff;text-indent:0px;margin:0px 0px 10px;padding-left:0px;letter-spacing:normal;padding-right:0px;font:13px\/21px \u5fae\u8f6f\u96c5\u9ed1, Verdana, sans-serif, \u5b8b\u4f53;white-space:normal;orphans:2;color:#000000;word-spacing:0px;padding-top:0px;-webkit-text-size-adjust:auto;-webkit-text-stroke-width:0px;\">\u9ad8\u53ef\u7528(High Availability)HA\u96c6\u7fa4, \u4f7f\u7528Heartbeat\u5b9e\u73b0;\u4e5f\u4f1a\u79f0\u4e3a\u201d\u53cc\u673a\u70ed\u5907\u201d, \u201c\u53cc\u673a\u4e92\u5907\u201d, \u201c\u53cc\u673a\u201d\u3002<\/p>\n<p style=\"text-align:left;padding-bottom:0px;widows:2;text-transform:none;background-color:#ffffff;text-indent:0px;margin:0px 0px 10px;padding-left:0px;letter-spacing:normal;padding-right:0px;font:13px\/21px \u5fae\u8f6f\u96c5\u9ed1, Verdana, sans-serif, \u5b8b\u4f53;white-space:normal;orphans:2;color:#000000;word-spacing:0px;padding-top:0px;-webkit-text-size-adjust:auto;-webkit-text-stroke-width:0px;\"><br style=\"padding-bottom:0px;margin:0px;padding-left:0px;padding-right:0px;padding-top:0px;\" \/><br \/>\n\u8d1f\u8f7d\u5747\u8861\u7fa4\u96c6(Load Balance Cluster)\uff0c\u4f7f\u7528Linux Virtual Server(LVS)\u5b9e\u73b0;<\/p>\n<p style=\"text-align:left;padding-bottom:0px;widows:2;text-transform:none;background-color:#ffffff;text-indent:0px;margin:0px 0px 10px;padding-left:0px;letter-spacing:normal;padding-right:0px;font:13px\/21px \u5fae\u8f6f\u96c5\u9ed1, Verdana, sans-serif, \u5b8b\u4f53;white-space:normal;orphans:2;color:#000000;word-spacing:0px;padding-top:0px;-webkit-text-size-adjust:auto;-webkit-text-stroke-width:0px;\">&nbsp;<\/p>\n<p style=\"text-align:left;padding-bottom:0px;widows:2;text-transform:none;background-color:#ffffff;text-indent:0px;margin:0px 0px 10px;padding-left:0px;letter-spacing:normal;padding-right:0px;font:13px\/21px \u5fae\u8f6f\u96c5\u9ed1, Verdana, sans-serif, \u5b8b\u4f53;white-space:normal;orphans:2;color:#000000;word-spacing:0px;padding-top:0px;-webkit-text-size-adjust:auto;-webkit-text-stroke-width:0px;\">heartbeat \uff08Linux-HA\uff09\u7684\u5de5\u4f5c\u539f\u7406\uff1aheartbeat\u6700\u6838\u5fc3\u7684\u5305\u62ec\u4e24\u4e2a\u90e8\u5206\uff0c\u5fc3\u8df3\u76d1\u6d4b\u90e8\u5206\u548c\u8d44\u6e90\u63a5\u7ba1\u90e8\u5206\uff0c\u5fc3\u8df3\u76d1\u6d4b\u53ef\u4ee5\u901a\u8fc7\u7f51\u7edc\u94fe\u8def\u548c\u4e32\u53e3\u8fdb\u884c\uff0c\u800c\u4e14\u652f\u6301\u5197 \u4f59\u94fe\u8def\uff0c\u5b83\u4eec\u4e4b\u95f4\u76f8\u4e92\u53d1\u9001\u62a5\u6587\u6765\u544a\u8bc9\u5bf9\u65b9\u81ea\u5df1\u5f53\u524d\u7684\u72b6\u6001\uff0c\u5982\u679c\u5728\u6307\u5b9a\u7684\u65f6\u95f4\u5185\u672a\u53d7\u5230\u5bf9\u65b9\u53d1\u9001\u7684\u62a5\u6587\uff0c\u90a3\u4e48\u5c31\u8ba4\u4e3a\u5bf9\u65b9\u5931\u6548\uff0c\u8fd9\u65f6\u9700\u542f\u52a8\u8d44\u6e90\u63a5...<\/p>\n<p> <a href=\"https:\/\/www.xiaobo.li\/notes\/archives\/297\">\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":[283],"tags":[110,111],"class_list":["post-297","post","type-post","status-publish","format-standard","hentry","category-technologys","tag-heartbeat","tag-lvs"],"_links":{"self":[{"href":"https:\/\/www.xiaobo.li\/notes\/wp-json\/wp\/v2\/posts\/297","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=297"}],"version-history":[{"count":0,"href":"https:\/\/www.xiaobo.li\/notes\/wp-json\/wp\/v2\/posts\/297\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.xiaobo.li\/notes\/wp-json\/wp\/v2\/media?parent=297"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.xiaobo.li\/notes\/wp-json\/wp\/v2\/categories?post=297"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.xiaobo.li\/notes\/wp-json\/wp\/v2\/tags?post=297"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}