{"id":640,"date":"2023-03-23T21:42:05","date_gmt":"2023-03-23T13:42:05","guid":{"rendered":""},"modified":"2023-03-23T21:42:05","modified_gmt":"2023-03-23T13:42:05","slug":"SpringCloud Eureka","status":"publish","type":"post","link":"https:\/\/bianchenghao6.com\/640.html","title":{"rendered":"SpringCloud Eureka"},"content":{"rendered":"


\n <\/head>
\n <\/p>\n

\n

SpringCloud Eureka<\/h1>\n<\/p><\/div>\n
\n \u5728\u4e0a\u4e00\u8282\u4e2d\uff0c\u6211\u4eec\u5df2\u7ecf\u914d\u7f6e\u4e86
\n Ribbon <\/strong>\uff0c\u5e76\u5728\u8fd9\u4e24\u4e2a\u670d\u52a1\u4e4b\u95f4\u5206\u914d\u4e86\u8d1f\u8f7d\u3002\u5728\u672c\u90e8\u5206\u4e2d\uff0c\u6211\u4eec\u5c06\u8bbe\u7f6e
\n Eureka <\/strong>naming server\u3002\n <\/div>\n

naming server<\/h2>\n
\n naming server<\/strong>\u662f\u4e00\u79cd\u8ba1\u7b97\u673a\u5e94\u7528\u7a0b\u5e8f\uff0c\u5b83\u5b9e\u73b0\u4e86\u7528\u4e8e\u54cd\u5e94\u76ee\u5f55\u670d\u52a1\u67e5\u8be2\u7684\u7f51\u7edc\u670d\u52a1\u3002\n <\/div>\n

Eureka\u670d\u52a1\u5668<\/h2>\n
\n Eureka\u670d\u52a1\u5668<\/strong>\u662f\u57fa\u4e8eREST\u7684\u670d\u52a1\u5668\uff0c\u5728
\n AWS Cloud <\/strong>\u670d\u52a1\u4e2d\u7528\u4e8e\u8d1f\u8f7d\u5747\u8861\u548c\u4e2d\u95f4\u5c42\u670d\u52a1\u7684\u6545\u969c\u8f6c\u79fb\u3002\n <\/div>\n
\n Eureka\u670d\u52a1\u5668\u662f\u4e00\u79cd\u5305\u542b\u4ee5\u4e0b\u4fe1\u606f\u7684\u5e94\u7528\u7a0b\u5e8f: \u6240\u6709\u5ba2\u6237\u7aef\u670d\u52a1\u5e94\u7528\u7a0b\u5e8f\u3002\u6bcf\u4e2a\u5fae\u670d\u52a1\u90fd\u4f1a\u5411Eureka\u670d\u52a1\u5668\u6ce8\u518c\u3002\u670d\u52a1\u5668\u4f7f\u7528\u5176
\n \u7aef\u53e3\u53f7<\/strong>\u548c
\n IP\u5730\u5740<\/strong>\u6ce8\u518c\u5ba2\u6237\u7aef\u670d\u52a1\u3002\u5b83\u4e5f\u79f0\u4e3a
\n Discovery Server <\/strong>\u3002Eureka\u670d\u52a1\u5668\u968f\u9644\u4e8eSpring Cloud\u6346\u7ed1\u5305\u3002\u5b83\u5728\u9ed8\u8ba4\u7aef\u53e3
\n 8761 <\/strong>\u4e0a\u8fd0\u884c\u3002\u5b83\u8fd8\u5e26\u6709\u4e00\u4e2a\u57fa\u4e8eJava\u7684\u5ba2\u6237\u7aef\u7ec4\u4ef6eureka\u5ba2\u6237\u7aef\uff0c\u5b83\u4f7f\u4e0e\u670d\u52a1\u7684\u4ea4\u4e92\u53d8\u5f97\u66f4\u52a0\u5bb9\u6613\u3002\n <\/div>\n

\u670d\u52a1\u5668\u7684\u9700\u6c42<\/h2>\n
\n \u53e6\u4e00\u4e2a\u8d1f\u8f7d\u5e73\u8861\u5668\u5e94\u7528\u7a0b\u5e8f\uff0c\u79f0\u4e3a
\n AWS Cloud <\/strong>\u3002\u7531\u4e8e\u5176\u56fa\u6709\u7684\u6027\u8d28\uff0c\u670d\u52a1\u5668\u4f1a\u4e0a\u4e0b\u6ce2\u52a8\u3002\u6ca1\u6709\u4e2d\u95f4\u5c42\u8d1f\u8f7d\u5747\u8861\u5668\u3002 Eureka\u670d\u52a1\u5668\u586b\u8865\u4e86
\n \u5ba2\u6237\u7aef<\/strong>\u548c
\n \u4e2d\u95f4\u5c42\u8d1f\u8f7d\u5747\u8861\u5668\u4e4b\u95f4\u7684\u7a7a\u767d\u3002<\/strong>\n <\/div>\n
\n \u5047\u8bbe\u6211\u4eec\u8981\u542f\u52a8\u53e6\u4e00\u4e2a\u8d27\u5e01\u5151\u6362\u5b9e\u4f8b\uff0c
\n CurrencyExchangeService3 <\/strong>\u670d\u52a1\u5e76\u5728\u7aef\u53e38002\u4e0a\u542f\u52a8\u5b83\u3002\u5728\u8fd9\u91cc\u51fa\u73b0\u4e00\u4e2a\u95ee\u9898\uff0c
\n \u529f\u80fd\u533a\u5c06\u80fd\u591f\u5c06\u8d1f\u8f7d\u5206\u914d\u7ed9\u5b83\u5417\uff1f<\/strong>\n <\/div>\n
\n \u5982\u679c\u529f\u80fd\u533a\u5e0c\u671b\u5c06\u8d1f\u8f7d\u5206\u914d\u7ed9\u65b0\u670d\u52a1\u5668\uff0c\u6211\u4eec\u9700\u8981\u5c06\u5176\u6dfb\u52a0\u5230\u914d\u7f6e\u4e2d\u3002\u6839\u636e\u8d1f\u8f7d\uff0c\u6211\u4eec\u53ef\u4ee5\u589e\u52a0\u6216\u51cf\u5c11\u670d\u52a1\u5b9e\u4f8b\u7684\u6570\u91cf\u3002\n <\/div>\n
\n \u5728\u672c\u8282\u4e2d\uff0c\u6211\u4eec\u5c06\u80fd\u591f\u52a8\u6001\u589e\u52a0\u6216\u51cf\u5c11\u5b9e\u4f8b\u7684\u6570\u91cf\u3002\n <\/div>\n
\n \u5982\u679c\u6211\u4eec\u6839\u636e\u5f53\u524d\u542f\u7528\u7684CurrenyExchangeService\u7684\u6570\u91cf\u7ee7\u7eed\u66f4\u6539CurrencyCalulationService\uff0c\u90a3\u4e48\u7ef4\u62a4\u8d77\u6765\u5c06\u53d8\u5f97\u975e\u5e38\u56f0\u96be\u3002\n <\/div>\n
\n \u5f53\u6211\u4eec\u60f3\u7b80\u5316\u7ef4\u62a4\u65f6\uff0cEureka\u670d\u52a1\u5668\u5e94\u8fd0\u800c\u751f\u3002\u6240\u6709\u5fae\u670d\u52a1\u7684\u6240\u6709\u5b9e\u4f8b\u90fd\u5c06\u5728
\n Eureka <\/strong>\u670d\u52a1\u5668\u4e2d\u6ce8\u518c\u3002\u6bcf\u5f53\u51fa\u73b0\u65b0\u7684\u5fae\u670d\u52a1\u5b9e\u4f8b\u65f6\uff0c\u5b83\u5c06\u5728Eureka\u670d\u52a1\u5668\u4e2d\u6ce8\u518c\u81ea\u5df1\u3002\u5fae\u670d\u52a1\u5728\u670d\u52a1\u5668\u4e0a\u7684\u6ce8\u518c\u79f0\u4e3a
\n \u670d\u52a1\u6ce8\u518c\u3002<\/strong>\n <\/div>\n
\n \u6bcf\u5f53\u4e00\u4e2a\u670d\u52a1\u8981\u4e0e\u53e6\u4e00\u4e2a\u670d\u52a1\u901a\u8bdd\u65f6\uff0c\u5047\u5b9aCurrencyCalculationService\u60f3\u8981\u4e0eCurrencyExchangeService\u901a\u8bdd\u3002 CurrencyCalculationService\u9996\u5148\u4e0eEureka\u670d\u52a1\u5668\u5bf9\u8bdd\u3002\u670d\u52a1\u5668\u63d0\u4f9b\u5f53\u524d\u6b63\u5728\u8fd0\u884c\u7684CurrencyExchangeService\u5b9e\u4f8b\u3002\u4e3a\u5176\u4ed6\u670d\u52a1\u63d0\u4f9b\u5b9e\u4f8b\u7684\u8fc7\u7a0b\u79f0\u4e3a
\n \u670d\u52a1\u53d1\u73b0\u3002<\/strong>\n <\/div>\n
\n \u670d\u52a1\u6ce8\u518c<\/strong>\u548c
\n \u670d\u52a1\u53d1\u73b0<\/strong>\u662f\u4e24\u4e2a\u91cd\u8981\u7684\u670d\u52a1\u5668\u7684\u529f\u80fd\u3002\u4e0b\u4e00\u6b65\uff0c\u6211\u4eec\u5c06\u8bbe\u7f6e\u4e00\u4e2aEureka\u670d\u52a1\u5668\u3002\n <\/div>\n

\u8bbe\u7f6eEureka\u670d\u52a1\u5668<\/h2>\n
\n \u8bbe\u7f6e\u8fc7\u7a0b\u6d89\u53ca\u5f88\u591a\u6b65\u9aa4\u3002 Eureka\u670d\u52a1\u5668\u5982\u4e0b:\n <\/div>\n

\u4e3aEureka\u670d\u52a1\u5668\u521b\u5efa\u7ec4\u4ef6<\/span>
\n \u66f4\u65b0CurrencyCalculationService\u4ee5\u8fde\u63a5\u5230Eureka\u670d\u52a1\u5668<\/span>
\n \u5c06CurrencyExchangeService\u8fde\u63a5\u5230Eureka\u670d\u52a1\u5668<\/span>
\n \u914d\u7f6e\u529f\u80fd\u533a<\/span> <\/p>\n

\n \u4e00\u65e6\u5728Eureka\u670d\u52a1\u5668\u4e0a\u6ce8\u518c\u4e86currency-exchange-service\u5b9e\u4f8b\uff0c\u90a3\u4e48\u6211\u4eec\u5c06\u4f7f\u7528\u529f\u80fd\u533a\u4ece\u670d\u52a1\u5668\u4e2d\u67e5\u627e\u8be6\u7ec6\u4fe1\u606f\u3002\u8ba9\u6211\u4eec\u6309\u7167\u4e0a\u9762\u6307\u5b9a\u7684\u6b65\u9aa4\u8fdb\u884c\u64cd\u4f5c:\n <\/div>\n
\n \u4e3aEureka\u670d\u52a1\u5668\u521b\u5efa\u7ec4\u4ef6<\/strong>\n <\/div>\n
\n \u6b65\u9aa41: <\/strong>\u6253\u5f00Spring Initializr https:\/\/start.spring.io \u3002\n <\/div>\n
\n \u6b65\u9aa42: <\/strong>\u63d0\u4f9b
\n Group<\/strong>\u540d\u79f0\u3002\u6211\u4eec\u63d0\u4f9b\u4e86
\n com.lidihuo.microservices\u3002<\/strong>\n <\/div>\n
\n \u6b65\u9aa43: <\/strong>\u63d0\u4f9b
\n Artifact id<\/strong>\u3002\u6211\u4eec\u63d0\u4f9b\u4e86
\n netflix-eureka-naming-server\u3002<\/strong>\n <\/div>\n

SpringCloud Eureka_https:\/\/bianchenghao6.com_\u3010SpringCloud \u6559\u7a0b\u3011_\u7b2c1\u5f20 <\/p>\n

\n \u6b65\u9aa44: <\/strong>\u6dfb\u52a0\u4ee5\u4e0b\u4f9d\u8d56\u9879:
\n Eureka Server\uff0cConfig Client\uff0cActuator\uff0c<\/strong>\u548c
\n DevTools\u3002<\/strong>\n <\/div>\n

SpringCloud Eureka_https:\/\/bianchenghao6.com_\u3010SpringCloud \u6559\u7a0b\u3011_\u7b2c2\u5f20 <\/p>\n

\n \u6b65\u9aa45: <\/strong>\u70b9\u51fb
\n \u751f\u6210<\/strong> >\u6309\u94ae\u3002\u5b83\u4f1a\u4e0b\u8f7d\u4e00\u4e2a
\n zip <\/strong>\u6587\u4ef6\u3002\n <\/div>\n
\n \u6b65\u9aa46: <\/strong>
\n \u63d0\u53d6<\/strong>\u8be5zip\u6587\u4ef6\u5e76\u5c06\u8be5\u6587\u4ef6\u5939\u7c98\u8d34\u5230Spring Tool Suite\u4e2d(STS)\u5de5\u4f5c\u533a\uff0c\u7136\u540e
\n \u5bfc\u5165<\/strong>\u3002\n <\/div>\n
\n \u6587\u4ef6->\u5bfc\u5165->\u73b0\u6709Maven\u9879\u76ee->\u4e0b\u4e00\u6b65->\u6d4f\u89c8->\u9009\u62e9
\n netflix-eureka\u547d\u540d-\u670d\u52a1\u5668\u9879\u76ee<\/strong>->\u5b8c\u6210\n <\/div>\n

SpringCloud Eureka_https:\/\/bianchenghao6.com_\u3010SpringCloud \u6559\u7a0b\u3011_\u7b2c3\u5f20 <\/p>\n

\n \u6b65\u9aa47: <\/strong>\u6253\u5f00
\n NetflixEurekaNamingServerApplication.java <\/strong>\u6587\u4ef6\uff0c\u5e76\u4f7f\u7528\u6ce8\u91ca
\n @EnableEurekaServer <\/strong>\u542f\u7528Eureka\u670d\u52a1\u5668\u3002\n <\/div>\n
\n NetflixEurekaNamingServerApplication .java <\/strong>\n <\/div>\n
\n
\r\npackage <\/span>com.lidihuo.microservices.netflixeurekanamingserver;\r\nimport org.springframework.boot.SpringApplication;\r\nimport org.springframework.boot.autoconfigure.SpringBootApplication;\r\nimport org.springframework.cloud.netflix.eureka.server.EnableEurekaServer;\r\n@SpringBootApplication\r\n@EnableEurekaServer\r\npublic <\/span>class <\/span>NetflixEurekaNamingServerApplication \r\n{\r\npublic <\/span>static void <\/span>main(String[] args) {\r\nSpringApplication.run<\/span>(NetflixEurekaNamingServerApplication.class, args);\r\n}\r\n}\r\n<\/pre>\n

<\/code>\n <\/div>\n

\n \u6b65\u9aa48: <\/strong>\u6253\u5f00
\n application.properties <\/strong>\u6587\u4ef6\u5e76\u914d\u7f6e
\n \u5e94\u7528\u7a0b\u5e8f\u540d\u79f0\uff0c\u7aef\u53e3\uff0c<\/strong>\u548c
\n \u5c24\u91cc\u5361\u670d\u52a1\u5668<\/strong>\u3002\n <\/div>\n
\n
\r\nspring.application.name=netflix-eureka-naming-server\r\nserver.port=8761\r\neureka.client.register-with-eureka=false\r\neureka.client.fetch-registry=false\r\n<\/pre>\n

<\/code>\n <\/div>\n

\n \u7aef\u53e3
\n 8761 <\/strong>\u662fEureka\u670d\u52a1\u5668\u7684\u9ed8\u8ba4\u7aef\u53e3\u3002\n <\/div>\n
\n \u6b65\u9aa49: <\/strong>\u8fd0\u884c
\n NetflixEurekaNamingServerApplication.java <\/strong>\u6587\u4ef6\u4f5c\u4e3aJava\u5e94\u7528\u7a0b\u5e8f\u3002\n <\/div>\n
\n \u7b2c10\u6b65: <\/strong>\u6253\u5f00\u6d4f\u89c8\u5668\u5e76\u8f93\u5165URL http:\/\/localhost:8761 \u3002\u5b83\u663e\u793a\u4e86Eureka\u670d\u52a1\u5668UI\u3002\n <\/div>\n

SpringCloud Eureka_https:\/\/bianchenghao6.com_\u3010SpringCloud \u6559\u7a0b\u3011_\u7b2c4\u5f20 <\/p>\n

\n \u5728\u672c\u8282\u4e2d\uff0c\u6211\u4eec\u6709\u521b\u5efa\u4e86\u4e00\u4e2a\u7ec4\u4ef6Eureka\u670d\u52a1\u5668\u3002\u4e0b\u4e00\u6b65\uff0c\u6211\u4eec\u5c06\u5fae\u670d\u52a1\u4e0eEureka\u670d\u52a1\u5668\u8fde\u63a5\u3002\n <\/div>\n
\n

<\/body>
\n<\/html><\/p>\n","protected":false},"excerpt":{"rendered":"SpringCloud Eurekazh-cn","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[106],"tags":[],"class_list":["post-640","post","type-post","status-publish","format-standard","hentry","category-bc_springcloud_jc"],"_links":{"self":[{"href":"https:\/\/bianchenghao6.com\/wp-json\/wp\/v2\/posts\/640"}],"collection":[{"href":"https:\/\/bianchenghao6.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/bianchenghao6.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/bianchenghao6.com\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/bianchenghao6.com\/wp-json\/wp\/v2\/comments?post=640"}],"version-history":[{"count":0,"href":"https:\/\/bianchenghao6.com\/wp-json\/wp\/v2\/posts\/640\/revisions"}],"wp:attachment":[{"href":"https:\/\/bianchenghao6.com\/wp-json\/wp\/v2\/media?parent=640"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/bianchenghao6.com\/wp-json\/wp\/v2\/categories?post=640"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/bianchenghao6.com\/wp-json\/wp\/v2\/tags?post=640"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}