{"id":39434,"date":"2024-11-26T17:16:23","date_gmt":"2024-11-26T09:16:23","guid":{"rendered":"https:\/\/fwq.ai\/blog\/39434\/"},"modified":"2024-11-26T17:16:23","modified_gmt":"2024-11-26T09:16:23","slug":"keepalived%e5%86%85%e5%a4%96%e7%bd%91%e6%95%85%e9%9a%9c%e9%9d%9e%e5%90%8c%e6%ad%a5%e6%bc%82%e7%a7%bb%e5%8f%8c%e6%b4%bb%e5%8f%8c%e4%b8%bb%e6%a8%a1%e5%bc%8f","status":"publish","type":"post","link":"https:\/\/fwq.ai\/blog\/39434\/","title":{"rendered":"Keepalived\u5185\u5916\u7f51\u6545\u969c\u975e\u540c\u6b65\u6f02\u79fb\u53cc\u6d3b\u53cc\u4e3b\u6a21\u5f0f"},"content":{"rendered":"<p><img decoding=\"async\" src=\"https:\/\/img.php.cn\/upload\/article\/001\/246\/273\/172951607127001.jpg\" class=\"aligncenter\" title=\"Keepalived\u5185\u5916\u7f51\u6545\u969c\u975e\u540c\u6b65\u6f02\u79fb\u53cc\u6d3b\u53cc\u4e3b\u6a21\u5f0f\u63d2\u56fe\" alt=\"Keepalived\u5185\u5916\u7f51\u6545\u969c\u975e\u540c\u6b65\u6f02\u79fb\u53cc\u6d3b\u53cc\u4e3b\u6a21\u5f0f\u63d2\u56fe\" \/><\/p>\n<p><span style=\"color:#1E1E1E;letter-spacing: 2px;border-left:#FF3030 3px solid;border-right:#FF3030 3px solid;padding-left: 8px;padding-right:8px;font-size: 12pt\"><strong>\u793a\u610f\u56fe<\/strong><\/span>   <\/p>\n<pre>\n\u591a\u64adIP\u662f\uff1a224.0.0.111\u3002\n\u4e00\u53f0\u673a\u5668\u7684VIP\u5185\u5916\u7f51\u4e92\u4e3a\u4e3b\u5907\u3002\n                        +------+\n\t\t\t|Client|\n\t\t\t+------+\n                           \/\n\t\t       +--------+   \n                       |Internet|\n\t\t       +--------+\n                           \/\n\t\t       +--------+  \n                       |NAT \u7f51\u7edc|\n\t\t       +--------+\n                           \/\n                +----------------------+\n                | \u5185\u7f51VIP1:10.16.8.100 |\n\t\t| \u5185\u7f51VIP2:10.16.8.101 |\n                +----------------------+\n                   \/                \n+-----------------------+      +-----------------------+\n|KA+Lvs-DR\/Nginx\/HAProxy|      |KA+Lvs-DR\/Nginx\/HAProxy|\n|\u5185\u7f51VIP1:Master (eth1) |      |\u5185\u7f51VIP1:BACKUP (eth1) |\n|\u5185\u7f51VIP2:BACKUP (eth1) |      |\u5185\u7f51VIP2:Master (eth1) |\n|\u5185\u7f51:10.16.8.10 (eth1) |&lt; ----&gt;|\u5185\u7f51:10.16.8.11 (eth1) |\n|-----------------------|\u591a\u64adIP|-----------------------|\n|\u516c\u7f51VIP1:Master (eth2) |&lt; ----&gt;|\u516c\u7f51VIP1:BACKUP (eth2) |\n|\u516c\u7f51VIP2:BACKUP (eth2) |      |\u516c\u7f51VIP2:Master (eth2) |\n|\u516c\u7f51:172.16.8.10(eth2) |      |\u516c\u7f51:172.16.8.11(eth2) |                 \n+-----------------------+      +-----------------------+\n                                   \/\n\t        +-----------------------+\t \n                | \u516c\u7f51VIP1:172.16.8.100 |\n\t\t| \u516c\u7f51VIP2:172.16.8.101 |\n\t        +-----------------------+\n\t\t           \/\n\t\t\t+------+\n\t\t\t|\u8d44\u6e90\u6c60|\n\t\t\t+------+\n<\/pre>\n<p>  \u767b\u5f55\u540e\u590d\u5236<br \/>\n<span style=\"color:#1E1E1E;letter-spacing: 2px;border-left:#FF3030 3px solid;border-right:#FF3030 3px solid;padding-left: 8px;padding-right:8px;font-size: 12pt\"><strong>ka67\u914d\u7f6e\u6587\u4ef6<\/strong><\/span>   <\/p>\n<pre>\nglobal_defs {\n   notification_email {\n     root@localhost\n   }\n   notification_email_from ka@localhost\n   smtp_server 127.0.0.1\n   smtp_connect_timeout 30\n   router_id ka67\n   vrrp_mcast_group4 224.0.0.111\n}\nvrrp_instance External_1 {\n    state MASTER\n    interface eth1\n    virtual_router_id 171\n    priority 100\n    advert_int 1    \n    authentication {\n        auth_type PASS\n        auth_pass renwole0\n    }\n    virtual_ipaddress {\n        10.16.8.100\n    }\n    notify_master \"\/usr\/local\/keepalived\/etc\/keepalived\/notify.sh master\"\n    notify_backup \"\/usr\/local\/keepalived\/etc\/keepalived\/notify.sh backup\"\n    notify_fault \"\/usr\/local\/keepalived\/etc\/keepalived\/notify.sh fault\"\n}\nvrrp_instance External_2 {\n    state BACKUP\n    interface eth1\n    virtual_router_id 172\n    priority 95\n    advert_int 1\n    authentication {\n        auth_type PASS\n        auth_pass renwole1\n    }\n    virtual_ipaddress {\n        10.16.8.101\n    }\n    notify_master \"\/usr\/local\/keepalived\/etc\/keepalived\/notify.sh master\"\n    notify_backup \"\/usr\/local\/keepalived\/etc\/keepalived\/notify.sh backup\"\n    notify_fault \"\/usr\/local\/keepalived\/etc\/keepalived\/notify.sh fault\"\n}\nvrrp_instance Internal_1 {\n    state MASTER\n    interface eth2\n    virtual_router_id 191\n    priority 100\n    advert_int 1\n    authentication {\n        auth_type PASS\n        auth_pass renwole2\n    }\n    virtual_ipaddress {\n        172.16.8.100\n    }\n    notify_master \"\/usr\/local\/keepalived\/etc\/keepalived\/notify.sh master\"\n    notify_backup \"\/usr\/local\/keepalived\/etc\/keepalived\/notify.sh backup\"\n    notify_fault \"\/usr\/local\/keepalived\/etc\/keepalived\/notify.sh fault\"\n}\nvrrp_instance Internal_2 {\n    state BACKUP\n    interface eth2\n    virtual_router_id 192\n    priority 95\n    advert_int 1\n    authentication {\n        auth_type PASS\n        auth_pass renwole3\n    }\n    virtual_ipaddress {\n        172.16.8.101\n    }\n    notify_master \"\/usr\/local\/keepalived\/etc\/keepalived\/notify.sh master\"\n    notify_backup \"\/usr\/local\/keepalived\/etc\/keepalived\/notify.sh backup\"\n    notify_fault \"\/usr\/local\/keepalived\/etc\/keepalived\/notify.sh fault\"\n}\n<\/pre>\n<p>  \u767b\u5f55\u540e\u590d\u5236<br \/>\n<span style=\"color:#1E1E1E;letter-spacing: 2px;border-left:#FF3030 3px solid;border-right:#FF3030 3px solid;padding-left: 8px;padding-right:8px;font-size: 12pt\"><strong>ka68\u914d\u7f6e\u6587\u4ef6<\/strong><\/span>   <\/p>\n<pre>\nglobal_defs {\n   notification_email {\n     root@localhost\n   }\n   notification_email_from ka@localhost\n   smtp_server 127.0.0.1\n   smtp_connect_timeout 30\n   router_id ka68\n   vrrp_mcast_group4 224.0.0.111\n}\nvrrp_instance External_1 {\n    state BACKUP\n    interface eth1\n    virtual_router_id 171\n    priority 100\n    advert_int 1    \n    authentication {\n        auth_type PASS\n        auth_pass renwole0\n    }\n    virtual_ipaddress {\n        10.16.8.100\n    }\n    notify_master \"\/usr\/local\/keepalived\/etc\/keepalived\/notify.sh master\"\n    notify_backup \"\/usr\/local\/keepalived\/etc\/keepalived\/notify.sh backup\"\n    notify_fault \"\/usr\/local\/keepalived\/etc\/keepalived\/notify.sh fault\"\n}\nvrrp_instance External_2 {\n    state MASTER\n    interface eth1\n    virtual_router_id 172\n    priority 95\n    advert_int 1\n    authentication {\n        auth_type PASS\n        auth_pass renwole1\n    }\n    virtual_ipaddress {\n        10.16.8.101\n    }\n    notify_master \"\/usr\/local\/keepalived\/etc\/keepalived\/notify.sh master\"\n    notify_backup \"\/usr\/local\/keepalived\/etc\/keepalived\/notify.sh backup\"\n    notify_fault \"\/usr\/local\/keepalived\/etc\/keepalived\/notify.sh fault\"\n}\nvrrp_instance Internal_1 {\n    state BACKUP\n    interface eth2\n    virtual_router_id 191\n    priority 100\n    advert_int 1\n    authentication {\n        auth_type PASS\n        auth_pass renwole2\n    }\n    virtual_ipaddress {\n        172.16.8.100\n    }\n    notify_master \"\/usr\/local\/keepalived\/etc\/keepalived\/notify.sh master\"\n    notify_backup \"\/usr\/local\/keepalived\/etc\/keepalived\/notify.sh backup\"\n    notify_fault \"\/usr\/local\/keepalived\/etc\/keepalived\/notify.sh fault\"\n}\nvrrp_instance Internal_2 {\n    state MASTER\n    interface eth2\n    virtual_router_id 192\n    priority 95\n    advert_int 1\n    authentication {\n        auth_type PASS\n        auth_pass renwole3\n    }\n    virtual_ipaddress {\n        172.16.8.101\n    }\n    notify_master \"\/usr\/local\/keepalived\/etc\/keepalived\/notify.sh master\"\n    notify_backup \"\/usr\/local\/keepalived\/etc\/keepalived\/notify.sh backup\"\n    notify_fault \"\/usr\/local\/keepalived\/etc\/keepalived\/notify.sh fault\"\n}\n<\/pre>\n<p>  \u767b\u5f55\u540e\u590d\u5236   <\/p>\n<p>\u4ee5\u4e0a\u5c31\u662fKeepalived\u5185\u5916\u7f51\u6545\u969c\u975e\u540c\u6b65\u6f02\u79fb\u53cc\u6d3b\u53cc\u4e3b\u6a21\u5f0f\u7684\u8be6\u7ec6\u5185\u5bb9\uff0c\u66f4\u591a\u8bf7\u5173\u6ce8\u7c73\u4e91\u5176\u5b83\u76f8\u5173\u6587\u7ae0\uff01<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u793a\u610f\u56fe \u591a\u64adIP\u662f\uff1a224.0.0.111\u3002 \u4e00\u53f0\u673a\u5668\u7684VIP\u5185\u5916\u7f51\u4e92\u4e3a\u4e3b\u5907\u3002 +&#8212;&#8212;+ |Client| +&#8212;&#8212;+ \/ +&#8212;&#8212;&#8211;+ |Internet| +&#8212;&#8212;&#8211;+ \/ +&#8212;&#8212;&#8211;+ |NAT \u7f51\u7edc| +&#8212;&#8212;&#8211;+ \/ +&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-+ | \u5185\u7f51VIP1:10.16.8.100 | | \u5185\u7f51VIP2:10.16.8.101 | +&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-+ \/ +&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;+ +&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;+ |KA+Lvs-DR\/Nginx\/HAProxy| |KA+Lvs-DR\/Nginx\/HAProxy| |\u5185\u7f51VIP1:Master (eth1) | |\u5185\u7f51VIP1:BACKUP (eth1) | |\u5185\u7f51VIP2:BACKUP (eth1) | |\u5185\u7f51VIP2:Master (eth1) | |\u5185\u7f51:10.16.8.10 (eth1) |&lt; &#8212;-&gt;|\u5185\u7f51:10.16.8.11 (eth1) | |&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;|\u591a\u64adIP|&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;| |\u516c\u7f51VIP1:Master (eth2) |&lt; &#8212;-&gt;|\u516c\u7f51VIP1:BACKUP (eth2) | |\u516c\u7f51VIP2:BACKUP [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[8],"tags":[],"class_list":["post-39434","post","type-post","status-publish","format-standard","hentry","category-os"],"_links":{"self":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/39434","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/comments?post=39434"}],"version-history":[{"count":0,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/39434\/revisions"}],"wp:attachment":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/media?parent=39434"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/categories?post=39434"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/tags?post=39434"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}