{"id":32764,"date":"2026-08-24T10:00:00","date_gmt":"2026-08-24T02:00:00","guid":{"rendered":"https:\/\/cn.hostease.com\/blog\/?p=32764"},"modified":"2026-08-24T14:20:51","modified_gmt":"2026-08-24T06:20:51","slug":"keepalived-vrrp-practical","status":"publish","type":"post","link":"https:\/\/cn.hostease.com\/blog\/guides\/keepalived-vrrp-practical\/","title":{"rendered":"Keepalived VRRP \u5065\u5eb7\u68c0\u67e5\u914d\u7f6e\uff1a\u4e3b\u5907\u5207\u6362\u4e0e\u8111\u88c2\u9632\u62a4\u5b9e\u6218"},"content":{"rendered":"<p><img decoding=\"async\" src=\"https:\/\/cn.hostease.com\/blog\/wp-content\/uploads\/2026\/08\/keepalived-vrrp-practical-cover.webp\" alt=\"Keepalived VRRP \u5065\u5eb7\u68c0\u67e5\u5c01\u9762\" loading=\"lazy\" \/><\/p>\n<p>\u8fd9\u7bc7\u6307\u5357\u5e2e\u52a9\u4f60\u7406\u89e3 Keepalived VRRP \u5065\u5eb7\u68c0\u67e5\u7684\u5de5\u4f5c\u539f\u7406\uff0c\u638c\u63e1\u4e3b\u5907\u5207\u6362\u4e0e\u8111\u88c2\u9632\u62a4\u7684\u914d\u7f6e\u65b9\u6cd5\u3002\u5bf9\u8fd0\u884c\u5728 [VPS](https:\/\/cn.hostease.com\/vps\/)\uff08Virtual Private Server\uff0c[\u865a\u62df\u4e13\u7528\u670d\u52a1\u5668](https:\/\/cn.hostease.com\/vps\/)\uff09\u6216[\u72ec\u7acb\u670d\u52a1\u5668](https:\/\/cn.hostease.com\/dedicated-server\/)\u4e0a\u7684\u4e1a\u52a1\u6765\u8bf4\uff0c\u5355\u70b9\u6545\u969c\uff08single point of failure\uff0c\u6307\u7cfb\u7edf\u4e2d\u67d0\u4e2a\u7ec4\u4ef6\u4e00\u65e6\u5931\u6548\u4f1a\u5bfc\u81f4\u6574\u4e2a\u670d\u52a1\u4e0d\u53ef\u7528\uff09\u662f\u6700\u5e38\u89c1\u7684\u53ef\u7528\u6027\u98ce\u9669\uff0cKeepalived \u6b63\u662f\u89e3\u51b3\u8fd9\u7c7b\u95ee\u9898\u6700\u5e38\u7528\u7684\u5de5\u5177\u3002<\/p>\n<p>Keepalived \u57fa\u4e8e VRRP\uff08Virtual Router Redundancy Protocol\uff0c\u865a\u62df\u8def\u7531\u5197\u4f59\u534f\u8bae\uff09\u5b9e\u73b0\u9ad8\u53ef\u7528\u3002\u4e24\u53f0\u4e3b\u673a\u7ec4\u6210\u4e00\u4e2a\u865a\u62df\u8def\u7531\u7ec4\uff0c\u5bf9\u5916\u5171\u4eab\u4e00\u4e2a\u865a\u62df IP\uff08Virtual IP\uff0cVIP\uff09\uff0c\u6b63\u5e38\u60c5\u51b5\u4e0b\u53ea\u6709\u4e3b\u8282\u70b9\u54cd\u5e94\u8bf7\u6c42\uff0c\u5907\u8282\u70b9\u901a\u8fc7\u5fc3\u8df3\u968f\u65f6\u51c6\u5907\u63a5\u7ba1\u3002\u548c <a href=\"https:\/\/cn.hostease.com\/blog\/guides\/mysql-cloud-server-database-deployment-practical\/\">MySQL \u4e91\u670d\u52a1\u5668\uff08\u5728\u4e91\u7aef\u63d0\u4f9b\u5f39\u6027\u8ba1\u7b97\u8d44\u6e90\u7684\u865a\u62df\u673a\u5b9e\u4f8b\uff09\u6570\u636e\u5e93\u90e8\u7f72<\/a>\u8fd9\u7c7b\u5f3a\u8c03\u5355\u673a\u53ef\u9760\u6027\u7684\u65b9\u6848\u4e0d\u540c\uff0cKeepalived \u89e3\u51b3\u7684\u662f&#8221;\u8fd9\u53f0\u673a\u5668\u6302\u4e86\u600e\u4e48\u529e&#8221;\u7684\u95ee\u9898\u3002\u672c\u6587\u4e0d\u5c55\u5f00 VRRP \u5168\u90e8\u53c2\u6570\uff0c\u53ea\u805a\u7126\u5065\u5eb7\u68c0\u67e5\u600e\u4e48\u914d\u3001\u4e3b\u5907\u5207\u6362\u600e\u4e48\u53d1\u751f\u3001\u8111\u88c2\uff08split-brain\uff0c\u6307\u4e24\u4e2a\u8282\u70b9\u540c\u65f6\u8ba4\u4e3a\u81ea\u5df1\u662f\u4e3b\u8282\u70b9\uff09\u600e\u4e48\u9632\u3002<\/p>\n<h2>\u4e00\u3001Keepalived \u4e3b\u5907\u5207\u6362\u662f\u5982\u4f55\u53d1\u751f\u7684<\/h2>\n<p>Keepalived \u7531\u4e24\u4e2a\u6838\u5fc3\u7ec4\u4ef6\u6784\u6210\uff1aVRRP \u6808\u8d1f\u8d23\u8282\u70b9\u4e4b\u95f4\u7684\u4e3b\u5907\u534f\u5546\uff0c\u5065\u5eb7\u68c0\u67e5\u811a\u672c\u8d1f\u8d23\u63a2\u6d4b\u4e1a\u52a1\u662f\u5426\u771f\u7684\u5065\u5eb7\u3002\u9ed8\u8ba4\u60c5\u51b5\u4e0b\uff0cKeepalived \u7684 MASTER\uff08\u4e3b\u8282\u70b9\uff09\u4ee5\u56fa\u5b9a\u95f4\u9694\u5411 BACKUP\uff08\u5907\u8282\u70b9\uff09\u53d1\u9001 VRRP \u901a\u544a\u5305\uff0c\u5907\u8282\u70b9\u8fde\u7eed\u82e5\u5e72\u6b21\u6536\u4e0d\u5230\u901a\u544a\u540e\uff0c\u4f1a\u8ba4\u5b9a\u4e3b\u8282\u70b9\u5df2\u5931\u6548\uff0c\u8fdb\u5165 MASTER \u72b6\u6001\u63a5\u7ba1\u865a\u62df IP\u3002\u8fd9\u4e2a\u8fc7\u7a0b\u5c31\u662f\u4e3b\u5907\u5207\u6362\u3002<\/p>\n<p>\u5065\u5eb7\u68c0\u67e5\u811a\u672c\u662f\u5224\u65ad&#8221;\u670d\u52a1\u662f\u5426\u5065\u5eb7&#8221;\u7684\u5165\u53e3\u3002\u4ec5\u9760 VRRP \u901a\u544a\u53ea\u80fd\u5224\u65ad\u8282\u70b9\u8fdb\u7a0b\u662f\u5426\u5b58\u6d3b\uff0c\u65e0\u6cd5\u5224\u65ad\u4e1a\u52a1\u8fdb\u7a0b\u662f\u5426\u6b63\u5e38\u3002\u6bd4\u5982 Nginx \u8fdb\u7a0b\u8fd8\u6d3b\u7740\uff0c\u4f46\u540e\u7aef\u7684\u6570\u636e\u5e93\u8fde\u63a5\u5df2\u7ecf\u65ad\u6389\uff0c\u6b64\u65f6\u5982\u679c\u53ea\u505a\u8fdb\u7a0b\u7ea7\u68c0\u67e5\uff0c\u4e3b\u8282\u70b9\u4f9d\u7136\u4e0d\u4f1a\u8ba9\u51fa\u865a\u62df IP\uff0c\u7528\u6237\u8bbf\u95ee\u5c31\u4f1a\u6301\u7eed\u62a5\u9519\u3002\u6b63\u786e\u505a\u6cd5\u662f\u628a\u4e1a\u52a1\u5173\u952e\u8def\u5f84\u5199\u8fdb\u68c0\u67e5\u811a\u672c\uff0c\u7531\u811a\u672c\u7ed3\u679c\u51b3\u5b9a Keepalived \u662f\u5426\u8ba9\u51fa\u4e3b\u8282\u70b9\u3002<\/p>\n<h2>\u4e8c\u3001\u5065\u5eb7\u68c0\u67e5\u811a\u672c\u7684\u5199\u6cd5<\/h2>\n<p>\u5065\u5eb7\u68c0\u67e5\u811a\u672c\u901a\u5e38\u653e\u5728 \/etc\/keepalived\/check_service.sh\uff0c\u5224\u65ad\u7ed3\u679c\u901a\u8fc7\u9000\u51fa\u7801\u8fd4\u56de\uff1a\u8fd4\u56de 0 \u8868\u793a\u5065\u5eb7\uff0c\u8fd4\u56de\u975e 0 \u8868\u793a\u4e0d\u5065\u5eb7\u3002Keepalived \u6839\u636e\u8fde\u7eed\u5931\u8d25\u6b21\u6570\u89e6\u53d1\u964d\u7ea7\u3002<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"bash\" data-enlighter-linenumbers=\"false\">#!\/bin\/bash\n curl -sf http:\/\/127.0.0.1:8080\/health >\/dev\/null 2>&1 || exit 1\n check=$(curl -s -o \/dev\/null -w \"%{http_code}\" http:\/\/127.0.0.1:8080\/health)\n if [ \"$check\" != \"200\" ]; then\n   exit 1\n fi\n exit 0<\/pre>\n<p>\u68c0\u67e5\u811a\u672c\u9ed8\u8ba4\u4f4d\u4e8e \/etc\/keepalived\/check_service.sh\uff0c\u5e76\u8d4b\u4e88\u53ef\u6267\u884c\u6743\u9650\u3002\u811a\u672c\u91cc\u5efa\u8bae\u5305\u542b\u4e24\u5c42\u5224\u65ad\uff1a\u7b2c\u4e00\u5c42\u7528 curl \u786e\u8ba4 HTTP \u670d\u52a1\u8fd4\u56de 200\uff1b\u7b2c\u4e8c\u5c42\u53ef\u4ee5\u68c0\u67e5\u4f9d\u8d56\u7684\u672c\u5730\u7aef\u53e3\u662f\u5426\u76d1\u542c\u3002\u6ce8\u610f\u811a\u672c\u7684\u9000\u51fa\u7801\u662f Keepalived \u5224\u65ad\u5065\u5eb7\u7684\u552f\u4e00\u4f9d\u636e\uff0c\u4efb\u4f55\u672a\u6355\u83b7\u7684\u9519\u8bef\u90fd\u53ef\u80fd\u5bfc\u81f4\u8bef\u5224\uff0c\u5efa\u8bae\u628a\u903b\u8f91\u5199\u6210&#8221;\u5168\u901a\u8fc7\u624d\u8fd4\u56de 0&#8243;\u3002<\/p>\n<p><img decoding=\"async\" src=\"https:\/\/cn.hostease.com\/blog\/wp-content\/uploads\/2026\/08\/keepalived-vrrp-practical-healthcheck.webp\" alt=\"Keepalived \u5065\u5eb7\u68c0\u67e5\u6d41\u7a0b\" loading=\"lazy\" \/><\/p>\n<h2>\u4e09\u3001Keepalived \u4e3b\u5907\u914d\u7f6e\u793a\u4f8b<\/h2>\n<p>\u4e0b\u9762\u662f\u4e00\u4e2a\u5178\u578b\u7684\u4e24\u8282\u70b9\u4e3b\u5907\u914d\u7f6e\u3002\u4e3b\u8282\u70b9\u548c\u5907\u8282\u70b9\u9664\u4e86 state \u4e0e priority \u4e0d\u540c\uff0c\u5176\u4f59\u4fdd\u6301\u4e00\u81f4\u3002\u8fd9\u91cc\u4ee5\u7aef\u53e3 8080 \u7684\u5e94\u7528\u670d\u52a1\u4e3a\u4f8b\u3002<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"bash\" data-enlighter-linenumbers=\"false\">vrrp_instance VI_1 {\n  state MASTER\n  interface eth0\n  virtual_router_id 51\n  priority 150\n  advert_int 1\n  virtual_ipaddress {\n    10.0.0.100\/24\n  }\n  track_script {\n    chk_service\n  }\n  notify_master \"\/etc\/keepalived\/notify.sh master\"\n  notify_backup \"\/etc\/keepalived\/notify.sh backup\"\n  notify_fault \"\/etc\/keepalived\/notify.sh fault\"\n}\n\nvrrp_script chk_service {\n  script \"\/etc\/keepalived\/check_service.sh\"\n  interval 2\n  timeout 3\n  fall 3\n  rise 2\n}<\/pre>\n<p>\u5907\u8282\u70b9\u7684 state \u6539\u4e3a BACKUP\uff0cpriority \u6539\u4e3a 100\uff0c\u5176\u4f59\u914d\u7f6e\u4fdd\u6301\u4e00\u81f4\u3002priority \u51b3\u5b9a\u8c01\u4f18\u5148\u6210\u4e3a\u4e3b\u8282\u70b9\uff0c\u540c\u4e00\u865a\u62df\u8def\u7531\u7ec4\u5185 priority \u8d8a\u9ad8\u7684\u8282\u70b9\u5728\u5065\u5eb7\u65f6\u8d8a\u6709\u673a\u4f1a\u6210\u4e3a MASTER\u3002\u8fd9\u91cc\u7ed9\u7684\u662f\u5178\u578b\u533a\u95f4\u793a\u4f8b\uff0c\u5b9e\u9645\u4f18\u5148\u7ea7\u8bf7\u6309\u7ec4\u5185\u8282\u70b9\u6570\u91cf\u8c03\u6574\u3002\u5907\u8282\u70b9\u914d\u7f6e\u4e2d\u4e0d\u8981\u8bbe\u7f6e mcast_src_ip \u6216\u4f7f\u7528\u4e0d\u540c\u7f51\u5361\u5730\u5740\uff0c\u5426\u5219\u4f1a\u5f71\u54cd VRRP \u7ec4\u64ad\u901a\u4fe1\u3002<\/p>\n<h2>\u56db\u3001\u8111\u88c2\u9632\u62a4<\/h2>\n<p>\u8111\u88c2\u662f Keepalived \u9ad8\u53ef\u7528\u91cc\u6700\u5371\u9669\u7684\u6545\u969c\uff0c\u6307\u4e24\u4e2a\u8282\u70b9\u540c\u65f6\u8ba4\u4e3a\u81ea\u5df1\u662f\u4e3b\u8282\u70b9\uff0c\u540c\u65f6\u7ed1\u5b9a\u865a\u62df IP\uff0c\u5bfc\u81f4\u540c\u4e00\u65f6\u95f4\u6709\u4e24\u4e2a\u8282\u70b9\u5904\u7406\u5199\u8bf7\u6c42\uff0c\u6570\u636e\u4e00\u81f4\u6027\u548c\u670d\u52a1\u53ef\u7528\u6027\u90fd\u88ab\u7834\u574f\u3002\u8111\u88c2\u7684\u5e38\u89c1\u8bf1\u56e0\u6709\u7f51\u7edc\u6296\u52a8\u5bfc\u81f4 VRRP \u901a\u544a\u4e22\u5931\u3001\u9632\u706b\u5899\u963b\u6321\u4e86 VRRP \u7ec4\u64ad\uff08\u7ec4\u64ad\u5730\u5740 224.0.0.18\uff0c\u7aef\u53e3 112\uff09\u3001\u4e24\u4e2a\u8282\u70b9\u914d\u7f6e\u4e86\u4e0d\u540c\u7684 virtual_router_id\u3002<\/p>\n<p>\u57fa\u7840\u9632\u62a4\u5305\u62ec\uff1a<strong>advert_int \u4fdd\u6301\u4e00\u81f4\u7684\u9ed8\u8ba4\u95f4\u9694<\/strong>\uff0c\u907f\u514d\u4e3b\u8282\u70b9\u901a\u544a\u8fc7\u6162\uff1b<strong>\u5728\u4e91\u5382\u5546\u5b89\u5168\u7ec4\u653e\u884c VRRP \u534f\u8bae<\/strong>\uff08\u534f\u8bae\u53f7 112\uff09\uff0c\u5426\u5219\u5fc3\u8df3\u88ab\u62e6\u622a\uff1b<strong>\u914d\u7f6e notify_fault \u811a\u672c<\/strong>\uff0c\u5f53\u8282\u70b9\u8fdb\u5165 fault \u72b6\u6001\u65f6\u4e3b\u52a8\u964d\u7ea7\u5e76\u91ca\u653e\u865a\u62df IP\uff0c\u800c\u4e0d\u662f\u7ee7\u7eed\u62a2\u4e3b\u3002\u6b64\u5916\u53ef\u4ee5\u5728 notify_fault \u91cc\u8c03\u7528\u4ef2\u88c1\u903b\u8f91\uff0c\u7ed3\u5408\u6570\u636e\u5e93\u9501\u6216\u7b2c\u4e09\u65b9\u6848\u4f8b\u6765\u786e\u8ba4\u662f\u5426\u771f\u7684\u9700\u8981\u63a5\u7ba1\u3002<\/p>\n<p><img decoding=\"async\" src=\"https:\/\/cn.hostease.com\/blog\/wp-content\/uploads\/2026\/08\/keepalived-vrrp-practical-splitbrain.webp\" alt=\"Keepalived \u8111\u88c2\u9632\u62a4\" loading=\"lazy\" \/><\/p>\n<p>\u6392\u67e5\u8111\u88c2\u65f6\uff0c\u5148\u5728\u4e3b\u5907\u8282\u70b9\u5206\u522b\u6267\u884c ip addr \u67e5\u770b\u865a\u62df IP \u662f\u5426\u540c\u65f6\u5b58\u5728\u3002\u5982\u679c\u540c\u65f6\u5b58\u5728\uff0c\u8bf4\u660e\u5df2\u7ecf\u8111\u88c2\u3002\u66f4\u591a\u7f51\u7edc\u5c42\u9762\u95ee\u9898\u7684\u5b9a\u4f4d\u601d\u8def\uff0c\u53ef\u53c2\u8003 <a href=\"https:\/\/cn.hostease.com\/blog\/guides\/nginx-limit-req-rate-limiting\/\">Nginx \u9650\u6d41\u914d\u7f6e<\/a>\u4e2d\u5173\u4e8e\u6d41\u91cf\u5165\u53e3\u5c42\u505a\u9632\u62a4\u7684\u5bf9\u7167\u7406\u89e3\u3002\u6570\u636e\u5e93\u573a\u666f\u4e0b\uff0c\u82e5\u5065\u5eb7\u68c0\u67e5\u4f9d\u8d56 MySQL \u72b6\u6001\uff0c\u5efa\u8bae\u540c\u65f6\u53c2\u8003 <a href=\"https:\/\/cn.hostease.com\/blog\/guides\/mysql-slow-query-analysis\/\">MySQL \u6162\u67e5\u8be2\u5206\u6790<\/a>\uff0c\u5148\u6392\u9664\u6162 SQL \u62d6\u57ae\u68c0\u67e5\u811a\u672c\u8d85\u65f6\u7684\u53ef\u80fd\u3002<\/p>\n<h2>\u4e94\u3001\u5207\u6362\u9a8c\u8bc1\u4e0e\u56de\u6eda<\/h2>\n<p>\u914d\u7f6e\u5b8c\u6210\u540e\u4e0d\u80fd\u53ea\u9760&#8221;\u770b\u8d77\u6765\u6b63\u5e38&#8221;\u5c31\u4e0a\u7ebf\uff0c\u5fc5\u987b\u505a\u4e00\u6b21\u53d7\u63a7\u7684\u4e3b\u5907\u5207\u6362\u6f14\u7ec3\u3002\u6f14\u7ec3\u524d\u5148\u8bb0\u5f55\u5f53\u524d\u4e3b\u8282\u70b9\u662f\u8c01\uff0c\u7528 ip addr \u786e\u8ba4\u865a\u62df IP \u6302\u5728\u54ea\u4e2a\u8282\u70b9\u3002\u7136\u540e\u5728\u4e3b\u8282\u70b9\u4e0a\u505c\u6389\u5173\u952e\u670d\u52a1\uff0c\u89c2\u5bdf\u865a\u62df IP \u662f\u5426\u5728 fail \u5468\u671f\u5185\u8fc1\u79fb\u5230\u5907\u8282\u70b9\uff0c\u540c\u65f6\u786e\u8ba4\u7528\u6237\u8bf7\u6c42\u6ca1\u6709\u957f\u65f6\u95f4\u4e2d\u65ad\u3002<\/p>\n<p>\u9a8c\u8bc1\u547d\u4ee4\u5982\u4e0b\uff1a<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"bash\" data-enlighter-linenumbers=\"false\"># \u67e5\u770b\u5f53\u524d\u865a\u62df IP \u5f52\u5c5e\nip addr | grep 10.20.0.10\n # \u6a21\u62df\u4e3b\u8282\u70b9\u6545\u969c\nsystemctl stop keepalived\n # \u5907\u8282\u70b9\u89c2\u5bdf\ntail -f \/var\/log\/keepalived.log<\/pre>\n<p>\u6f14\u7ec3\u901a\u8fc7\u540e\uff0c\u628a\u4e3b\u8282\u70b9\u670d\u52a1\u6062\u590d\u5e76\u91cd\u542f Keepalived\u3002\u89c2\u5bdf\u5b83\u662f\u5426\u6309 priority \u5dee\u5f02\u91cd\u65b0\u593a\u56de\u4e3b\u8282\u70b9\uff0c\u8fd8\u662f\u4fdd\u6301\u5728\u5907\u8282\u70b9\u72b6\u6001\u2014\u2014\u8fd9\u53d6\u51b3\u4e8e\u4f60\u662f\u5426\u914d\u7f6e\u4e86\u62a2\u5360\uff08nopreempt\uff09\u9009\u9879\u3002\u82e5\u5207\u6362\u8fc7\u7a0b\u4e2d\u7528\u6237\u8bf7\u6c42\u4e2d\u65ad\u8d85\u8fc7\u9884\u671f\uff0c\u56de\u6eda\u5230\u5355\u8282\u70b9\u8fd0\u884c\u5373\u53ef\uff1a\u628a\u5907\u7528\u8282\u70b9\u5173\u95ed Keepalived\uff0c\u8ba9\u865a\u62df IP \u56de\u5230\u539f\u4e3b\u8282\u70b9\u3002\u5bf9\u4f9d\u8d56\u5173\u7cfb\u590d\u6742\u3001\u68c0\u67e5\u811a\u672c\u6709\u8bef\u5224\u98ce\u9669\u7684\u670d\u52a1\uff0c\u5efa\u8bae\u5148\u5728\u5907\u7528\u8282\u70b9\u4e0a\u5355\u72ec\u8dd1\u811a\u672c\u9a8c\u8bc1\u9000\u51fa\u7801\u518d\u63a5\u5165 Keepalived\u3002<\/p>\n<p>\u5982\u679c\u670d\u52a1\u7aef\u53e3\u7ecf\u5e38\u53d8\u5316\uff0c\u5065\u5eb7\u68c0\u67e5\u811a\u672c\u5efa\u8bae\u7528\u8f7b\u91cf\u53ea\u8bfb\u7aef\u53e3\u4ee3\u66ff\u5177\u4f53\u4e1a\u52a1\u7aef\u53e3\uff0c\u907f\u514d\u811a\u672c\u8bef\u62a5\u3002\u82e5\u62c5\u5fc3 HTTP \u7aef\u53e3\u6821\u9a8c\u4e0e\u7aef\u53e3\u5360\u7528\u51b2\u7a81\uff0c\u53ef\u53c2\u8003 <a href=\"https:\/\/cn.hostease.com\/blog\/guides\/redis-persistence-recovery\/\">Redis \u6301\u4e45\u5316\u4e0e\u6062\u590d<\/a>\u7684\u601d\u8def\uff0c\u5148\u5b9a\u4f4d\u670d\u52a1\u672c\u8eab\u7684\u8d44\u6e90\u57fa\u7ebf\u518d\u51b3\u5b9a\u68c0\u67e5\u7c92\u5ea6\u3002<\/p>\n<h2>\u516d\u3001\u76d1\u63a7\u4e0e\u544a\u8b66\u6536\u53e3<\/h2>\n<p>\u4ec5\u9760 Keepalived \u81ea\u8eab\u65e5\u5fd7\u4e0d\u591f\uff0c\u5efa\u8bae\u628a\u4e3b\u5907\u5207\u6362\u4e8b\u4ef6\u63a5\u5165\u76d1\u63a7\u7cfb\u7edf\u3002Keepalived \u7684 notify \u811a\u672c\u4f1a\u628a\u4e8b\u4ef6\u5199\u8fdb\u65e5\u5fd7\uff0c\u53ef\u5c06\u65e5\u5fd7\u5185\u5bb9\u8f6c\u53d1\u5230\u76d1\u63a7\u9762\u677f\u3002\u8fd9\u91cc\u4ee5\u5e38\u89c1\u7684\u6307\u6807\u91c7\u96c6\u4e3a\u4f8b\uff1a\u8bb0\u5f55\u6700\u540e\u4e00\u6b21 MASTER\/BACKUP \u5207\u6362\u65f6\u95f4\u3001\u5f53\u524d\u8282\u70b9\u89d2\u8272\u3001\u865a\u62df IP \u662f\u5426\u5c31\u7eea\u3002\u628a\u8fd9\u4e9b\u6307\u6807\u4ea4\u7ed9\u76d1\u63a7\u5e73\u53f0\u96c6\u4e2d\u5c55\u793a\uff0c\u53ef\u4ee5\u7b2c\u4e00\u65f6\u95f4\u53d1\u73b0\u9891\u7e41\u5207\u6362\u7b49\u5f02\u5e38\uff0c\u800c\u4e0d\u9700\u8981\u6bcf\u6b21\u5207\u6362\u90fd\u767b\u5f55\u670d\u52a1\u5668\u6392\u67e5\u3002\u76f8\u5173\u65b9\u6848\u53ef\u53c2\u8003 <a href=\"https:\/\/cn.hostease.com\/blog\/guides\/grafana-server-deployment-practical\/\">Grafana \u670d\u52a1\u5668\u90e8\u7f72\u5b9e\u6218<\/a>\u505a\u4e00\u5957\u5b8c\u6574\u7684\u53ef\u89c6\u5316\u76d1\u63a7\uff0c\u628a\u5207\u6362\u4e8b\u4ef6\u4e0e\u4e1a\u52a1\u6307\u6807\u5bf9\u7167\u8d77\u6765\u770b\u3002<\/p>\n<p>\u5982\u679c\u7ad9\u70b9\u542f\u7528\u4e86 HTTPS\uff08Hypertext Transfer Protocol Secure\uff0c\u8d85\u6587\u672c\u4f20\u8f93\u5b89\u5168\u534f\u8bae\uff09\uff0c\u8bc1\u4e66\u7eed\u671f\u5931\u8d25\u4e5f\u4f1a\u8ba9\u5065\u5eb7\u68c0\u67e5\u8bef\u5224\u670d\u52a1\u5f02\u5e38\uff0c\u5efa\u8bae\u4e00\u5e76\u63a5\u5165\u8bc1\u4e66\u5230\u671f\u76d1\u63a7\uff0c\u601d\u8def\u4e0e <a href=\"https:\/\/cn.hostease.com\/blog\/guides\/certbot-troubleshooting-server-ssl\/\">Certbot SSL\uff08Secure Sockets Layer\uff0c\u5b89\u5168\u5957\u63a5\u5c42\uff09\u8bc1\u4e66\u6392\u67e5<\/a>\u4e00\u81f4\u3002\u628a\u8fd9\u4e9b\u76d1\u63a7\u4e32\u8054\u8d77\u6765\uff0c\u4e3b\u5907\u5207\u6362\u5c31\u4e0d\u518d\u662f&#8221;\u9ed1\u76d2\u64cd\u4f5c&#8221;\u3002<\/p>\n<h2>\u603b\u7ed3<\/h2>\n<p>Keepalived VRRP \u5065\u5eb7\u68c0\u67e5\u914d\u7f6e\u7684\u6838\u5fc3\u662f\uff1a\u811a\u672c\u9000\u51fa\u7801\u51b3\u5b9a\u4e1a\u52a1\u5065\u5eb7\u3001priority \u51b3\u5b9a\u4e3b\u5907\u89d2\u8272\u3001notify \u811a\u672c\u8d1f\u8d23\u6545\u969c\u540e\u91ca\u653e\u8d44\u6e90\u3002\u4e3b\u5907\u5207\u6362\u4e0e\u8111\u88c2\u9632\u62a4\u7684\u8981\u70b9\u662f\u2014\u2014\u4f18\u5148\u7ea7\u3001\u8def\u7531 ID\u3001\u901a\u544a\u95f4\u9694\u3001VRRP \u534f\u8bae\u53f7\u8fd9\u56db\u9879\u5728\u96c6\u7fa4\u8282\u70b9\u4e4b\u95f4\u5fc5\u987b\u4fdd\u6301\u4e00\u81f4\uff0c\u7f3a\u4e00\u4e2a\u90fd\u53ef\u80fd\u5f15\u53d1\u8bef\u5207\u6362\u3002\u5efa\u8bae\u5148\u505a\u4e3b\u5907\u5207\u6362\u6f14\u7ec3\uff0c\u7528 ip addr \u548c\u65e5\u5fd7\u9a8c\u8bc1\u865a\u62df IP \u8fc1\u79fb\u4e0e\u6062\u590d\uff0c\u518d\u6295\u5165\u751f\u4ea7\u3002\u5bf9 Hostease \u73af\u5883\u4e0a\u7684\u9ad8\u53ef\u7528\u90e8\u7f72\uff0c\u628a\u5065\u5eb7\u68c0\u67e5\u811a\u672c\u5199\u7a33\u3001\u628a\u8111\u88c2\u9632\u62a4\u914d\u5168\uff0c\u6bd4\u5355\u7eaf\u5806\u53e0 Keepalived \u914d\u7f6e\u66f4\u80fd\u4fdd\u8bc1\u4e1a\u52a1\u8fde\u7eed\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u4ece VRRP \u539f\u7406\u51fa\u53d1\uff0c\u8bb2\u89e3 Keepalived \u5065\u5eb7\u68c0\u67e5\u3001\u4e3b\u5907\u5207\u6362\u4e0e\u8111\u88c2\u9632\u62a4\u914d\u7f6e\uff0c\u5e76\u7ed9\u51fa\u6821\u9a8c\u4e0e\u56de\u6eda\u65b9\u6cd5\u3002<\/p>\n","protected":false},"author":2,"featured_media":32761,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_jetpack_memberships_contains_paid_content":false,"footnotes":""},"categories":[3822],"tags":[4905,4906,4907,4908,4909],"class_list":["post-32764","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-guides","tag-keepalived","tag-vrrp","tag-4907","tag-4908","tag-4909"],"aioseo_notices":[],"jetpack_featured_media_url":"https:\/\/cn.hostease.com\/blog\/wp-content\/uploads\/2026\/08\/keepalived-vrrp-practical-cover.webp","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/cn.hostease.com\/blog\/wp-json\/wp\/v2\/posts\/32764","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/cn.hostease.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/cn.hostease.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/cn.hostease.com\/blog\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/cn.hostease.com\/blog\/wp-json\/wp\/v2\/comments?post=32764"}],"version-history":[{"count":1,"href":"https:\/\/cn.hostease.com\/blog\/wp-json\/wp\/v2\/posts\/32764\/revisions"}],"predecessor-version":[{"id":32765,"href":"https:\/\/cn.hostease.com\/blog\/wp-json\/wp\/v2\/posts\/32764\/revisions\/32765"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/cn.hostease.com\/blog\/wp-json\/wp\/v2\/media\/32761"}],"wp:attachment":[{"href":"https:\/\/cn.hostease.com\/blog\/wp-json\/wp\/v2\/media?parent=32764"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/cn.hostease.com\/blog\/wp-json\/wp\/v2\/categories?post=32764"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/cn.hostease.com\/blog\/wp-json\/wp\/v2\/tags?post=32764"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}