{"id":935,"date":"2025-10-11T17:13:29","date_gmt":"2025-10-11T09:13:29","guid":{"rendered":"https:\/\/www.chinaenow.com\/blog\/?p=935"},"modified":"2025-10-11T17:13:29","modified_gmt":"2025-10-11T09:13:29","slug":"%e5%ae%b9%e9%94%99%e6%9c%8d%e5%8a%a1%e5%99%a8%e5%a6%82%e4%bd%95%e5%ae%9e%e7%8e%b0%e4%ba%92%e5%a4%87%e5%8a%9f%e8%83%bd%ef%bc%9f","status":"publish","type":"post","link":"https:\/\/www.chinaenow.com\/blog\/935.html","title":{"rendered":"\u5bb9\u9519\u670d\u52a1\u5668\u5982\u4f55\u5b9e\u73b0\u4e92\u5907\u529f\u80fd\uff1f"},"content":{"rendered":"<p><p>\u5bb9\u9519\u670d\u52a1\u5668\u662f\u4e00\u79cd\u80fd\u591f\u5728\u786c\u4ef6\u6216\u8f6f\u4ef6\u51fa\u73b0\u6545\u969c\u65f6\u81ea\u52a8\u5207\u6362\u5230\u5907\u7528\u670d\u52a1\u5668\u7684\u7cfb\u7edf\uff0c\u4ee5\u786e\u4fdd\u670d\u52a1\u7684\u8fde\u7eed\u6027\u548c\u7a33\u5b9a\u6027\u3002\u672c\u6587\u5c06\u63d0\u4f9b\u4e00\u4e2a\u5b9e\u64cd\u5bfc\u5411\u7684\u6307\u5357\uff0c\u5e2e\u52a9\u60a8\u914d\u7f6e\u4e00\u4e2a\u57fa\u672c\u7684\u5bb9\u9519\u670d\u52a1\u5668\u73af\u5883\u3002<\/p>\n<p style=\"text-align:center\"><img decoding=\"async\" src=\"https:\/\/www.chinaenow.com\/blog\/wp-content\/uploads\/2025\/10\/k21WO65hh.jpg\" alt=\"\u5bb9\u9519\u670d\u52a1\u5668\u5982\u4f55\u5b9e\u73b0\u4e92\u5907\u529f\u80fd\uff1f\" title=\"\u5bb9\u9519\u670d\u52a1\u5668\u5982\u4f55\u5b9e\u73b0\u4e92\u5907\u529f\u80fd\uff1f\"><\/p>\n<\/p>\n<p><h2>\u64cd\u4f5c\u524d\u7684\u51c6\u5907\u6216\u80cc\u666f\u4ecb\u7ecd<\/h2>\n<\/p>\n<p><p>\u5728\u5f00\u59cb\u4e4b\u524d\uff0c\u60a8\u9700\u8981\u4ee5\u4e0b\u51c6\u5907\u5de5\u4f5c\uff1a<\/p>\n<\/p>\n<ul>\n<li>\u4e24\u53f0\u670d\u52a1\u5668\uff0c\u4e00\u53f0\u4e3a\u4e3b\u670d\u52a1\u5668\uff0c\u53e6\u4e00\u53f0\u4e3a\u5907\u7528\u670d\u52a1\u5668\u3002<\/li>\n<li>\u76f8\u540c\u7684\u64cd\u4f5c\u7cfb\u7edf\u548c\u8f6f\u4ef6\u914d\u7f6e\u3002<\/li>\n<li>\u7f51\u7edc\u8fde\u63a5\uff0c\u786e\u4fdd\u4e24\u53f0\u670d\u52a1\u5668\u53ef\u4ee5\u4e92\u76f8\u901a\u4fe1\u3002<\/li>\n<\/ul>\n<p><h2>\u5b8c\u6210\u4efb\u52a1\u6240\u9700\u7684\u8be6\u7ec6\u3001\u5206\u6b65\u64cd\u4f5c\u6307\u5357<\/h2>\n<\/p>\n<p><h3>\u6b65\u9aa4 1\uff1a\u5b89\u88c5\u548c\u914d\u7f6e\u4e3b\u670d\u52a1\u5668<\/h3>\n<\/p>\n<p><p>\u5728\u4e3b\u670d\u52a1\u5668\u4e0a\uff0c\u60a8\u9700\u8981\u5b89\u88c5\u5fc5\u8981\u7684\u8f6f\u4ef6\u548c\u914d\u7f6e\u6587\u4ef6\u3002<\/p>\n<\/p>\n<p><pre><code>sudo apt update<\/p>\r\n<p>sudo apt install keepalived<\/code><\/pre>\n<\/p>\n<p><p>\u7136\u540e\uff0c\u7f16\u8f91 <code>\/etc\/keepalived\/keepalived.conf<\/code> \u6587\u4ef6\uff0c\u914d\u7f6e\u4e3b\u670d\u52a1\u5668\u548c\u5907\u7528\u670d\u52a1\u5668\u7684IP\u5730\u5740\u548c\u865a\u62dfIP\u5730\u5740\u3002<\/p>\n<\/p>\n<p><pre><code>! Configuration File for keepalived<\/p>\r\n\r\n<p>global_defs {<\/p>\r\n<p>   notification_email {<\/p>\r\n<p>     admin@example.com<\/p>\r\n<p>   }<\/p>\r\n<p>   notification_email_from admin@example.com<\/p>\r\n<p>   smtp_server smtp.example.com<\/p>\r\n<p>   smtp_connect_timeout 30<\/p>\r\n<p>}<\/p>\r\n\r\n<p>vrrp_instance VI_1 {<\/p>\r\n<p>    state MASTER<\/p>\r\n<p>    interface eth0<\/p>\r\n<p>    virtual_router_id 51<\/p>\r\n<p>    priority 100<\/p>\r\n<p>    advert_int 1<\/p>\r\n<p>    authentication {<\/p>\r\n<p>        auth_type PASS<\/p>\r\n<p>        auth_pass 1234<\/p>\r\n<p>    }<\/p>\r\n<p>    virtual_ipaddress {<\/p>\r\n<p>        192.168.1.100\/24 dev eth0 label eth0:0<\/p>\r\n<p>    }<\/p>\r\n<p>}<\/code><\/pre>\n<\/p>\n<p><h3>\u6b65\u9aa4 2\uff1a\u5b89\u88c5\u548c\u914d\u7f6e\u5907\u7528\u670d\u52a1\u5668<\/h3>\n<\/p>\n<p><p>\u5728\u5907\u7528\u670d\u52a1\u5668\u4e0a\uff0c\u5b89\u88c5\u548c\u914d\u7f6e\u8fc7\u7a0b\u4e0e\u4e3b\u670d\u52a1\u5668\u7c7b\u4f3c\uff0c\u4f46\u5c06 <code>state<\/code> \u8bbe\u7f6e\u4e3a <code>BACKUP<\/code>\u3002<\/p>\n<\/p>\n<p><pre><code>sudo apt install keepalived<\/p>\r\n\r\n<p>sudo nano \/etc\/keepalived\/keepalived.conf<\/p>\r\n\r\n<p>vrrp_instance VI_1 {<\/p>\r\n<p>    state BACKUP<\/p>\r\n<p>    interface eth0<\/p>\r\n<p>    virtual_router_id 51<\/p>\r\n<p>    priority 90<\/p>\r\n<p>    advert_int 1<\/p>\r\n<p>    authentication {<\/p>\r\n<p>        auth_type PASS<\/p>\r\n<p>        auth_pass 1234<\/p>\r\n<p>    }<\/p>\r\n<p>    virtual_ipaddress {<\/p>\r\n<p>        192.168.1.100\/24 dev eth0 label eth0:0<\/p>\r\n<p>    }<\/p>\r\n<p>}<\/code><\/pre>\n<\/p>\n<p><h3>\u6b65\u9aa4 3\uff1a\u542f\u52a8\u548c\u4f7f\u80fd\u670d\u52a1<\/h3>\n<\/p>\n<p><p>\u5728\u4e24\u53f0\u670d\u52a1\u5668\u4e0a\u542f\u52a8\u548c\u4f7f\u80fd <code>keepalived<\/code> \u670d\u52a1\u3002<\/p>\n<\/p>\n<p><pre><code>sudo systemctl start keepalived<\/p>\r\n<p>sudo systemctl enable keepalived<\/code><\/pre>\n<\/p>\n<p><h3>\u6b65\u9aa4 4\uff1a\u6d4b\u8bd5\u5bb9\u9519\u529f\u80fd<\/h3>\n<\/p>\n<p><p>\u65ad\u5f00\u4e3b\u670d\u52a1\u5668\u7684\u7f51\u7edc\u8fde\u63a5\uff0c\u89c2\u5bdf\u5907\u7528\u670d\u52a1\u5668\u662f\u5426\u63a5\u7ba1\u865a\u62dfIP\u5730\u5740\u3002<\/p>\n<\/p>\n<p><pre><code>sudo ip link set eth0 down<\/p>\r\n<p>sudo ip a show eth0<\/p>\r\n<p>sudo systemctl restart keepalived<\/code><\/pre>\n<\/p>\n<p><h2>\u6d89\u53ca\u7684\u5173\u952e\u547d\u4ee4\u3001\u4ee3\u7801\u6216\u914d\u7f6e\u793a\u4f8b<\/h2>\n<\/p>\n<p><p>\u4ee5\u4e0b\u662f\u4e00\u4e9b\u5173\u952e\u547d\u4ee4\u548c\u4ee3\u7801\u793a\u4f8b\uff1a<\/p>\n<\/p>\n<ul>\n<li><strong>\u5b89\u88c5Keepalived<\/strong>: <code>sudo apt install keepalived<\/code><\/li>\n<li><strong>\u7f16\u8f91Keepalived\u914d\u7f6e\u6587\u4ef6<\/strong>: <code>sudo nano \/etc\/keepalived\/keepalived.conf<\/code><\/li>\n<li><strong>\u542f\u52a8Keepalived\u670d\u52a1<\/strong>: <code>sudo systemctl start keepalived<\/code><\/li>\n<li><strong>\u4f7f\u80fdKeepalived\u670d\u52a1<\/strong>: <code>sudo systemctl enable keepalived<\/code><\/li>\n<\/ul>\n<p><h2>\u5bf9\u547d\u4ee4\u3001\u4ee3\u7801\u6216\u91cd\u8981\u6982\u5ff5\u7684\u6e05\u6670\u89e3\u91ca<\/h2>\n<\/p>\n<p><p><strong>Keepalived<\/strong> \u662f\u4e00\u4e2a\u9ad8\u5ea6\u53ef\u7528\u7684\u8f6f\u4ef6\u5957\u4ef6\uff0c\u7528\u4e8e\u5b9e\u73b0\u6545\u969c\u8f6c\u79fb\u548c\u9ad8\u53ef\u7528\u6027\u3002\u5728\u914d\u7f6e\u6587\u4ef6\u4e2d\uff0c<code>virtual_ipaddress<\/code> \u5b9a\u4e49\u4e86\u865a\u62dfIP\u5730\u5740\uff0c\u5f53\u4e3b\u670d\u52a1\u5668\u51fa\u73b0\u95ee\u9898\u65f6\uff0c\u5907\u7528\u670d\u52a1\u5668\u4f1a\u63a5\u7ba1\u8fd9\u4e2aIP\u5730\u5740\u3002<\/p>\n<\/p>\n<p><h2>\u64cd\u4f5c\u8fc7\u7a0b\u4e2d\u53ef\u80fd\u9047\u5230\u7684\u95ee\u9898\u3001\u6ce8\u610f\u4e8b\u9879\u6216\u76f8\u5173\u7684\u5b9e\u7528\u6280\u5de7<\/h2>\n<\/p>\n<ul>\n<li><strong>\u95ee\u9898<\/strong>: \u4e24\u53f0\u670d\u52a1\u5668\u65e0\u6cd5\u901a\u4fe1\u3002<\/p>\n<li><strong>\u89e3\u51b3\u65b9\u6cd5<\/strong>: \u786e\u4fdd\u7f51\u7edc\u914d\u7f6e\u6b63\u786e\uff0c\u5e76\u4e14\u4e24\u53f0\u670d\u52a1\u5668\u4e4b\u95f4\u53ef\u4ee5\u76f8\u4e92ping\u901a\u3002<\/li>\n<\/li>\n<li><strong>\u95ee\u9898<\/strong>: Keepalived\u670d\u52a1\u65e0\u6cd5\u542f\u52a8\u3002<\/p>\n<li><strong>\u89e3\u51b3\u65b9\u6cd5<\/strong>: \u68c0\u67e5\u914d\u7f6e\u6587\u4ef6\u662f\u5426\u6709\u8bed\u6cd5\u9519\u8bef\uff0c\u5e76\u786e\u4fdd\u6240\u6709\u670d\u52a1\u4f9d\u8d56\u9879\u90fd\u5df2\u5b89\u88c5\u3002<\/li>\n<\/ul>\n","protected":false},"excerpt":{"rendered":"<p>\u5bb9\u9519\u670d\u52a1\u5668\u662f\u4e00\u79cd\u80fd\u591f\u5728\u786c\u4ef6\u6216\u8f6f\u4ef6\u51fa\u73b0\u6545\u969c\u65f6\u81ea\u52a8\u5207\u6362\u5230\u5907\u7528\u670d\u52a1\u5668\u7684\u7cfb\u7edf\uff0c\u4ee5\u786e\u4fdd\u670d\u52a1\u7684\u8fde\u7eed\u6027\u548c\u7a33\u5b9a\u6027\u3002\u672c\u6587\u5c06\u63d0\u4f9b\u4e00\u4e2a\u5b9e\u64cd\u5bfc\u5411\u7684\u6307\u5357\uff0c\u5e2e\u52a9\u60a8\u914d\u7f6e\u4e00\u4e2a\u57fa\u672c\u7684\u5bb9\u9519\u670d\u52a1\u5668\u73af\u5883\u3002 \u64cd\u4f5c\u524d\u7684\u51c6\u5907\u6216\u80cc\u666f\u4ecb\u7ecd \u5728\u5f00\u59cb\u4e4b\u524d\uff0c\u60a8\u9700\u8981\u4ee5\u4e0b\u51c6\u5907\u5de5\u4f5c\uff1a \u4e24\u53f0\u670d\u52a1\u5668\uff0c\u4e00\u53f0&#8230;<\/p>\n","protected":false},"author":2,"featured_media":936,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[4],"tags":[155,156,9],"topic":[],"class_list":["post-935","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-tw","tag-keepalived","tag-156","tag-9"],"_links":{"self":[{"href":"https:\/\/www.chinaenow.com\/blog\/wp-json\/wp\/v2\/posts\/935","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.chinaenow.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.chinaenow.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.chinaenow.com\/blog\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.chinaenow.com\/blog\/wp-json\/wp\/v2\/comments?post=935"}],"version-history":[{"count":1,"href":"https:\/\/www.chinaenow.com\/blog\/wp-json\/wp\/v2\/posts\/935\/revisions"}],"predecessor-version":[{"id":938,"href":"https:\/\/www.chinaenow.com\/blog\/wp-json\/wp\/v2\/posts\/935\/revisions\/938"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.chinaenow.com\/blog\/wp-json\/wp\/v2\/media\/936"}],"wp:attachment":[{"href":"https:\/\/www.chinaenow.com\/blog\/wp-json\/wp\/v2\/media?parent=935"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.chinaenow.com\/blog\/wp-json\/wp\/v2\/categories?post=935"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.chinaenow.com\/blog\/wp-json\/wp\/v2\/tags?post=935"},{"taxonomy":"topic","embeddable":true,"href":"https:\/\/www.chinaenow.com\/blog\/wp-json\/wp\/v2\/topic?post=935"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}