{"id":285589,"date":"2017-04-27T11:55:36","date_gmt":"2017-04-27T07:55:36","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=285589"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=285589","title":{"rendered":"\u0421\u043a\u0440\u0435\u0441\u0442\u0438\u0442\u044c \u0435\u0436\u0430 (Marathon) \u0441 \u0443\u0436\u043e\u043c (Spring Cloud). \u042d\u043f\u0438\u0437\u043e\u0434 1"},"content":{"rendered":"<p>\u041f\u0440\u0438 \u043f\u0435\u0440\u0435\u0445\u043e\u0434\u0435 \u043a \u0440\u0430\u0441\u043f\u0440\u0435\u0434\u0435\u043b\u0451\u043d\u043d\u044b\u043c \u0441\u0438\u0441\u0442\u0435\u043c\u0430\u043c \u0441 \u0431\u043e\u043b\u044c\u0448\u0438\u043c \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e\u043c \u0438\u043d\u0441\u0442\u0430\u043d\u0441\u043e\u0432 \u0441\u0435\u0440\u0432\u0438\u0441\u043e\u0432 \u0432 \u043f\u043e\u043b\u043d\u044b\u0439 \u0440\u043e\u0441\u0442 \u0432\u0441\u0442\u0430\u044e\u0442 \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u044b \u0438\u0445 \u043e\u0431\u043d\u0430\u0440\u0443\u0436\u0435\u043d\u0438\u044f (<strong>service discovery<\/strong>) \u0438 \u0431\u0430\u043b\u0430\u043d\u0441\u0438\u0440\u043e\u0432\u043a\u0438 \u0437\u0430\u043f\u0440\u043e\u0441\u043e\u0432 (<strong>load balancing<\/strong>) \u043c\u0435\u0436\u0434\u0443 \u043d\u0438\u043c\u0438. \u041a\u0430\u043a \u043f\u0440\u0430\u0432\u0438\u043b\u043e, \u0434\u043b\u044f \u0438\u0445 \u0440\u0435\u0448\u0435\u043d\u0438\u044f \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044e\u0442\u0441\u044f \u0442\u0430\u043a\u0438\u0435 \u0441\u043f\u0435\u0446\u0438\u0430\u043b\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0435 \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442\u044b \u043a\u0430\u043a <a href=\"https:\/\/www.consul.io\/\"><strong>Consul<\/strong><\/a>, <a href=\"https:\/\/github.com\/Netflix\/eureka\"><strong>Eureka<\/strong><\/a> \u0438\u043b\u0438 \u0441\u0442\u0430\u0440\u044b\u0439 \u0434\u043e\u0431\u0440\u044b\u0439 <a href=\"https:\/\/zookeeper.apache.org\/\"><strong>Zookeeper<\/strong><\/a>, \u0432 \u0441\u043e\u0447\u0435\u0442\u0430\u043d\u0438\u0438 \u0441 <strong>Nginx<\/strong>, <strong>HAProxy<\/strong> \u0438 \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u043c \u043c\u043e\u0441\u0442\u043e\u043c \u043c\u0435\u0436\u0434\u0443 \u043d\u0438\u043c\u0438 (\u0441\u043c. <a href=\"https:\/\/github.com\/gliderlabs\/registrator\"><strong>registrator<\/strong><\/a>).<\/p>\n<p>  <\/p>\n<p>\u041e\u0441\u043d\u043e\u0432\u043d\u0430\u044f \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u0430 \u0432 \u043f\u043e\u0434\u043e\u0431\u043d\u043e\u043c \u043f\u043e\u0434\u0445\u043e\u0434\u0435 \u044d\u0442\u043e \u0431\u043e\u043b\u044c\u0448\u043e\u0435 \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u0438\u043d\u0442\u0435\u0433\u0440\u0430\u0446\u0438\u0439, \u0438, \u043a\u0430\u043a \u0441\u043b\u0435\u0434\u0441\u0442\u0432\u0438\u0435, \u0442\u043e\u0447\u0435\u043a \u0433\u0434\u0435 \u0447\u0442\u043e-\u0442\u043e \u043c\u043e\u0436\u0435\u0442 \u043f\u043e\u0439\u0442\u0438 \u043d\u0435 \u0442\u0430\u043a. \u0412\u0435\u0434\u044c \u043f\u043e\u043c\u0438\u043c\u043e \u0432\u044b\u0448\u0435\u0443\u043f\u043e\u043c\u044f\u043d\u0443\u0442\u044b\u0445 \u0440\u0435\u0448\u0435\u043d\u0438\u0439 \u043d\u0430\u0432\u0435\u0440\u043d\u044f\u043a\u0430 \u0431\u0443\u0434\u0435\u0442 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c\u0441\u044f \u043b\u043e\u043a\u0430\u043b\u044c\u043d\u044b\u0439 \u043c\u0430\u043b\u0435\u043d\u044c\u043a\u0438\u0439 <strong>PaaS<\/strong> (\u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440 <a href=\"https:\/\/mesosphere.github.io\/marathon\/\"><strong>Mesosphere Marathon<\/strong><\/a> \u0438\u043b\u0438 <strong>Kubernetes<\/strong>). \u041f\u043e\u0441\u043b\u0435\u0434\u043d\u0438\u0435, \u043a \u0441\u043b\u043e\u0432\u0443, \u0443\u0436\u0435 \u0445\u0440\u0430\u043d\u044f\u0442 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u0443\u044e \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u044e \u043e\u0431 \u043e\u043a\u0440\u0443\u0436\u0435\u043d\u0438\u0438 (\u0432\u0435\u0434\u044c \u0447\u0435\u0440\u0435\u0437 \u043d\u0438\u0445 \u0438\u0434\u0451\u0442 \u0432\u0435\u0441\u044c \u0434\u0435\u043f\u043b\u043e\u0439\u043c\u0435\u043d\u0442). \u0418 \u0432\u0441\u0442\u0430\u0451\u0442 \u0432\u043e\u043f\u0440\u043e\u0441, \u0430 \u043c\u043e\u0436\u0435\u043c \u043b\u0438 \u043c\u044b \u043e\u0442\u043a\u0430\u0437\u0430\u0442\u044c\u0441\u044f \u043e\u0442 \u0441\u043f\u0435\u0446\u0438\u0430\u043b\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0445 \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442\u043e\u0432 \u0434\u043b\u044f <strong>service discovery<\/strong> \u0438 \u043f\u0435\u0440\u0435\u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0442\u043e\u0442 \u0436\u0435 <strong>Marathon<\/strong> \u0434\u043b\u044f \u044d\u0442\u043e\u0439 \u0437\u0430\u0434\u0430\u0447\u0438?<\/p>\n<p>  <\/p>\n<p>\u041a\u0440\u0430\u0442\u043a\u0438\u0439 \u043e\u0442\u0432\u0435\u0442 \u2014 \u043c\u043e\u0436\u0435\u043c. \u0415\u0441\u043b\u0438 \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043d\u043e \u043a\u0430\u043a \u2014 \u0447\u0438\u0442\u0430\u0439\u0442\u0435 \u0434\u0430\u043b\u044c\u0448\u0435.<\/p>\n<p><a name=\"habracut\"><\/a>  <\/p>\n<h2 id=\"dispoziciya\">\u0414\u0438\u0441\u043f\u043e\u0437\u0438\u0446\u0438\u044f<\/h2>\n<p>  <\/p>\n<p>\u0418\u0442\u0430\u043a, \u0447\u0442\u043e \u0443 \u043d\u0430\u0441 \u0435\u0441\u0442\u044c \u0432 \u043d\u0430\u043b\u0438\u0447\u0438\u0438:<\/p>\n<p>  <\/p>\n<ul>\n<li><strong>Apache Mesos<\/strong> \u0438 \u0435\u0433\u043e \u0432\u0435\u0440\u043d\u044b\u0439 \u0444\u0440\u0435\u0439\u043c\u0432\u043e\u0440\u043a <strong>Marathon<\/strong> \u0432 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 \u0441\u0438\u0441\u0442\u0435\u043c\u044b \u043e\u0440\u043a\u0435\u0441\u0442\u0440\u0430\u0446\u0438\u0438 \u0441\u0435\u0440\u0432\u0438\u0441\u043e\u0432<\/li>\n<li>\u0421\u0435\u0440\u0432\u0438\u0441\u044b, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043d\u0430\u043f\u0438\u0441\u0430\u043d\u044b \u0441 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435\u043c \u0444\u0440\u0435\u0439\u043c\u0432\u043e\u0440\u043a\u0430 <strong>Spring Boot<\/strong> \u0438 \u0435\u0433\u043e \u0440\u0430\u0441\u0448\u0438\u0440\u0435\u043d\u0438\u044f <strong>Spring Cloud<\/strong><\/li>\n<\/ul>\n<p>  <\/p>\n<p><strong>Mesos<\/strong> \u0431\u0435\u0437 \u0441\u0430\u0445\u0430\u0440\u0430 (\u0447\u0438\u0442\u0430\u0439 \u0431\u0435\u0437 \u0444\u0440\u0435\u0439\u043c\u0432\u043e\u0440\u043a\u043e\u0432) \u044d\u0442\u043e \u0441\u0438\u0441\u0442\u0435\u043c\u0430 \u0443\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u044f \u0440\u0435\u0441\u0443\u0440\u0441\u0430\u043c\u0438 \u043a\u043b\u0430\u0441\u0442\u0435\u0440\u0430, \u043a\u043e\u0442\u043e\u0440\u0443\u044e \u043c\u043e\u0436\u043d\u043e \u0440\u0430\u0441\u0448\u0438\u0440\u044f\u0442\u044c \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u0444\u0440\u0435\u0439\u043c\u0432\u043e\u0440\u043a\u043e\u0432. \u0424\u0440\u0435\u0439\u043c\u0432\u043e\u0440\u043a\u0438 \u0441\u043b\u0443\u0436\u0430\u0442 \u0440\u0430\u0437\u043d\u044b\u043c \u0446\u0435\u043b\u044f\u043c. \u041a\u0430\u043a\u0438\u0435-\u0442\u043e \u0443\u043c\u0435\u044e\u0442 \u0437\u0430\u043f\u0443\u0441\u043a\u0430\u0442\u044c \u0448\u0438\u0440\u043e\u043a\u0438\u0439 \u0441\u043f\u0435\u043a\u0442\u0440 \u043a\u0440\u0430\u0442\u043a\u043e\u0441\u0440\u043e\u0447\u043d\u044b\u0445 \u0437\u0430\u0434\u0430\u0447 (<strong>Chronos<\/strong>), \u0434\u0440\u0443\u0433\u0438\u0435 \u0434\u043e\u043b\u0433\u043e\u0436\u0438\u0432\u0443\u0449\u0438\u0445 (<strong>Marathon<\/strong>). \u0410 \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0437\u0430\u0442\u043e\u0447\u0435\u043d\u044b \u043f\u043e\u0434 \u043a\u043e\u043d\u043a\u0440\u0435\u0442\u043d\u044b\u0435 \u043f\u0440\u043e\u0434\u0443\u043a\u0442\u044b, \u0442\u0430\u043a\u0438\u0435 \u043a\u0430\u043a <strong>Hadoop<\/strong> \u0438\u043b\u0438 <strong>Jenkins<\/strong>.<\/p>\n<p>  <\/p>\n<p><strong>Mesosphere Marathon<\/strong> \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442 \u0438\u0437 \u0441\u0435\u0431\u044f \u0442\u043e\u0442 \u0441\u0430\u043c\u044b\u0439 \u0444\u0440\u0435\u0439\u043c\u0432\u043e\u0440\u043a, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0443\u043c\u0435\u0435\u0442 \u0443\u043f\u0440\u0430\u0432\u043b\u044f\u0442\u044c \u0437\u0430\u043f\u0443\u0441\u043a\u043e\u043c, \u043e\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u043e\u0439 \u0438 \u0432 \u0446\u0435\u043b\u043e\u043c \u043f\u043b\u0430\u043d\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435\u043c \u0440\u0430\u0431\u043e\u0442\u044b \u0434\u043e\u043b\u0433\u043e\u0436\u0438\u0432\u0443\u0449\u0438\u0445 \u0437\u0430\u0434\u0430\u0447, \u043a \u043a\u043e\u0442\u043e\u0440\u044b\u043c \u043c\u043e\u0436\u043d\u043e \u043e\u0442\u043d\u0435\u0441\u0442\u0438 \u0441\u0435\u0440\u0432\u0438\u0441\u044b, \u043e\u0431\u0440\u0430\u0431\u0430\u0442\u044b\u0432\u0430\u044e\u0449\u0438\u0435 \u043a\u043b\u0438\u0435\u043d\u0442\u0441\u043a\u0438\u0435, \u0438 \u043d\u0435 \u043e\u0447\u0435\u043d\u044c, \u0437\u0430\u043f\u0440\u043e\u0441\u044b \u043d\u0430 \u0434\u043b\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u043c \u043f\u0440\u043e\u043c\u0435\u0436\u0443\u0442\u043a\u0435 \u0432\u0440\u0435\u043c\u0435\u043d\u0438.<\/p>\n<p>  <\/p>\n<p><strong><a href=\"http:\/\/projects.spring.io\/spring-cloud\/\">Spring Cloud<\/a><\/strong> \u044d\u0442\u043e \u0442\u043e\u0436\u0435 \u0444\u0440\u0435\u0439\u043c\u0432\u043e\u0440\u043a, \u043d\u043e \u0443\u0436\u0435 \u0434\u043b\u044f \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u043a\u0438 \u044d\u0442\u0438\u0445 \u0441\u0430\u043c\u044b\u0445 \u0441\u0435\u0440\u0432\u0438\u0441\u043e\u0432, \u0432 \u043a\u043e\u0442\u043e\u0440\u043e\u043c \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u043d\u044b \u043a\u0430\u043a \u043e\u0441\u043d\u043e\u0432\u043d\u044b\u0435 \u043f\u0430\u0442\u0442\u0435\u0440\u043d\u044b \u0434\u043b\u044f \u0438\u0445 \u0440\u0430\u0431\u043e\u0442\u044b \u0432 \u0440\u0430\u0441\u043f\u0440\u0435\u0434\u0435\u043b\u0451\u043d\u043d\u044b\u0445 \u0441\u0438\u0441\u0442\u0435\u043c\u0430\u0445, \u0442\u0430\u043a \u0438 \u043a\u043e\u043d\u043a\u0440\u0435\u0442\u043d\u044b\u0435 \u0438\u043d\u0442\u0435\u0433\u0440\u0430\u0446\u0438\u0438 \u044d\u0442\u0438\u0445 \u043f\u0430\u0442\u0442\u0435\u0440\u043d\u043e\u0432 \u0441 \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u044e\u0449\u0438\u043c\u0438 \u043d\u0430 \u0440\u044b\u043d\u043a\u0435 \u0440\u0435\u0448\u0435\u043d\u0438\u044f\u043c\u0438 (\u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0441 \u0442\u0435\u043c \u0436\u0435 <strong>Consul<\/strong>-\u043e\u043c).<\/p>\n<p>  <\/p>\n<p>\u0412 \u0440\u0430\u043c\u043a\u0430\u0445 <strong>Spring Cloud<\/strong>-\u0430 \u0434\u043b\u044f \u0440\u0435\u0448\u0435\u043d\u0438\u044f \u0437\u0430\u0434\u0430\u0447\u0438 \u043e\u0431\u043d\u0430\u0440\u0443\u0436\u0435\u043d\u0438\u044f \u0441\u0435\u0440\u0432\u0438\u0441\u043e\u0432 \u0435\u0441\u0442\u044c \u0444\u0430\u043a\u0442\u0438\u0447\u0435\u0441\u043a\u0438 \u0434\u0432\u0435 \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438. <\/p>\n<p>  <\/p>\n<p>\u041f\u0435\u0440\u0432\u0443\u044e, \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e <a href=\"https:\/\/github.com\/Netflix\/zuul\"><strong>Netflix Zuul<\/strong><\/a>, \u043c\u043e\u0436\u043d\u043e \u043e\u0442\u043d\u0435\u0441\u0442\u0438 \u043a \u0448\u0430\u0431\u043b\u043e\u043d\u0443 <a href=\"http:\/\/microservices.io\/patterns\/server-side-discovery.html\">Server-Side Service Discovery<\/a>. \u0421\u0443\u0442\u044c \u0448\u0430\u0431\u043b\u043e\u043d\u0430 \u0437\u0430\u043a\u043b\u044e\u0447\u0430\u0435\u0442\u0441\u044f \u0432 \u0442\u043e\u043c, \u0447\u0442\u043e \u043c\u044b \u0434\u0435\u043b\u0430\u0435\u043c \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u043e\u0435 \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u0440\u043e\u0443\u0442\u0435\u0440\u043e\u0432, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0437\u043d\u0430\u044e\u0442 \u0442\u0435\u043a\u0443\u0449\u0435\u0435 \u043c\u0435\u0441\u0442\u043e\u043f\u043e\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u0438 \u0440\u0430\u0437\u043b\u0438\u0447\u043d\u0443\u044e \u043c\u0435\u0442\u0430-\u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u044e \u043e\u0431 \u0438\u043d\u0441\u0442\u0430\u043d\u0441\u0430\u0445 \u0441\u0435\u0440\u0432\u0438\u0441\u043e\u0432, \u0438 \u043f\u0440\u0435\u0434\u043e\u0441\u0442\u0430\u0432\u043b\u044f\u044e\u0442 \u043f\u043e\u0441\u0442\u043e\u044f\u043d\u043d\u044b\u0435 http-\u0440\u0435\u0441\u0443\u0440\u0441\u044b, \u0447\u0435\u0440\u0435\u0437 \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0438\u0434\u0451\u0442 \u043f\u0440\u043e\u043a\u0441\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435 \u0437\u0430\u043f\u0440\u043e\u0441\u043e\u0432 \u043a \u043d\u0438\u043c. \u0415\u0441\u043b\u0438 \u0430\u0431\u0441\u0442\u0440\u0430\u0433\u0438\u0440\u043e\u0432\u0430\u0442\u044c\u0441\u044f \u043e\u0442 Spring-\u0430, \u0442\u043e \u043a\u043b\u0430\u0441\u0441\u0438\u0447\u0435\u0441\u043a\u0438\u043c \u0440\u043e\u0443\u0442\u0435\u0440\u043e\u043c \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f <strong>nginx<\/strong> \u043f\u0440\u0438 \u0443\u0441\u043b\u043e\u0432\u0438\u0438 \u0435\u0433\u043e \u0434\u0438\u043d\u0430\u043c\u0438\u0447\u0435\u0441\u043a\u043e\u0439 \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u0438.<br \/>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/files\/52f\/fc8\/8c3\/52ffc88c39f0441a89c5723c4cd598ae.png\" alt=\"Server-Side Service Discovery pattern\"\/><\/p>\n<p>  <\/p>\n<p>\u0412\u0442\u043e\u0440\u0430\u044f \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f \u043e\u0442\u043d\u043e\u0441\u0438\u0442\u0441\u044f \u043a \u043a\u043b\u0430\u0441\u0441\u0443 <a href=\"http:\/\/microservices.io\/patterns\/client-side-discovery.html\">Client-Side Service Discovery<\/a>. \u041e\u0441\u043d\u043e\u0432\u043d\u043e\u0435 \u0435\u0451 \u043e\u0442\u043b\u0438\u0447\u0438\u0435 \u043e\u0442 \u043f\u0440\u0435\u0434\u044b\u0434\u0443\u0449\u0435\u0439 \u0441\u043e\u0441\u0442\u043e\u0438\u0442 \u0432 \u043e\u0442\u0441\u0443\u0442\u0441\u0442\u0432\u0438\u0438 \u0440\u043e\u0443\u0442\u0435\u0440\u0430, \u0430 \u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u043e \u043f\u0440\u043e\u043c\u0435\u0436\u0443\u0442\u043e\u0447\u043d\u043e\u0433\u043e \u0437\u0432\u0435\u043d\u0430 \u0438 \u043b\u0438\u0448\u043d\u0435\u0439 \u0442\u043e\u0447\u043a\u0438 \u043e\u0442\u043a\u0430\u0437\u0430, \u043a\u0430\u043a \u043a\u043b\u0430\u0441\u0441\u0430. \u0412\u043c\u0435\u0441\u0442\u043e \u044d\u0442\u043e\u0433\u043e \u0432 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 \u0440\u043e\u0443\u0442\u0435\u0440\u0430 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f &quot;\u0443\u043c\u043d\u044b\u0439&quot; \u043a\u043b\u0438\u0435\u043d\u0442\u0441\u043a\u0438\u0439 \u0431\u0430\u043b\u0430\u043d\u0441\u0438\u0440\u043e\u0432\u0449\u0438\u043a, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0442\u0430\u043a\u0436\u0435 \u0437\u043d\u0430\u0435\u0442 \u0432\u0441\u0451, \u0447\u0442\u043e \u043d\u0443\u0436\u043d\u043e \u0437\u043d\u0430\u0442\u044c, \u043f\u0440\u043e \u0438\u043d\u0441\u0442\u0430\u043d\u0441\u044b \u0441\u0435\u0440\u0432\u0438\u0441\u043e\u0432, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043e\u043d \u0432\u044b\u0437\u044b\u0432\u0430\u0435\u0442. \u0412 <strong>Spring Cloud<\/strong> \u0432 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 \u0442\u0430\u043a\u043e\u0433\u043e \u0431\u0430\u043b\u0430\u043d\u0441\u0438\u0440\u043e\u0432\u0449\u0438\u043a\u0430 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f <a href=\"https:\/\/github.com\/Netflix\/ribbon\"><strong>Netflix Ribbon<\/strong><\/a>.<br \/>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/files\/a53\/737\/aab\/a53737aab8fb49878f1c1a383de6ec86.png\" alt=\"Client-Side Service Discovery pattern\"\/><\/p>\n<p>  <\/p>\n<p>\u0412 \u044d\u0442\u043e\u043c \u0446\u0438\u043a\u043b\u0435 \u0441\u0442\u0430\u0442\u0435\u0439 \u043c\u044b \u043f\u043e\u0434\u0440\u043e\u0431\u043d\u0435\u0435 \u043e\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u043c\u0441\u044f \u043d\u0430 \u043a\u043b\u0438\u0435\u043d\u0442\u0441\u043a\u043e\u0439 \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 \u0448\u0430\u0431\u043b\u043e\u043d\u0430, \u0445\u043e\u0442\u044f \u0438 \u043f\u0440\u043e \u0441\u0435\u0440\u0432\u0435\u0440\u043d\u0443\u044e \u0442\u043e\u0436\u0435 \u043f\u043e\u0433\u043e\u0432\u043e\u0440\u0438\u043c.<\/p>\n<p>  <\/p>\n<h2 id=\"enablediscoveryclient\">@EnableDiscoveryClient<\/h2>\n<p>  <\/p>\n<p>\u0412 Spring-\u0435 \u043f\u043e\u0447\u0442\u0438 \u0432\u0441\u0451 \u043c\u043e\u0436\u043d\u043e \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u0440\u0430\u0431\u043e\u0442\u0430\u044e\u0449\u0438\u043c \u0432\u043b\u0435\u043f\u0438\u0432 \u043d\u0430\u0434 \u043a\u043b\u0430\u0441\u0441\u043e\u043c\/\u043c\u0435\u0442\u043e\u0434\u043e\u043c\/\u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u043e\u0439 \u043e\u0434\u0438\u043d-\u0434\u0440\u0443\u0433\u043e\u0439 \u0434\u0435\u0441\u044f\u0442\u043e\u043a \u0430\u043d\u043d\u043e\u0442\u0430\u0446\u0438\u0439 \u0438 \u043f\u0440\u043e\u043f\u0438\u0441\u0430\u0432 \u043d\u0435\u043c\u043d\u043e\u0436\u043a\u043e \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u0438 \u0432 <strong>yaml<\/strong>-\u0444\u0430\u0439\u043b. \u041d\u0443 \u043e\u043a, \u043f\u0440\u0435\u0434\u043f\u043e\u043b\u043e\u0436\u0438\u043c, \u0447\u0442\u043e \u043d\u0435 \u0432\u0441\u0451, \u043d\u043e \u043c\u043d\u043e\u0433\u043e\u0435. <\/p>\n<p>  <\/p>\n<p>\u041c\u0435\u0442\u043e\u0434\u0438\u0447\u043a\u0430 \u0443\u0447\u0438\u0442 \u043d\u0430\u0441, \u0447\u0442\u043e \u0434\u043e\u0431\u0430\u0432\u0438\u0432 magic-\u0430\u043d\u043d\u043e\u0442\u0430\u0446\u0438\u044e <strong>@EnableDiscoveryClient<\/strong> \u043d\u0430\u0434 \u0441\u0432\u043e\u0438\u043c \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435\u043c, \u0443 \u043d\u0430\u0441 \u0431\u0443\u0434\u0435\u0442 \u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c (\u043f\u043e\u0441\u043b\u0435 \u043f\u0430\u0440\u044b \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u0435\u0439 \u0438 \u043d\u0430\u0441\u0442\u0440\u043e\u0435\u043a, \u043d\u043e \u043e\u0431 \u044d\u0442\u043e \u0447\u0443\u0442\u044c \u043f\u043e\u0437\u0436\u0435) \u043e\u0431\u043d\u0430\u0440\u0443\u0436\u0435\u043d\u0438\u0435 \u0441\u0435\u0440\u0432\u0438\u0441\u043e\u0432. \u041f\u043e \u043a\u0440\u0430\u0439\u043d\u0435\u0439 \u043c\u0435\u0440\u0435 \u043b\u043e\u043a\u0430\u043b\u044c\u043d\u043e \u0432\u043d\u0443\u0442\u0440\u0438 \u043d\u0430\u0448\u0435\u0433\u043e \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f. \u0421\u0434\u0435\u043b\u0430\u0442\u044c \u044d\u0442\u043e \u043c\u043e\u0436\u043d\u043e \u043e\u0447\u0435\u043d\u044c \u043f\u0440\u043e\u0441\u0442\u043e, \u0434\u0430\u0436\u0435 \u043d\u0430\u043f\u0440\u044f\u0433\u0430\u0442\u044c\u0441\u044f \u043d\u0435 \u043d\u0430\u0434\u043e:<\/p>\n<p>  <\/p>\n<pre><code class=\"java\">@SpringBootApplication @EnableDiscoveryClient public class Application {     public static void main(String[] args) {         SpringApplication.run(Application.class, args);     } }<\/code><\/pre>\n<p>  <\/p>\n<p>\u041f\u043e\u0441\u043b\u0435 \u044d\u0442\u043e\u0433\u043e \u043d\u0430\u0447\u0438\u043d\u0430\u0435\u0442\u0441\u044f \u043c\u0430\u0433\u0438\u044f \u0432 \u043a\u043e\u0442\u043e\u0440\u043e\u0439 \u043d\u0435\u0442 \u0432\u043e\u043b\u0448\u0435\u0431\u0441\u0442\u0432\u0430. Spring \u0443\u0432\u0438\u0434\u0435\u0432 \u044d\u0442\u0443 \u0430\u043d\u043d\u043e\u0442\u0430\u0446\u0438\u044e \u0437\u0430\u0433\u0440\u0443\u0436\u0430\u0435\u0442 \u0432\u0441\u0435 \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u0438, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0443\u043a\u0430\u0437\u0430\u043d\u044b \u0432 <strong>META-INF\/spring.factories<\/strong> \u0432 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 \u0437\u0430\u0433\u0440\u0443\u0436\u0430\u0435\u043c\u044b\u0445 \u0434\u043b\u044f <strong>EnableDiscoveryClient<\/strong>:<\/p>\n<p>  <\/p>\n<pre><code>org.springframework.cloud.client.discovery.EnableDiscoveryClient=\\ org.springframework.cloud.xxx.discovery.XXXDiscoveryClientConfiguration<\/code><\/pre>\n<p>  <\/p>\n<p>\u041e\u0442\u043a\u0443\u0434\u0430 \u0438 \u043a\u0430\u043a\u0438\u0435 \u0432\u043e\u043e\u0431\u0449\u0435 \u043c\u043e\u0433\u0443\u0442 \u0431\u044b\u0442\u044c \u0437\u0430\u0433\u0440\u0443\u0436\u0435\u043d\u044b \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u0438? \u0414\u043b\u044f \u043e\u0442\u0432\u0435\u0442\u0430 \u043d\u0430 \u044d\u0442\u043e\u0442 \u0432\u043e\u043f\u0440\u043e\u0441 \u043d\u0443\u0436\u043d\u043e \u0441\u043a\u0430\u0437\u0430\u0442\u044c, \u0447\u0442\u043e \u0441\u0430\u043c <strong>Spring Cloud<\/strong> \u0441\u043e\u0441\u0442\u043e\u0438\u0442 \u0438\u0437 \u0431\u0430\u0437\u043e\u0432\u043e\u0439 \u0447\u0430\u0441\u0442\u0438, \u0432 \u043a\u043e\u0442\u043e\u0440\u043e\u0439 \u0435\u0441\u0442\u044c \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u044b\u0435 \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441\u044b \u0438 \u043e\u0431\u0449\u0430\u044f \u043b\u043e\u0433\u0438\u043a\u0430 \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 \u0440\u0430\u0437\u043b\u0438\u0447\u043d\u044b\u0445 \u0448\u0430\u0431\u043b\u043e\u043d\u043e\u0432, \u0438 \u043a\u043e\u043d\u043d\u0435\u043a\u0442\u043e\u0440\u044b, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043f\u043e\u0441\u0442\u0430\u0432\u043b\u044f\u044e\u0442\u0441\u044f \u0432 \u0432\u0438\u0434\u0435 <strong>starter<\/strong>-\u043e\u0432, \u0438 \u0432 \u043a\u043e\u0442\u043e\u0440\u044b\u0445 \u0435\u0441\u0442\u044c \u043a\u043e\u043d\u043a\u0440\u0435\u0442\u043d\u0430\u044f \u0438\u043c\u043f\u043b\u0435\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u044f \u0434\u043b\u044f \u043a\u043e\u043d\u043a\u0440\u0435\u0442\u043d\u044b\u0445 \u0440\u0435\u0448\u0435\u043d\u0438\u0439. \u0421\u0445\u0435\u043c\u0430\u0442\u0438\u0447\u043d\u043e \u043c\u044b \u043c\u043e\u0436\u0435\u043c \u0438\u0437\u043e\u0431\u0440\u0430\u0437\u0438\u0442\u044c \u044d\u0442\u043e \u0442\u0430\u043a: <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/files\/8b0\/a3b\/f8d\/8b0a3bf8d1e24f5a8d5f8c5d64b9b4b7.png\" alt=\"spring-cloud-scheme\"\/><br \/>  \u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0435\u0441\u043b\u0438 \u043c\u044b \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0438\u043c \u0441\u0442\u0430\u0440\u0442\u0435\u0440 \u0434\u043b\u044f <strong>Netflix Eureka<\/strong>, \u0442\u043e \u0443 \u043d\u0430\u0441 \u0432 <strong>classpath<\/strong> \u0431\u0443\u0434\u0435\u0442 \u043e\u0434\u043d\u0430 \u0444\u0430\u0431\u0440\u0438\u0447\u043d\u0430\u044f \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u044f. \u0415\u0441\u043b\u0438 \u0436\u0435 \u0441\u0442\u0430\u0440\u0442\u0435\u0440 \u0434\u043b\u044f <strong>Consul<\/strong>-\u0430, \u0442\u043e \u0434\u0440\u0443\u0433\u0430\u044f. <\/p>\n<p>  <\/p>\n<p>\u0417\u0430\u0441\u0430\u0434\u0430 \u0442\u0443\u0442 \u043e\u0434\u043d\u0430\u043a\u043e \u0432 \u0442\u043e\u043c, \u0447\u0442\u043e \u0441\u0430\u043c\u0430 \u043f\u043e \u0441\u0435\u0431\u0435 \u0430\u043d\u043d\u043e\u0442\u0430\u0446\u0438\u044f, \u043f\u0440\u0438 \u043f\u0440\u043e\u043c\u044b\u0448\u043b\u0435\u043d\u043d\u043e\u0439, \u0430 \u043d\u0435 &quot;\u0445\u044d\u043b\u043b\u043e\u0443\u0432\u043e\u0440\u043b\u0434&quot; \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u043a\u0435, \u0447\u0443\u0442\u044c \u043c\u0435\u043d\u0435\u0435 \u0447\u0435\u043c \u043f\u043e\u043b\u043d\u043e\u0441\u0442\u044c\u044e \u0431\u0435\u0441\u043f\u043e\u043b\u0435\u0437\u043d\u0430, \u043f\u043e\u0441\u043a\u043e\u043b\u044c\u043a\u0443 \u0432\u0435\u0441\u044c \u043f\u0440\u043e\u0444\u0438\u0442 \u043d\u0430\u0445\u043e\u0434\u0438\u0442\u0441\u044f \u0432 \u043e\u0431\u043b\u0430\u0441\u0442\u0438 \u043f\u0440\u043e\u043f\u0438\u0441\u044b\u0432\u0430\u043d\u0438\u044f \u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u044b\u0445 \u043d\u0430\u0441\u0442\u0440\u043e\u0435\u043a \u0432 <strong>bootstap.yml<\/strong>. \u0418 \u0434\u043b\u044f \u043a\u0430\u0436\u0434\u043e\u0433\u043e \u043a\u043e\u043d\u043d\u0435\u043a\u0442\u043e\u0440\u0430 \u043e\u043d\u0438, \u043a\u0430\u043a \u0432\u044b \u0443\u0436\u0435 \u043d\u0430\u0432\u0435\u0440\u043d\u043e\u0435 \u0434\u043e\u0433\u0430\u0434\u0430\u043b\u0438\u0441\u044c, \u0441\u0432\u043e\u0438.<\/p>\n<p>  <\/p>\n<p>\u041f\u043e\u0447\u0435\u043c\u0443 \u0442\u0430\u043a \u0441\u0434\u0435\u043b\u0430\u043d\u043e \u043f\u043e\u043d\u044f\u0442\u044c \u043d\u0435\u0441\u043b\u043e\u0436\u043d\u043e. <strong>Eureka<\/strong>, <strong>Consul<\/strong> \u0438 <strong>Marathon<\/strong> \u0443\u0441\u0442\u0440\u043e\u0435\u043d\u044b \u0441\u043e\u0432\u0435\u0440\u0448\u0435\u043d\u043d\u043e \u043f\u043e \u0440\u0430\u0437\u043d\u043e\u043c\u0443. \u041a \u043d\u0438\u043c \u043d\u0443\u0436\u043d\u043e \u043f\u043e \u0440\u0430\u0437\u043d\u043e\u043c\u0443 \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0430\u0442\u044c\u0441\u044f. \u0423 \u043d\u0438\u0445 \u0440\u0430\u0437\u043d\u044b\u0439 API \u0438 \u0444\u0438\u0447\u0438, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0441\u043f\u0435\u0446\u0438\u0444\u0438\u0447\u043d\u044b \u0434\u043b\u044f \u043a\u043e\u043d\u043a\u0440\u0435\u0442\u043d\u043e\u0433\u043e \u0440\u0435\u0448\u0435\u043d\u0438\u044f. \u0421\u0434\u0435\u043b\u0430\u0442\u044c \u0443\u043d\u0438\u0432\u0435\u0440\u0441\u0430\u043b\u044c\u043d\u044b\u0439 \u043a\u043e\u043d\u0444\u0438\u0433 \u043d\u0435\u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e, \u0434\u0430 \u0438 \u0432 \u043e\u0431\u0449\u0435\u043c-\u0442\u043e \u043d\u0435\u0437\u0430\u0447\u0435\u043c.<\/p>\n<p>  <\/p>\n<p>\u041e\u0434\u043d\u0430\u043a\u043e \u0432\u0435\u0440\u043d\u0451\u043c\u0441\u044f \u043a \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u0438, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u0442\u044f\u043d\u0435\u0442\u0441\u044f \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e <strong>@EnableDiscoveryClient<\/strong>. \u0418 \u043f\u0435\u0440\u0432\u043e\u0435 \u0447\u0442\u043e \u043f\u0440\u0438\u0445\u043e\u0434\u0438\u0442 \u0432 \u0433\u043e\u043b\u043e\u0432\u0443, \u0438 \u0447\u0442\u043e \u0431\u044b\u0441\u0442\u0440\u043e \u043d\u0430\u0445\u043e\u0434\u0438\u0442\u0441\u044f \u0447\u0435\u0440\u0435\u0437 \u043f\u043e\u0438\u0441\u043a \u0432 \u043b\u044e\u0431\u0438\u043c\u043e\u0439 IDE, \u044d\u0442\u043e \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441\u0430 <strong>DiscoverClient<\/strong>. \u0421\u0430\u043c\u044b\u0439 \u0433\u043b\u0430\u0432\u043d\u044b\u0439 (\u043f\u043e \u043a\u0440\u0430\u0439\u043d\u0435\u0439 \u043c\u0435\u0440\u0435 \u043d\u0430 \u043f\u0435\u0440\u0432\u044b\u0439 \u0432\u0437\u0433\u043b\u044f\u0434) \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441 \u0432\u044b\u0433\u043b\u044f\u0434\u0438\u0442 \u0442\u0430\u043a:<\/p>\n<p>  <\/p>\n<pre><code class=\"java\">public interface DiscoveryClient {     public String description();     public ServiceInstance getLocalServiceInstance();     public List&lt;ServiceInstance&gt; getInstances(String serviceId);     public List&lt;String&gt; getServices(); }<\/code><\/pre>\n<p>  <\/p>\n<p>\u0412 \u043f\u0440\u0438\u043d\u0446\u0438\u043f\u0435, \u0442\u0443\u0442 \u0432\u0441\u0451 \u0434\u043e\u0432\u043e\u043b\u044c\u043d\u043e \u043e\u0447\u0435\u0432\u0438\u0434\u043d\u043e. \u041c\u044b \u043c\u043e\u0436\u0435\u043c \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u043e\u043f\u0438\u0441\u0430\u043d\u0438\u0435 \u0434\u043b\u044f <strong>HealthIndicator<\/strong>-\u0430. \u041c\u043e\u0436\u0435\u043c \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u0441\u0430\u043c\u0438 \u0441\u0435\u0431\u044f. \u041c\u043e\u0436\u0435\u043c \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u0432\u0441\u0435 \u0438\u043d\u0441\u0442\u0430\u043d\u0441\u044b \u043f\u043e \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u043e\u043c\u0443 \u0438\u0434\u0435\u043d\u0442\u0438\u0444\u0438\u043a\u0430\u0442\u043e\u0440\u0443 \u0441\u0435\u0440\u0432\u0438\u0441\u0430. \u0418, \u043d\u0430\u043a\u043e\u043d\u0435\u0446, \u043c\u043e\u0436\u0435\u043c \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u0441\u043f\u0438\u0441\u043e\u043a \u0432\u0441\u0435\u0445 \u0438\u0437\u0432\u0435\u0441\u0442\u043d\u044b\u0445 \u0441\u0435\u0440\u0432\u0438\u0441\u043e\u0432 (\u0442\u043e\u0447\u043d\u0435\u0435 \u0438\u0445 \u0438\u0434\u0435\u043d\u0442\u0438\u0444\u0438\u043a\u0430\u0442\u043e\u0440\u043e\u0432).<\/p>\n<p>  <\/p>\n<p>\u0421\u0430\u043c\u043e\u0435 \u0432\u0440\u0435\u043c\u044f \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u0442\u044c \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441 \u0434\u043b\u044f \u0442\u043e\u0433\u043e, \u0447\u0442\u043e\u0431\u044b \u043f\u043e\u043b\u0443\u0447\u0430\u0442\u044c \u0434\u0430\u043d\u043d\u044b\u0435 \u0438\u0437 <strong>Marathon<\/strong>-\u0430.<\/p>\n<p>  <\/p>\n<h2 id=\"pervaya-krov\">\u041f\u0435\u0440\u0432\u0430\u044f \u043a\u0440\u043e\u0432\u044c<\/h2>\n<p>  <\/p>\n<p>\u041a\u0430\u043a \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u0434\u0430\u043d\u043d\u044b\u0435? \u042d\u0442\u043e \u043f\u0435\u0440\u0432\u044b\u0439 \u0432\u043e\u043f\u0440\u043e\u0441, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043d\u0430\u043c \u043d\u0443\u0436\u043d\u043e \u0440\u0435\u0448\u0438\u0442\u044c. \u0418 \u044d\u0442\u043e \u043d\u0435 \u0442\u043e, \u0447\u0442\u043e\u0431\u044b \u0442\u0440\u0443\u0434\u043d\u043e.<\/p>\n<p>  <\/p>\n<p>\u0412\u043e-\u043f\u0435\u0440\u0432\u044b\u0445, \u0443 \u043d\u0435\u0433\u043e \u0435\u0441\u0442\u044c \u043c\u043e\u0449\u043d\u044b\u0439 <a href=\"https:\/\/mesosphere.github.io\/marathon\/api-console\/index.html\"><strong>API<\/strong><\/a>. \u0412\u043e-\u0432\u0442\u043e\u0440\u044b\u0445, \u0435\u0441\u0442\u044c \u0443\u0436\u0435 \u0433\u043e\u0442\u043e\u0432\u044b\u0439 \u0434\u043b\u044f <strong>Java<\/strong> <a href=\"https:\/\/github.com\/mesosphere\/marathon-client\"><strong>SDK<\/strong><\/a>.<\/p>\n<p>  <\/p>\n<p>\u0411\u0435\u0440\u0451\u043c \u043d\u043e\u0433\u0438 \u0432 \u0440\u0443\u043a\u0438 \u0438 \u0440\u0435\u0430\u043b\u0438\u0437\u0443\u0435\u043c \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u0435 \u0441\u043f\u0438\u0441\u043a\u0430 \u0432\u0441\u0435\u0445 \u0441\u0435\u0440\u0432\u0438\u0441\u043e\u0432:<\/p>\n<p>  <\/p>\n<pre><code class=\"java\">@Override public List&lt;String&gt; getServices() {     try {         return client.getApps()                 .getApps() \/\/\u0442\u0430\u0432\u0442\u043e\u043b\u043e\u0433\u0438\u044f, \u043d\u043e \u0447\u0442\u043e \u043f\u043e\u0434\u0435\u043b\u0430\u0442\u044c                 .parallelStream()                 .map(App::getId) \/\/\u043f\u043e\u043b\u0443\u0447\u0430\u0435\u043c \u0438\u0434\u0435\u043d\u0442\u0438\u0444\u0438\u043a\u0430\u0442\u043e\u0440\u044b                 .map(ServiceIdConverter::convertToServiceId) \/\/\u043d\u0435\u043c\u043d\u043e\u0433\u043e \u043c\u0430\u0433\u0438\u0438 \u043d\u0435 \u043f\u043e\u043c\u0435\u0448\u0430\u0435\u0442                 .collect(Collectors.toList());     } catch (MarathonException e) {         return Collections.emptyList();     } }<\/code><\/pre>\n<p>  <\/p>\n<p>\u041d\u0438\u043a\u0430\u043a\u043e\u0439 \u043c\u0430\u0433\u0438\u0438 \u0437\u0430 \u0438\u0441\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435\u043c <code>ServiceIdConverter::convertToServiceId<\/code>. \u0427\u0442\u043e \u044d\u0442\u043e \u0437\u0430 \u0441\u0442\u0440\u0430\u043d\u043d\u044b\u0439 \u043a\u043e\u043d\u0432\u0435\u0440\u0442\u0435\u0440 \u0441\u043f\u0440\u043e\u0441\u0438\u0442\u0435 \u0432\u044b. \u0418 \u0442\u0443\u0442 \u043d\u0430\u0434\u043e \u0441\u043a\u0430\u0437\u0430\u0442\u044c \u043e\u0431 \u043e\u0434\u043d\u043e\u0439 \u043e\u0441\u043e\u0431\u0435\u043d\u043d\u043e\u0441\u0442\u0438 \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u0438\u044f \u0438\u0434\u0435\u043d\u0442\u0438\u0444\u0438\u043a\u0430\u0442\u043e\u0440\u043e\u0432 \u0441\u0435\u0440\u0432\u0438\u0441\u043e\u0432 \u0432 <strong>Marathon<\/strong>-\u0435. \u0412 \u043e\u0431\u0449\u0435\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u043e\u043d\u0438 \u043f\u043e\u0434\u0447\u0438\u043d\u044f\u044e\u0442\u0441\u044f \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u043c\u0443 \u0448\u0430\u0431\u043b\u043e\u043d\u0443:<\/p>\n<p>  <\/p>\n<pre><code>\/group\/path\/app<\/code><\/pre>\n<p>  <\/p>\n<p>\u043d\u043e \u0441\u0438\u043c\u0432\u043e\u043b <code>\/<\/code> \u043d\u0435 \u043c\u043e\u0436\u0435\u0442 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c\u0441\u044f \u0434\u043b\u044f \u043f\u043e\u0441\u0442\u0440\u043e\u0435\u043d\u0438\u044f \u0432\u0438\u0440\u0442\u0443\u0430\u043b\u044c\u043d\u043e\u0433\u043e \u0445\u043e\u0441\u0442\u0430. \u0418, \u0442\u0430\u043a\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c, \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0447\u0430\u0441\u0442\u0438 <strong>Spring Cloud<\/strong>-\u0430, \u0432 \u043a\u043e\u0442\u043e\u0440\u044b\u0445 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f \u0438\u0434\u0435\u043d\u0442\u0438\u0444\u0438\u043a\u0430\u0442\u043e\u0440 \u0441\u0435\u0440\u0432\u0438\u0441\u0430 \u0432 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 \u0432\u0438\u0440\u0442\u0443\u0430\u043b\u044c\u043d\u043e\u0433\u043e \u0445\u043e\u0441\u0442\u0430, \u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c \u043d\u0435 \u0431\u0443\u0434\u0443\u0442. \u041f\u043e\u044d\u0442\u043e\u043c\u0443 \u0432\u043c\u0435\u0441\u0442\u043e <code>\/<\/code> \u0431\u0443\u0434\u0435\u043c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0434\u0440\u0443\u0433\u043e\u0439 \u0440\u0430\u0437\u0434\u0435\u043b\u0438\u0442\u0435\u043b\u044c, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0440\u0430\u0437\u0440\u0435\u0448\u0451\u043d \u043f\u0440\u0438\u0441\u0443\u0442\u0441\u0442\u0432\u043e\u0432\u0430\u0442\u044c \u0432 \u0438\u043c\u0435\u043d\u0438 \u0445\u043e\u0441\u0442\u0430, \u0430 \u0438\u043c\u0435\u043d\u043d\u043e \u0442\u043e\u0447\u043a\u0443. \u0418\u043c\u0435\u043d\u043d\u043e \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u043c\u044b \u0432\u044b\u043d\u0443\u0436\u0434\u0435\u043d\u044b \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0438\u0435 <code>\/group\/path\/app<\/code> \u043d\u0430 <code>group.path.app<\/code>. \u0427\u0442\u043e \u0441\u043e\u0431\u0441\u0442\u0432\u0435\u043d\u043d\u043e \u043a\u043e\u043d\u0432\u0435\u0440\u0442\u0435\u0440 \u0438 \u0434\u0435\u043b\u0430\u0435\u0442.<\/p>\n<p>  <\/p>\n<p>\u041f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u0435 \u0432\u0441\u0435\u0445 \u0438\u043d\u0441\u0442\u0430\u043d\u0441\u043e\u0432 \u0441\u0435\u0440\u0432\u0438\u0441\u0430 \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u043d\u043e \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0441\u043b\u043e\u0436\u043d\u0435\u0435, \u043d\u043e \u0442\u043e\u0436\u0435 \u043d\u0438\u043a\u0430\u043a\u043e\u0433\u043e \u0440\u0430\u043a\u0435\u0442\u043e\u0441\u0442\u0440\u043e\u0435\u043d\u0438\u044f:<\/p>\n<p>  <\/p>\n<pre><code class=\"java\">@Override public List&lt;ServiceInstance&gt; getInstances(String serviceId) {     try {         return client.getAppTasks(ServiceIdConverter.convertToMarathonId(serviceId))                 .getTasks()                 .parallelStream()                 .filter(task -&gt; null == task.getHealthCheckResults() || \/\/health-\u0447\u0435\u043a\u043e\u0432 \u043d\u0435\u0442, \u043d\u0443 \u0438 \u043b\u0430\u0434\u043d\u043e                         task.getHealthCheckResults()                         .stream()                         .allMatch(HealthCheckResult::isAlive) \/\/\u0432\u0441\u0435 \u0434\u043e\u043b\u0436\u043d\u044b \u0431\u044b\u0442\u044c \u0436\u0438\u0432\u044b                 )                 .map(task -&gt; new DefaultServiceInstance(                         ServiceIdConverter.convertToServiceId(task.getAppId()),                         task.getHost(),                         task.getPorts().stream().findFirst().orElse(0), \/\/magi\u0441 zero                         false                 ))                 .collect(Collectors.toList());     } catch (MarathonException e) {         log.error(e.getMessage(), e);         return Collections.emptyList();     } }<\/code><\/pre>\n<p>  <\/p>\n<p>\u041e\u0441\u043d\u043e\u0432\u043d\u043e\u0435, \u0447\u0442\u043e \u043d\u0430\u043c \u043d\u0443\u0436\u043d\u043e \u043f\u0440\u043e\u0432\u0435\u0440\u0438\u0442\u044c, \u044d\u0442\u043e \u0442\u043e, \u0447\u0442\u043e \u0434\u043b\u044f \u0441\u0435\u0440\u0432\u0438\u0441\u0430 \u043f\u0440\u043e\u0448\u043b\u0438 \u0432\u0441\u0435 <strong>health-\u0447\u0435\u043a\u0438<\/strong>: <code>HealthCheckResult::isAlive<\/code>, \u0432\u0435\u0434\u044c \u043d\u0430\u0448\u0430 \u0437\u0430\u0434\u0430\u0447\u0430 \u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c \u0442\u043e\u043b\u044c\u043a\u043e \u0441 \u0442\u0435\u043c\u0438, \u043a\u0442\u043e \u0436\u0438\u0432. \u041c\u0435\u0445\u0430\u043d\u0438\u0437\u043c <strong>health-\u0447\u0435\u043a\u043e\u0432<\/strong> \u043f\u0440\u0435\u0434\u043e\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0441\u0430\u043c\u0438\u043c <strong>Marathon<\/strong>-\u043d\u043e\u043c, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0434\u0430\u0451\u0442 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044c \u0438\u0445 \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0438 \u0438 \u0441\u0430\u043c \u0436\u0435 \u0441\u043b\u0435\u0434\u0438\u0442 \u0437\u0430 \u0437\u0434\u043e\u0440\u043e\u0432\u044c\u0435\u043c \u0432\u0432\u0435\u0440\u0435\u043d\u043d\u044b\u0445 \u0435\u043c\u0443 \u0441\u0435\u0440\u0432\u0438\u0441\u043e\u0432, \u0440\u0430\u0437\u0434\u0430\u0432\u0430\u044f \u0431\u0435\u0437\u0432\u043e\u0437\u043c\u0435\u0437\u0434\u043d\u043e \u044d\u0442\u0443 \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u044e \u0447\u0435\u0440\u0435\u0437 API.<\/p>\n<p>  <\/p>\n<p>\u041f\u043e\u043c\u0438\u043c\u043e \u044d\u0442\u043e\u0433\u043e, \u043d\u0430\u043c \u043d\u0443\u0436\u043d\u043e \u043d\u0435 \u0437\u0430\u0431\u044b\u0442\u044c \u043e\u043f\u044f\u0442\u044c \u0436\u0435 \u0441\u043a\u043e\u043d\u0432\u0435\u0440\u0442\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0438\u0434\u0435\u043d\u0442\u0438\u0444\u0438\u043a\u0430\u0442\u043e\u0440 \u0432 \u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u043e\u0435 \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u0438\u0435 \u0438 \u0432\u044b\u0431\u0440\u0430\u0442\u044c \u0442\u043e\u043b\u044c\u043a\u043e \u043e\u0434\u0438\u043d, \u043f\u0435\u0440\u0432\u044b\u0439, \u043f\u043e\u0440\u0442: <code>task.getPorts().stream().findFirst().orElse(0)<\/code>.<\/p>\n<p>  <\/p>\n<p>\u0422\u0430\u043a \u0442\u0430\u043a \u0442\u0430\u043a, \u0441\u043a\u0430\u0436\u0435\u0442\u0435 \u0432\u044b. \u0410 \u0447\u0442\u043e \u0436\u0435 \u0434\u0435\u043b\u0430\u0442\u044c, \u0435\u0441\u043b\u0438 \u043f\u043e\u0440\u0442\u043e\u0432 \u0443 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e? \u041a \u0441\u043e\u0436\u0430\u043b\u0435\u043d\u0438\u044e, \u0432\u044b\u0431\u043e\u0440 \u0443 \u043d\u0430\u0441 \u043d\u0435\u0432\u0435\u043b\u0438\u043a. \u041c\u044b \u0441 \u043e\u0434\u043d\u043e\u0439 \u0441\u0442\u043e\u0440\u043e\u043d\u044b \u0434\u043e\u043b\u0436\u043d\u044b \u0432\u0435\u0440\u043d\u0443\u0442\u044c \u043e\u0431\u044a\u0435\u043a\u0442, \u0440\u0435\u0430\u043b\u0438\u0437\u0443\u044e\u0449\u0438\u0439 \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441 <strong>ServiceInstance<\/strong>, \u0443 \u043a\u043e\u0442\u043e\u0440\u043e\u0433\u043e \u0435\u0441\u0442\u044c \u043c\u0435\u0442\u043e\u0434 <code>getPort<\/code>, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043f\u043e\u043d\u044f\u0442\u043d\u043e\u0435 \u0434\u0435\u043b\u043e \u043c\u043e\u0436\u0435\u0442 \u0432\u0435\u0440\u043d\u0443\u0442\u044c \u0442\u043e\u043b\u044c\u043a\u043e \u043e\u0434\u0438\u043d \u043f\u043e\u0440\u0442. \u0410 \u0441 \u0434\u0440\u0443\u0433\u043e\u0439, \u043c\u044b \u043d\u0430 \u0441\u0430\u043c\u043e\u043c \u0434\u0435\u043b\u0435 \u043d\u0435 \u0437\u043d\u0430\u0435\u043c, \u043a\u0430\u043a\u043e\u0439 \u043f\u043e\u0440\u0442 \u0438\u0437 \u0441\u043f\u0438\u0441\u043a\u0430 \u0431\u0440\u0430\u0442\u044c. <strong>Marathon<\/strong> \u043d\u0435 \u0434\u0430\u0451\u0442 \u043d\u0430\u043c \u043e\u0431 \u044d\u0442\u043e\u043c \u043a\u0430\u043a\u043e\u0439-\u043b\u0438\u0431\u043e \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u0438. \u041f\u043e\u044d\u0442\u043e\u043c\u0443 \u0431\u0435\u0440\u0451\u043c \u0442\u043e\u0442, \u0447\u0442\u043e \u0443\u043a\u0430\u0437\u0430\u043d \u043f\u0435\u0440\u0432\u044b\u043c. \u0410\u0432\u043e\u0441\u044c \u043f\u043e\u0432\u0435\u0437\u0451\u0442.<\/p>\n<p>  <\/p>\n<p>\u041c\u043e\u0436\u043d\u043e \u043f\u043e\u043f\u0440\u043e\u0431\u043e\u0432\u0430\u0442\u044c \u0440\u0435\u0448\u0438\u0442\u044c \u044d\u0442\u0443 \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u0443 \u0442\u0430\u043a, \u043a\u0430\u043a \u0440\u0435\u0448\u0430\u0435\u0442 \u0435\u0451 <strong>registrator<\/strong> \u043f\u0440\u0438 \u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0430\u0446\u0438\u0438 \u0441\u0435\u0440\u0432\u0438\u0441\u043e\u0432 \u0432 \u0442\u043e\u043c \u0436\u0435 <strong>Consul<\/strong>-\u0435. \u042d\u0442\u043e \u0443\u0447\u0438\u0442\u044b\u0432\u0430\u0442\u044c \u043f\u043e\u0440\u0442 \u0441\u0435\u0440\u0432\u0438\u0441\u0430 \u0432 \u0435\u0433\u043e \u0438\u0434\u0435\u043d\u0442\u0438\u0444\u0438\u043a\u0430\u0442\u043e\u0440\u0435. \u0422\u043e\u0433\u0434\u0430 \u0438\u0434\u0435\u043d\u0442\u0438\u0444\u0438\u043a\u0430\u0442\u043e\u0440 \u0441\u0435\u0440\u0432\u0438\u0441\u0430 \u0431\u0443\u0434\u0435\u0442 \u043f\u0440\u0438\u043c\u0435\u0440\u043d\u043e \u0442\u0430\u043a\u0438\u043c: <code>group.path.app.8080<\/code> \u0432 \u0441\u043b\u0443\u0447\u0430\u0435, \u0435\u0441\u043b\u0438 \u043f\u043e\u0440\u0442\u043e\u0432 \u0431\u043e\u043b\u044c\u0448\u0435 \u043e\u0434\u043d\u043e\u0433\u043e.<\/p>\n<p>  <\/p>\n<p>\u041d\u0435\u043c\u043d\u043e\u0433\u043e \u043e\u0442\u0432\u043b\u0435\u043a\u043b\u0438\u0441\u044c. \u0421\u0430\u043c\u043e\u0435 \u0432\u0440\u0435\u043c\u044f \u0434\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u043d\u043e\u0432\u043e\u0438\u0441\u043f\u0435\u0447\u0451\u043d\u043d\u0443\u044e \u0438\u043c\u043f\u043b\u0435\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u044e \u043a\u0430\u043a \u0431\u0438\u043d:<\/p>\n<p>  <\/p>\n<pre><code class=\"java\">@Configuration @ConditionalOnMarathonEnabled @ConditionalOnProperty(value = &quot;spring.cloud.marathon.discovery.enabled&quot;, matchIfMissing = true) @EnableConfigurationProperties public class MarathonDiscoveryClientAutoConfiguration {      @Autowired     private Marathon marathonClient;      @Bean     public MarathonDiscoveryProperties marathonDiscoveryProperties() {         return new MarathonDiscoveryProperties();     }      @Bean     @ConditionalOnMissingBean     public MarathonDiscoveryClient marathonDiscoveryClient(MarathonDiscoveryProperties discoveryProperties) {         MarathonDiscoveryClient discoveryClient =                 new MarathonDiscoveryClient(marathonClient, marathonDiscoveryProperties());         return discoveryClient;     } }<\/code><\/pre>\n<p>  <\/p>\n<p>\u0427\u0442\u043e \u0442\u0443\u0442 \u0432\u0430\u0436\u043d\u043e. \u0412\u043e-\u043f\u0435\u0440\u0432\u044b\u0445 \u043c\u044b \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c <strong>conditional<\/strong>-\u0430\u043d\u043d\u043e\u0442\u0430\u0446\u0438\u0438: <code>@ConditionalOnMarathonEnabled<\/code> \u0438 <code>@ConditionalOnProperty<\/code>. \u0422\u043e \u0435\u0441\u0442\u044c, \u0435\u0441\u043b\u0438 \u0432 \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0430\u0445 \u0431\u0443\u0434\u0435\u0442 \u043e\u0442\u043a\u043b\u044e\u0447\u0435\u043d\u0430 \u0444\u0443\u043d\u043a\u0446\u0438\u043e\u043d\u0430\u043b\u044c\u043d\u043e\u0441\u0442\u044c, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440 \u0447\u0435\u0440\u0435\u0437 \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0443 <code>spring.cloud.marathon.discovery.enabled<\/code>, \u0442\u043e \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u044f \u0433\u0440\u0443\u0437\u0438\u0442\u044c\u0441\u044f \u043d\u0435 \u0431\u0443\u0434\u0435\u0442.<\/p>\n<p>  <\/p>\n<p>\u0412\u043e-\u0432\u0442\u043e\u0440\u044b\u0445, \u043d\u0430\u0434 \u043d\u0430\u0448\u0438\u043c \u043a\u043b\u0438\u0435\u043d\u0442\u043e\u043c \u0441\u0442\u043e\u0438\u0442 \u0432\u043e\u043b\u0448\u0435\u0431\u043d\u0430\u044f \u0430\u043d\u043d\u043e\u0442\u0430\u0446\u0438\u044f <code>@ConditionalOnMissingBean<\/code>, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u0434\u0430\u0451\u0442 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044c \u0432 \u043a\u043e\u043d\u043a\u0440\u0435\u0442\u043d\u043e\u043c \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0438 \u043f\u0435\u0440\u0435\u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0438\u0442\u044c \u0431\u0438\u043d \u0442\u0430\u043a, \u043a\u0430\u043a \u044d\u0442\u043e \u0431\u0443\u0434\u0435\u0442 \u043d\u0443\u0436\u043d\u043e \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044e.<\/p>\n<p>  <\/p>\n<p>\u041d\u0430\u043c \u043e\u0441\u0442\u0430\u0451\u0442\u0441\u044f \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u0441\u0430\u043c\u0443\u044e \u043c\u0430\u043b\u043e\u0441\u0442\u044c. \u0421\u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u043a\u043b\u0438\u0435\u043d\u0442\u0430 \u0434\u043b\u044f <strong>Marathon<\/strong>-\u0430. \u041d\u0430\u0438\u0432\u043d\u0430\u044f, \u043d\u043e \u043f\u0440\u0438 \u044d\u0442\u043e\u043c \u0440\u0430\u0431\u043e\u0447\u0430\u044f, \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u0438 \u0432\u044b\u0433\u043b\u044f\u0434\u0438\u0442 \u0442\u0430\u043a:<\/p>\n<p>  <\/p>\n<pre><code>spring:     cloud:         marathon:             scheme: http       #url scheme             host: marathon     #marathon host             port: 8080         #marathon port<\/code><\/pre>\n<p>  <\/p>\n<p>\u0414\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u043d\u0430\u043c \u043d\u0443\u0436\u0435\u043d \u043a\u043b\u0430\u0441\u0441 \u0441 \u0435\u0433\u043e \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0430\u043c\u0438:<\/p>\n<p>  <\/p>\n<pre><code class=\"java\">@ConfigurationProperties(&quot;spring.cloud.marathon&quot;) @Data \/\/lombok is here public class MarathonProperties {     @NotNull     private String scheme = &quot;http&quot;;      @NotNull     private String host = &quot;localhost&quot;;      @NotNull     private int port = 8080;      private String endpoint = null;      public String getEndpoint() {         if (null != endpoint) {             return endpoint;         }          return this.getScheme() + &quot;:\/\/&quot; + this.getHost() + &quot;:&quot; + this.getPort();     } }<\/code><\/pre>\n<p>  <\/p>\n<p>\u0438 \u043e\u0447\u0435\u043d\u044c \u043f\u043e\u0445\u043e\u0436\u0430\u044f \u043d\u0430 \u043f\u0440\u0435\u0434\u044b\u0434\u0443\u0449\u0443\u044e \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u044f:<\/p>\n<p>  <\/p>\n<pre><code class=\"java\">@Configuration @EnableConfigurationProperties @ConditionalOnMarathonEnabled public class MarathonAutoConfiguration {     @Bean     @ConditionalOnMissingBean     public MarathonProperties marathonProperties() {         return new MarathonProperties();     }      @Bean     @ConditionalOnMissingBean     public Marathon marathonClient(MarathonProperties properties) {         return MarathonClient.getInstance(properties.getEndpoint());     } }<\/code><\/pre>\n<p>  <\/p>\n<p>\u041f\u043e\u0441\u043b\u0435 \u044d\u0442\u043e\u0433\u043e \u043c\u044b \u043c\u043e\u0436\u0435\u043c \u0440\u0430\u0434\u043e\u0441\u0442\u043d\u043e \u0438\u0434\u0442\u0438 \u0432 \u043d\u0430\u0448\u0435 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435, \u0437\u0430\u0430\u0432\u0442\u043e\u0432\u0430\u0439\u0440\u0438\u0442\u044c <code>DiscoveryClient<\/code>:<\/p>\n<p>  <\/p>\n<pre><code class=\"java\">@Autowired private DiscoveryClient discoveryClient;<\/code><\/pre>\n<p>  <\/p>\n<p>\u0438, \u043a \u043f\u0440\u0438\u043c\u0435\u0440\u0443, \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u0441\u043f\u0438\u0441\u043e\u043a \u0432\u0441\u0435\u0445 \u0438\u043d\u0441\u0442\u0430\u043d\u0441\u043e\u0432 \u0434\u043b\u044f \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u043e\u0433\u043e \u0441\u0435\u0440\u0432\u0438\u0441\u0430:<\/p>\n<p>  <\/p>\n<pre><code class=\"java\">@RequestMapping(&quot;\/instances&quot;) public List&lt;ServiceInstance&gt; instances() {     return discoveryClient.getInstances(&quot;someservice&quot;); }<\/code><\/pre>\n<p>  <\/p>\n<p>\u0418 \u0442\u0443\u0442 \u043d\u0430\u0441 \u043e\u0436\u0438\u0434\u0430\u0435\u0442 \u043f\u0435\u0440\u0432\u044b\u0439 \u0441\u044e\u0440\u043f\u0440\u0438\u0437. \u041d\u0430\u0448\u0430 \u0446\u0435\u043b\u044c \u0432\u0435\u0434\u044c \u043d\u0435 \u0432 \u0442\u043e\u043c, \u0447\u0442\u043e\u0431\u044b \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u0441\u043f\u0438\u0441\u043e\u043a \u0438\u043d\u0441\u0442\u0430\u043d\u0441\u043e\u0432, \u0430 \u0432 \u0442\u043e\u043c, \u0447\u0442\u043e\u0431\u044b \u0434\u0435\u043b\u0430\u0442\u044c \u0431\u0430\u043b\u0430\u043d\u0441\u0438\u0440\u043e\u0432\u043a\u0443 \u043c\u0435\u0436\u0434\u0443 \u043d\u0438\u043c\u0438. \u0418 \u043e\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u0442\u0441\u044f, \u0447\u0442\u043e <code>DiscoveryClient<\/code> \u0434\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u043d\u0435 \u0442\u043e \u0447\u0442\u043e\u0431\u044b \u0441\u0438\u043b\u044c\u043d\u043e \u043f\u043e\u043b\u0435\u0437\u0435\u043d, \u043f\u043e\u0442\u043e\u043c\u0443 \u0447\u0442\u043e \u043f\u0440\u043e\u0441\u0442\u043e \u043d\u0430\u043f\u0440\u043e\u0441\u0442\u043e \u043d\u0438\u043a\u0430\u043a \u0432 \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 \u0431\u0430\u043b\u0430\u043d\u0441\u0438\u0440\u043e\u0432\u043a\u0438 \u043d\u0435 \u0443\u0447\u0430\u0441\u0442\u0432\u0443\u0435\u0442. \u041e\u043a, \u0432\u0440\u0443. \u041d\u0435\u043c\u043d\u043e\u0433\u043e \u0443\u0447\u0430\u0441\u0442\u0432\u0443\u0435\u0442, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440 \u043f\u0440\u0438 \u0434\u0438\u043d\u0430\u043c\u0438\u0447\u0435\u0441\u043a\u043e\u0439 \u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0430\u0446\u0438\u0438 <strong>endpoint<\/strong>-\u043e\u0432 \u0432 <strong>Zuul<\/strong>-\u0435. \u0415\u0449\u0451 \u043e\u043d \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f \u0434\u043b\u044f <strong>health<\/strong>-\u0438\u043d\u0434\u0438\u043a\u0430\u0442\u043e\u0440\u043e\u0432. \u041d\u043e \u044d\u0442\u043e \u0432 \u043f\u0440\u0438\u043d\u0446\u0438\u043f\u0435 \u0432\u0441\u0451 \u0435\u0433\u043e \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u043e\u0435 \u043f\u0440\u0438\u043c\u0435\u043d\u0435\u043d\u0438\u0435. \u041d\u0435 \u0442\u0430\u043a \u0443\u0436 \u043c\u043d\u043e\u0433\u043e \u043f\u0440\u0430\u0432\u0434\u0430?<\/p>\n<p>  <\/p>\n<h2 id=\"itogo\">\u0418\u0442\u043e\u0433\u043e<\/h2>\n<p>  <\/p>\n<p>\u041c\u044b \u0441\u043c\u043e\u0433\u043b\u0438 \u043f\u0440\u043e\u0438\u043d\u0442\u0435\u0433\u0440\u0438\u0440\u043e\u0432\u0430\u0442\u044c\u0441\u044f \u0441 <strong>Marathon<\/strong>-\u043e\u043c. \u042d\u0442\u043e \u0445\u043e\u0440\u043e\u0448\u043e. \u041c\u044b \u0434\u0430\u0436\u0435 \u043c\u043e\u0436\u0435\u043c \u0442\u0435\u043f\u0435\u0440\u044c \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u0441\u043f\u0438\u0441\u043e\u043a \u0441\u0435\u0440\u0432\u0438\u0441\u043e\u0432 \u0438 \u0438\u0445 \u0438\u043d\u0441\u0442\u0430\u043d\u0441\u043e\u0432.<\/p>\n<p>  <\/p>\n<p>\u041d\u043e \u0432\u043c\u0435\u0441\u0442\u0435 \u0441 \u0442\u0435\u043c, \u0443 \u043d\u0430\u0441 \u043e\u0441\u0442\u0430\u043b\u0438\u0441\u044c \u043a\u0430\u043a \u043c\u0438\u043d\u0438\u043c\u0443\u043c \u0434\u0432\u0435 \u043d\u0435\u0440\u0435\u0448\u0451\u043d\u043d\u044b\u0435 \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u044b. \u041f\u0435\u0440\u0432\u0430\u044f \u0441\u0432\u044f\u0437\u0430\u043d\u0430 \u0441 \u0442\u0435\u043c, \u0447\u0442\u043e \u0443 \u043d\u0430\u0441 \u0432 \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u0438 \u0443\u043a\u0430\u0437\u0430\u043d \u043b\u0438\u0448\u044c \u043e\u0434\u0438\u043d \u0438\u043d\u0441\u0442\u0430\u043d\u0441 \u043c\u0430\u0441\u0442\u0435\u0440\u0430 <strong>Marathon<\/strong>-\u0430 \u0434\u043b\u044f \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u044f. \u0415\u0441\u043b\u0438 \u043e\u043d \u0443\u043f\u0430\u0434\u0451\u0442, \u0442\u043e \u043c\u044b \u043f\u0435\u0440\u0435\u0441\u0442\u0430\u043d\u0435\u043c \u0432\u043b\u0430\u0434\u0435\u0442\u044c \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u0435\u0439, \u0430 \u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u043e \u0438 \u043c\u0438\u0440\u043e\u043c.<\/p>\n<p>  <\/p>\n<p>\u0412\u0442\u043e\u0440\u0430\u044f \u2014 \u043c\u044b \u0442\u0430\u043a \u0438 \u043d\u0435 \u0434\u043e\u0431\u0440\u0430\u043b\u0438\u0441\u044c \u0434\u043e \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 \u043a\u043b\u0438\u0435\u043d\u0442\u0441\u043a\u043e\u0439 \u0431\u0430\u043b\u0430\u043d\u0441\u0438\u0440\u043e\u0432\u043a\u0438 \u0438 \u0432 \u0440\u0443\u043a\u0430\u0445 \u0443 \u043d\u0430\u0441 \u043f\u043e\u043a\u0430 \u0447\u0442\u043e \u0434\u0435\u0442\u0441\u043a\u0430\u044f \u0438\u0433\u0440\u0443\u0448\u043a\u0430, \u0430 \u043d\u0435 \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442 \u0440\u0435\u0448\u0430\u044e\u0449\u0438\u0439 \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u044b.<\/p>\n<p>  <\/p>\n<h4 id=\"prodolzhenie-sleduet\">\u041f\u0440\u043e\u0434\u043e\u043b\u0436\u0435\u043d\u0438\u0435 \u0441\u043b\u0435\u0434\u0443\u0435\u0442<\/h4>\n<p> \u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b \u0441\u0442\u0430\u0442\u044c\u0438 <a href=\"https:\/\/habrahabr.ru\/post\/325714\/\"> https:\/\/habrahabr.ru\/post\/325714\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u041f\u0440\u0438 \u043f\u0435\u0440\u0435\u0445\u043e\u0434\u0435 \u043a \u0440\u0430\u0441\u043f\u0440\u0435\u0434\u0435\u043b\u0451\u043d\u043d\u044b\u043c \u0441\u0438\u0441\u0442\u0435\u043c\u0430\u043c \u0441 \u0431\u043e\u043b\u044c\u0448\u0438\u043c \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e\u043c \u0438\u043d\u0441\u0442\u0430\u043d\u0441\u043e\u0432 \u0441\u0435\u0440\u0432\u0438\u0441\u043e\u0432 \u0432 \u043f\u043e\u043b\u043d\u044b\u0439 \u0440\u043e\u0441\u0442 \u0432\u0441\u0442\u0430\u044e\u0442 \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u044b \u0438\u0445 \u043e\u0431\u043d\u0430\u0440\u0443\u0436\u0435\u043d\u0438\u044f (<strong>service discovery<\/strong>) \u0438 \u0431\u0430\u043b\u0430\u043d\u0441\u0438\u0440\u043e\u0432\u043a\u0438 \u0437\u0430\u043f\u0440\u043e\u0441\u043e\u0432 (<strong>load balancing<\/strong>) \u043c\u0435\u0436\u0434\u0443 \u043d\u0438\u043c\u0438. \u041a\u0430\u043a \u043f\u0440\u0430\u0432\u0438\u043b\u043e, \u0434\u043b\u044f \u0438\u0445 \u0440\u0435\u0448\u0435\u043d\u0438\u044f \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044e\u0442\u0441\u044f \u0442\u0430\u043a\u0438\u0435 \u0441\u043f\u0435\u0446\u0438\u0430\u043b\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0435 \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442\u044b \u043a\u0430\u043a <a href=\"https:\/\/www.consul.io\/\"><strong>Consul<\/strong><\/a>, <a href=\"https:\/\/github.com\/Netflix\/eureka\"><strong>Eureka<\/strong><\/a> \u0438\u043b\u0438 \u0441\u0442\u0430\u0440\u044b\u0439 \u0434\u043e\u0431\u0440\u044b\u0439 <a href=\"https:\/\/zookeeper.apache.org\/\"><strong>Zookeeper<\/strong><\/a>, \u0432 \u0441\u043e\u0447\u0435\u0442\u0430\u043d\u0438\u0438 \u0441 <strong>Nginx<\/strong>, <strong>HAProxy<\/strong> \u0438 \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u043c \u043c\u043e\u0441\u0442\u043e\u043c \u043c\u0435\u0436\u0434\u0443 \u043d\u0438\u043c\u0438 (\u0441\u043c. <a href=\"https:\/\/github.com\/gliderlabs\/registrator\"><strong>registrator<\/strong><\/a>).<\/p>\n<p>  <\/p>\n<p>\u041e\u0441\u043d\u043e\u0432\u043d\u0430\u044f \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u0430 \u0432 \u043f\u043e\u0434\u043e\u0431\u043d\u043e\u043c \u043f\u043e\u0434\u0445\u043e\u0434\u0435 \u044d\u0442\u043e \u0431\u043e\u043b\u044c\u0448\u043e\u0435 \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u0438\u043d\u0442\u0435\u0433\u0440\u0430\u0446\u0438\u0439, \u0438, \u043a\u0430\u043a \u0441\u043b\u0435\u0434\u0441\u0442\u0432\u0438\u0435, \u0442\u043e\u0447\u0435\u043a \u0433\u0434\u0435 \u0447\u0442\u043e-\u0442\u043e \u043c\u043e\u0436\u0435\u0442 \u043f\u043e\u0439\u0442\u0438 \u043d\u0435 \u0442\u0430\u043a. \u0412\u0435\u0434\u044c \u043f\u043e\u043c\u0438\u043c\u043e \u0432\u044b\u0448\u0435\u0443\u043f\u043e\u043c\u044f\u043d\u0443\u0442\u044b\u0445 \u0440\u0435\u0448\u0435\u043d\u0438\u0439 \u043d\u0430\u0432\u0435\u0440\u043d\u044f\u043a\u0430 \u0431\u0443\u0434\u0435\u0442 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c\u0441\u044f \u043b\u043e\u043a\u0430\u043b\u044c\u043d\u044b\u0439 \u043c\u0430\u043b\u0435\u043d\u044c\u043a\u0438\u0439 <strong>PaaS<\/strong> (\u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440 <a href=\"https:\/\/mesosphere.github.io\/marathon\/\"><strong>Mesosphere Marathon<\/strong><\/a> \u0438\u043b\u0438 <strong>Kubernetes<\/strong>). \u041f\u043e\u0441\u043b\u0435\u0434\u043d\u0438\u0435, \u043a \u0441\u043b\u043e\u0432\u0443, \u0443\u0436\u0435 \u0445\u0440\u0430\u043d\u044f\u0442 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u0443\u044e \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u044e \u043e\u0431 \u043e\u043a\u0440\u0443\u0436\u0435\u043d\u0438\u0438 (\u0432\u0435\u0434\u044c \u0447\u0435\u0440\u0435\u0437 \u043d\u0438\u0445 \u0438\u0434\u0451\u0442 \u0432\u0435\u0441\u044c \u0434\u0435\u043f\u043b\u043e\u0439\u043c\u0435\u043d\u0442). \u0418 \u0432\u0441\u0442\u0430\u0451\u0442 \u0432\u043e\u043f\u0440\u043e\u0441, \u0430 \u043c\u043e\u0436\u0435\u043c \u043b\u0438 \u043c\u044b \u043e\u0442\u043a\u0430\u0437\u0430\u0442\u044c\u0441\u044f \u043e\u0442 \u0441\u043f\u0435\u0446\u0438\u0430\u043b\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0445 \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442\u043e\u0432 \u0434\u043b\u044f <strong>service discovery<\/strong> \u0438 \u043f\u0435\u0440\u0435\u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0442\u043e\u0442 \u0436\u0435 <strong>Marathon<\/strong> \u0434\u043b\u044f \u044d\u0442\u043e\u0439 \u0437\u0430\u0434\u0430\u0447\u0438?<\/p>\n<p>  <\/p>\n<p>\u041a\u0440\u0430\u0442\u043a\u0438\u0439 \u043e\u0442\u0432\u0435\u0442 \u2014 \u043c\u043e\u0436\u0435\u043c. \u0415\u0441\u043b\u0438 \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043d\u043e \u043a\u0430\u043a \u2014 \u0447\u0438\u0442\u0430\u0439\u0442\u0435 \u0434\u0430\u043b\u044c\u0448\u0435.<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[],"tags":[],"class_list":["post-285589","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/285589","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=285589"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/285589\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=285589"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=285589"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=285589"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}