{"id":107774,"date":"2024-10-19T11:19:10","date_gmt":"2024-10-19T03:19:10","guid":{"rendered":"https:\/\/lrxjmw.cn\/?p=107774"},"modified":"2024-10-19T11:19:10","modified_gmt":"2024-10-19T03:19:10","slug":"keepalived-fault-drift","status":"publish","type":"post","link":"https:\/\/lrxjmw.cn\/keepalived-fault-drift.html","title":{"rendered":"Keepalived\u5185\u5916\u7f51\u6545\u969c\u975e\u540c\u6b65\u6f02\u79fb\u53cc\u6d3b\u53cc\u4e3b\u6a21\u5f0f"},"content":{"rendered":"\n\n\n
\u5bfc\u8bfb<\/td>\n\u5728\u751f\u4ea7\u73af\u5883\u4e2d\uff0c\u516c\u7f51\u4e0e\u5185\u7f51\u90fd\u662f\u72ec\u7acb\u5206\u5f00\u7684\uff0c\u6240\u4ee5\u79f0\u4e4b\u4e3a\u53cc\u7f51\u7edc\u3002\u4e0b\u9762\u914d\u7f6e\u5c06\u8981\u5b9e\u73b0\u5185\u7f51\u548c\u516c\u7f51\u6545\u969c\u65f6\u4e0d\u5fc5\u540c\u6b65\u6f02\u79fb\uff0c\u4f8b\u5982\uff1aKeepalived+LVS-DR\u3001Keepalived+Nginx\u3001Keepalived+HAProxy \u8fd9\u4e9b\u90fd\u65e0\u9700\u540c\u6b65\u6f02\u79fb\u7684\u3002\u53e6\u5916Keepalived+LVS-NAT\u5219\u9700\u8981\u540c\u6b65\u6f02\u79fb\u3002<\/strong><\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n
\u793a\u610f\u56fe<\/strong><\/span><\/div>\n
\r\n\u591a\u64adIP\u662f\uff1a224.0.0.111\u3002\r\n\u4e00\u53f0\u673a\u5668\u7684VIP\u5185\u5916\u7f51\u4e92\u4e3a\u4e3b\u5907\u3002\r\n                        +------+\r\n\t\t\t|Client|\r\n\t\t\t+------+\r\n                           \/\\\r\n\t\t       +--------+   \r\n                       |Internet|\r\n\t\t       +--------+\r\n                           \/\\\r\n\t\t       +--------+  \r\n                       |NAT \u7f51\u7edc|\r\n\t\t       +--------+\r\n                           \/\\\r\n                +----------------------+\r\n                | \u5185\u7f51VIP1:10.16.8.100 |\r\n\t\t| \u5185\u7f51VIP2:10.16.8.101 |\r\n                +----------------------+\r\n                   \/                \\\r\n+-----------------------+      +-----------------------+\r\n|KA+Lvs-DR\/Nginx\/HAProxy|      |KA+Lvs-DR\/Nginx\/HAProxy|\r\n|\u5185\u7f51VIP1:Master (eth1) |      |\u5185\u7f51VIP1:BACKUP (eth1) |\r\n|\u5185\u7f51VIP2:BACKUP (eth1) |      |\u5185\u7f51VIP2:Master (eth1) |\r\n|\u5185\u7f51:10.16.8.10 (eth1) |< ---->|\u5185\u7f51:10.16.8.11 (eth1) |\r\n|-----------------------|\u591a\u64adIP|-----------------------|\r\n|\u516c\u7f51VIP1:Master (eth2) |< ---->|\u516c\u7f51VIP1:BACKUP (eth2) |\r\n|\u516c\u7f51VIP2:BACKUP (eth2) |      |\u516c\u7f51VIP2:Master (eth2) |\r\n|\u516c\u7f51:172.16.8.10(eth2) |      |\u516c\u7f51:172.16.8.11(eth2) |                 \r\n+-----------------------+      +-----------------------+\r\n                   \\                \/\r\n\t        +-----------------------+\t \r\n                | \u516c\u7f51VIP1:172.16.8.100 |\r\n\t\t| \u516c\u7f51VIP2:172.16.8.101 |\r\n\t        +-----------------------+\r\n\t\t           \\\/\r\n\t\t\t+------+\r\n\t\t\t|\u8d44\u6e90\u6c60|\r\n\t\t\t+------+\r\n<\/pre>\n
ka67\u914d\u7f6e\u6587\u4ef6<\/strong><\/span><\/div>\n
\r\nglobal_defs {\r\n   notification_email {\r\n     root@localhost\r\n   }\r\n   notification_email_from ka@localhost\r\n   smtp_server 127.0.0.1\r\n   smtp_connect_timeout 30\r\n   router_id ka67\r\n   vrrp_mcast_group4 224.0.0.111\r\n}\r\nvrrp_instance External_1 {\r\n    state MASTER\r\n    interface eth1\r\n    virtual_router_id 171\r\n    priority 100\r\n    advert_int 1    \r\n    authentication {\r\n        auth_type PASS\r\n        auth_pass renwole0\r\n    }\r\n    virtual_ipaddress {\r\n        10.16.8.100\r\n    }\r\n    notify_master \"\/usr\/local\/keepalived\/etc\/keepalived\/notify.sh master\"\r\n    notify_backup \"\/usr\/local\/keepalived\/etc\/keepalived\/notify.sh backup\"\r\n    notify_fault \"\/usr\/local\/keepalived\/etc\/keepalived\/notify.sh fault\"\r\n}\r\nvrrp_instance External_2 {\r\n    state BACKUP\r\n    interface eth1\r\n    virtual_router_id 172\r\n    priority 95\r\n    advert_int 1\r\n    authentication {\r\n        auth_type PASS\r\n        auth_pass renwole1\r\n    }\r\n    virtual_ipaddress {\r\n        10.16.8.101\r\n    }\r\n    notify_master \"\/usr\/local\/keepalived\/etc\/keepalived\/notify.sh master\"\r\n    notify_backup \"\/usr\/local\/keepalived\/etc\/keepalived\/notify.sh backup\"\r\n    notify_fault \"\/usr\/local\/keepalived\/etc\/keepalived\/notify.sh fault\"\r\n}\r\nvrrp_instance Internal_1 {\r\n    state MASTER\r\n    interface eth2\r\n    virtual_router_id 191\r\n    priority 100\r\n    advert_int 1\r\n    authentication {\r\n        auth_type PASS\r\n        auth_pass renwole2\r\n    }\r\n    virtual_ipaddress {\r\n        172.16.8.100\r\n    }\r\n    notify_master \"\/usr\/local\/keepalived\/etc\/keepalived\/notify.sh master\"\r\n    notify_backup \"\/usr\/local\/keepalived\/etc\/keepalived\/notify.sh backup\"\r\n    notify_fault \"\/usr\/local\/keepalived\/etc\/keepalived\/notify.sh fault\"\r\n}\r\nvrrp_instance Internal_2 {\r\n    state BACKUP\r\n    interface eth2\r\n    virtual_router_id 192\r\n    priority 95\r\n    advert_int 1\r\n    authentication {\r\n        auth_type PASS\r\n        auth_pass renwole3\r\n    }\r\n    virtual_ipaddress {\r\n        172.16.8.101\r\n    }\r\n    notify_master \"\/usr\/local\/keepalived\/etc\/keepalived\/notify.sh master\"\r\n    notify_backup \"\/usr\/local\/keepalived\/etc\/keepalived\/notify.sh backup\"\r\n    notify_fault \"\/usr\/local\/keepalived\/etc\/keepalived\/notify.sh fault\"\r\n}\r\n<\/pre>\n
ka68\u914d\u7f6e\u6587\u4ef6<\/strong><\/span><\/div>\n
\r\nglobal_defs {\r\n   notification_email {\r\n     root@localhost\r\n   }\r\n   notification_email_from ka@localhost\r\n   smtp_server 127.0.0.1\r\n   smtp_connect_timeout 30\r\n   router_id ka68\r\n   vrrp_mcast_group4 224.0.0.111\r\n}\r\nvrrp_instance External_1 {\r\n    state BACKUP\r\n    interface eth1\r\n    virtual_router_id 171\r\n    priority 100\r\n    advert_int 1    \r\n    authentication {\r\n        auth_type PASS\r\n        auth_pass renwole0\r\n    }\r\n    virtual_ipaddress {\r\n        10.16.8.100\r\n    }\r\n    notify_master \"\/usr\/local\/keepalived\/etc\/keepalived\/notify.sh master\"\r\n    notify_backup \"\/usr\/local\/keepalived\/etc\/keepalived\/notify.sh backup\"\r\n    notify_fault \"\/usr\/local\/keepalived\/etc\/keepalived\/notify.sh fault\"\r\n}\r\nvrrp_instance External_2 {\r\n    state MASTER\r\n    interface eth1\r\n    virtual_router_id 172\r\n    priority 95\r\n    advert_int 1\r\n    authentication {\r\n        auth_type PASS\r\n        auth_pass renwole1\r\n    }\r\n    virtual_ipaddress {\r\n        10.16.8.101\r\n    }\r\n    notify_master \"\/usr\/local\/keepalived\/etc\/keepalived\/notify.sh master\"\r\n    notify_backup \"\/usr\/local\/keepalived\/etc\/keepalived\/notify.sh backup\"\r\n    notify_fault \"\/usr\/local\/keepalived\/etc\/keepalived\/notify.sh fault\"\r\n}\r\nvrrp_instance Internal_1 {\r\n    state BACKUP\r\n    interface eth2\r\n    virtual_router_id 191\r\n    priority 100\r\n    advert_int 1\r\n    authentication {\r\n        auth_type PASS\r\n        auth_pass renwole2\r\n    }\r\n    virtual_ipaddress {\r\n        172.16.8.100\r\n    }\r\n    notify_master \"\/usr\/local\/keepalived\/etc\/keepalived\/notify.sh master\"\r\n    notify_backup \"\/usr\/local\/keepalived\/etc\/keepalived\/notify.sh backup\"\r\n    notify_fault \"\/usr\/local\/keepalived\/etc\/keepalived\/notify.sh fault\"\r\n}\r\nvrrp_instance Internal_2 {\r\n    state MASTER\r\n    interface eth2\r\n    virtual_router_id 192\r\n    priority 95\r\n    advert_int 1\r\n    authentication {\r\n        auth_type PASS\r\n        auth_pass renwole3\r\n    }\r\n    virtual_ipaddress {\r\n        172.16.8.101\r\n    }\r\n    notify_master \"\/usr\/local\/keepalived\/etc\/keepalived\/notify.sh master\"\r\n    notify_backup \"\/usr\/local\/keepalived\/etc\/keepalived\/notify.sh backup\"\r\n    notify_fault \"\/usr\/local\/keepalived\/etc\/keepalived\/notify.sh fault\"\r\n}\r\n<\/pre>\n
\n

\u539f\u6587\u6765\u81ea\uff1ahttps:\/\/renwole.com\/archives\/1103<\/a><\/p>\n

\u672c\u6587\u5730\u5740\uff1ahttps:\/\/lrxjmw.cn\/keepalived-fault-drift.html<\/a>\u7f16\u8f91\uff1a\u4f55\u4e91\u8273\uff0c\u5ba1\u6838\u5458\uff1a\u9004\u589e\u5b9d<\/span><\/p>\n<\/blockquote>\n","protected":false},"excerpt":{"rendered":"

\u5bfc\u8bfb \u5728\u751f\u4ea7\u73af\u5883\u4e2d\uff0c\u516c\u7f51\u4e0e\u5185\u7f51\u90fd\u662f\u72ec\u7acb\u5206\u5f00\u7684\uff0c\u6240\u4ee5\u79f0\u4e4b\u4e3a\u53cc\u7f51\u7edc\u3002\u4e0b\u9762\u914d\u7f6e\u5c06\u8981\u5b9e\u73b0\u5185\u7f51\u548c\u516c\u7f51\u6545\u969c\u65f6\u4e0d\u5fc5\u540c\u6b65\u6f02\u79fb\uff0c […]<\/p>\n","protected":false},"author":1479,"featured_media":76890,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[55],"tags":[],"class_list":["post-107774","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-thread"],"acf":[],"_links":{"self":[{"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/posts\/107774","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/users\/1479"}],"replies":[{"embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/comments?post=107774"}],"version-history":[{"count":5,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/posts\/107774\/revisions"}],"predecessor-version":[{"id":293721,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/posts\/107774\/revisions\/293721"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/media\/76890"}],"wp:attachment":[{"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/media?parent=107774"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/categories?post=107774"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/tags?post=107774"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}