{"id":28518,"date":"2022-12-02T05:53:15","date_gmt":"2022-12-01T21:53:15","guid":{"rendered":"http:\/\/lrxjmw.cn\/?p=28518"},"modified":"2022-12-02T05:53:37","modified_gmt":"2022-12-01T21:53:37","slug":"docker-1120-balancing","status":"publish","type":"post","link":"https:\/\/lrxjmw.cn\/docker-1120-balancing.html","title":{"rendered":"Docker 1.12.0\u6765\u4e86\uff0c \u66f4\u4f18\u7684\u8d1f\u8f7d\u5747\u8861\u7279\u6027"},"content":{"rendered":"
\u5bfc\u8bfb<\/td>\n | \u5728\u6700\u65b0\u53d1\u5e03\u7684 1.12.0 \u7248\u672c\u4e2d\uff0c\u5f53\u5728\u96c6\u7fa4\u4e2d\u542f\u52a8\u670d\u52a1\u65f6\uff0cDocker \u901a\u8fc7 DNS \u548c IP \u865a\u62df\u670d\u52a1\u5668\uff08IPVS\uff09\u4e3a\u670d\u52a1\u7684\u8d1f\u8f7d\u5747\u8861\u5f15\u5165\u4e86\u65b0\u7684\u53c2\u6570\uff0c\u65b0\u7248 Docker \u5f15\u5165\u4e86\u5185\u7f6e\u7684 DNS \u670d\u52a1\u5668\uff0c\u5f53\u542f\u52a8\u4e00\u4e2a\u5bb9\u5668\u65f6\uff0c\u53ef\u4ee5\u901a\u8fc7\u4f7f\u7528 --net-alias \u53c2\u6570\u6765\u4e3a\u5bb9\u5668\u7684 IP \u5730\u5740\u6620\u5c04\u522b\u540d\uff0c\u8fd9\u4e2a\u7279\u6027\u4ece 1.10 \u540e\u5c31\u53ef\u4f7f\u7528\u3002\u4ece 1.11 \u7248\u672c\u4e4b\u540e\uff0cDocker \u4e5f\u652f\u6301\u4e86\u57fa\u4e8e\u5faa\u73af DNS \u7684\u8d1f\u8f7d\u5747\u8861\u3002<\/strong><\/td>\n<\/tr>\n<\/table>\n <\/p>\n \u5728\u57fa\u4e8e DNS \u7684\u8d1f\u8f7d\u5747\u8861\u4e2d\uff0c\u4e00\u4e2a\u670d\u52a1\u7684\u540d\u79f0\uff08\u522b\u540d\uff09\u4f1a\u88ab\u6620\u5c04\u5230\u591a\u4e2a IP \u5730\u5740\uff0c\u5728\u8fd9\u79cd\u60c5\u51b5\u4e0b\uff0c\u670d\u52a1\u5176\u5b9e\u662f\u8fd0\u884c\u5728\u5bb9\u5668\u7684 IP \u5730\u5740\u80cc\u540e\u7684\u3002\u5f53\u8fdb\u884c DNS \u67e5\u8be2\u65f6\uff0cDNS \u670d\u52a1\u5668\u5c06\u4f1a\u54cd\u5e94\u591a\u4e2a IP \u5730\u5740\uff0c\u540c\u65f6\u5b83\u4e5f\u4f1a\u6253\u4e71\u8fd4\u56de\u7684 IP \u5730\u5740\u7684\u987a\u5e8f\uff0c\u8fd9\u4f7f\u5f97\u4ece\u4e0d\u540c\u5ba2\u6237\u7aef\u53d1\u9001\u7684\u8bf7\u6c42\u5c06\u4f1a\u547d\u4e2d\u4e0d\u540c\u7684 IP\uff0c\u4f46\u5fc5\u987b\u901a\u8fc7\u624b\u52a8\u6620\u5c04\u4e00\u4e2a\u522b\u540d\u5230\u591a\u4e2a\u5bb9\u5668\u7684 IP \u5730\u5740\u624d\u80fd\u5b9e\u73b0\u5faa\u73af\u8d1f\u8f7d\u5747\u8861\u3002<\/p>\n \u5728 1.12.0 \u7248\u672c\u4e2d\uff0cDocker\u6dfb\u52a0\u4e86\u5185\u7f6e\u7684\u5bf9\u4e8e\u670d\u52a1\u7684\u8d1f\u8f7d\u5747\u8861\u7684\u652f\u6301\uff0c\u539f\u7406\u662f\u4f7f\u7528\u4e86\u79f0\u4e3a IPVS \u7684 Linux \u7279\u6027\uff0c\u4f7f\u7528 Docker \u7684\u96c6\u7fa4\u5f15\u64ce\uff0c\u4e00\u4e2a\u670d\u52a1\u53ef\u4ee5\u901a\u8fc7\u547d\u4ee4\u884c\u548c\u5fc5\u987b\u7684\u6570\u4e2a\u590d\u5236\u54c1\uff08\u5bb9\u5668\uff09\u6765\u58f0\u660e\uff0c\u518d\u4e5f\u4e0d\u7528\u4e3a\u670d\u52a1\u624b\u52a8\u5730\u6307\u5b9a\u522b\u540d\u3002\u5728\u5185\u90e8\uff0c\u8be5\u670d\u52a1\u7684 DNS \u540d\u79f0\u88ab\u6620\u5c04\u5230\u4e86\u4e00\u4e2a\u865a\u62df IP\uff08VIP\uff09\uff0c\u5728\u8fd9\u91cc\u8fd9\u4e2a\u7279\u6027\u4e0e IPVS \u8054\u7cfb\u4e86\u8d77\u6765\uff0c\u5f53\u8fdb\u884c DNS \u67e5\u627e\u65f6\uff0cVIP \u5c06\u88ab\u8fd4\u56de\u3002 IPVS \u662f\u4e00\u4e2a Linux \u5185\u6838\u7279\u6027\uff0c\u5b83\u53ef\u4ee5\u4f7f\u5f97\u7b2c\u56db\u5c42\uff08\u4f20\u8f93\u5c42\uff09TCP\/UDP \u6d41\u91cf\u88ab\u8f6c\u53d1\u5230\u540e\u7aef\u670d\u52a1\u5668,\u5b83\u662f\u57fa\u4e8e\u7f51\u7edc\u8fc7\u6ee4\u6a21\u5757\u7684\uff0c\u5176\u5f62\u6210\u4e86\u5728 Linux \u5185\u6838\u4e2d\u7684\u5305\u8fc7\u6ee4\u548c\u7f51\u7edc\u5730\u5740\u8f6c\u6362\u5b9e\u73b0\u7684\u57fa\u7840\u3002\u5f53\u4e00\u4e2a\u670d\u52a1\u8bf7\u6c42\u5230\u8fbe\u4e86 VIP\uff0c\u5b83\u4f1a\u88ab\u8f6c\u53d1\u5230\u4e00\u4e2a\u6258\u7ba1\u670d\u52a1\u7684\u540e\u7aef\u5bb9\u5668\u4e2d,\u901a\u8fc7\u8fd9\u6837\u7684\u65b9\u5f0f\uff0c\u6d41\u91cf\u4f1a\u88ab\u5747\u5300\u5730\u5206\u53d1\u5230\u5bb9\u5668\u4e4b\u4e2d,\u8fd9\u79cd\u8d1f\u8f7d\u5747\u8861\u670d\u52a1\u7684\u65b9\u5f0f\u548c Consul \u975e\u5e38\u76f8\u4f3c\uff0c\u5b83\u662f\u670d\u52a1\u53d1\u73b0\u8f6f\u4ef6\u3002Consul \u4e5f\u63d0\u4f9b\u4e00\u4e2a DNS \u670d\u52a1\u5668\uff0c\u5b83\u53ef\u4ee5\u5728\u6bcf\u6b21\u67e5\u8be2\u5b8c\u6210\u65f6\u8fd4\u56de\u591a\u4e2a IP \u5730\u5740\u3002<\/p>\n \n |