{"id":316075,"date":"2021-01-08T09:00:20","date_gmt":"2021-01-08T09:00:20","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=316075"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=316075","title":{"rendered":"\u041f\u0440\u0430\u043a\u0442\u0438\u0447\u0435\u0441\u043a\u043e\u0435 \u0440\u0443\u043a\u043e\u0432\u043e\u0434\u0441\u0442\u0432\u043e \u043f\u043e HashiCorp Consul \u2014 \u0427\u0430\u0441\u0442\u044c 2"},"content":{"rendered":"\n<div class=\"post__text post__text-html post__text_v1\" id=\"post-content-body\">\n<p><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/r-\/-d\/a0\/r--da0gbyafieifqbiwxezr48a4.jpeg\"><\/p>\n<p>  <\/p>\n<p>\u042d\u0442\u043e \u0432\u0442\u043e\u0440\u0430\u044f \u0447\u0430\u0441\u0442\u044c \u0438\u0437 2 \u0447\u0430\u0441\u0442\u0435\u0439 \u041f\u0440\u0430\u043a\u0442\u0438\u0447\u0435\u0441\u043a\u043e\u0433\u043e \u0440\u0443\u043a\u043e\u0432\u043e\u0434\u0441\u0442\u0432\u0430 \u043f\u043e HashiCorp Consul. <a href=\"https:\/\/habr.com\/ru\/post\/531602\/\">\u041f\u0440\u0435\u0434\u044b\u0434\u0443\u0449\u0430\u044f<\/a> \u0447\u0430\u0441\u0442\u044c \u0431\u044b\u043b\u0430 \u0432 \u043f\u0435\u0440\u0432\u0443\u044e \u043e\u0447\u0435\u0440\u0435\u0434\u044c \u0441\u043e\u0441\u0440\u0435\u0434\u043e\u0442\u043e\u0447\u0435\u043d\u0430 \u043d\u0430 \u043f\u043e\u043d\u0438\u043c\u0430\u043d\u0438\u0438 \u043f\u0440\u043e\u0431\u043b\u0435\u043c, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0440\u0435\u0448\u0430\u0435\u0442 Consul, \u0438 \u043d\u0430 \u0442\u043e\u043c, \u043a\u0430\u043a \u043e\u043d \u0438\u0445 \u0440\u0435\u0448\u0430\u0435\u0442. \u042d\u0442\u0430 \u0447\u0430\u0441\u0442\u044c \u043f\u043e\u0441\u0432\u044f\u0449\u0435\u043d\u0430 \u043f\u0440\u0430\u043a\u0442\u0438\u0447\u0435\u0441\u043a\u043e\u043c\u0443 \u043f\u0440\u0438\u043c\u0435\u043d\u0435\u043d\u0438\u044e Consul \u043d\u0430 \u043f\u0440\u0438\u043c\u0435\u0440\u0435 \u0440\u0435\u0430\u043b\u044c\u043d\u043e\u0439 \u0436\u0438\u0437\u043d\u0438. \u0414\u0430\u0432\u0430\u0439\u0442\u0435 \u043d\u0430\u0447\u043d\u0435\u043c.<\/p>\n<p><a name=\"habracut\"><\/a>  <\/p>\n<p>\u0420\u0430\u0437\u0432\u0438\u0432\u0430\u044f \u0431\u043e\u043b\u044c\u0448\u0443\u044e \u0447\u0430\u0441\u0442\u044c \u0442\u0435\u043e\u0440\u0438\u0438, \u0440\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0435\u043d\u043d\u043e\u0439 \u0432 <a href=\"https:\/\/habr.com\/ru\/post\/531602\/\">\u043f\u0440\u0435\u0434\u044b\u0434\u0443\u0449\u0435\u0439<\/a> \u0447\u0430\u0441\u0442\u0438, \u0434\u0430\u0432\u0430\u0439\u0442\u0435 \u043f\u0435\u0440\u0435\u0439\u0434\u0435\u043c \u043a \u043f\u0440\u0430\u043a\u0442\u0438\u0447\u0435\u0441\u043a\u043e\u043c\u0443 \u043f\u0440\u0438\u043c\u0435\u0440\u0443 Consul.<\/p>\n<p>  <\/p>\n<h3 id=\"chto-my-stroim\">\u0427\u0442\u043e \u043c\u044b \u0441\u0442\u0440\u043e\u0438\u043c?<\/h3>\n<p>  <\/p>\n<p>\u041c\u044b \u0441\u043e\u0431\u0438\u0440\u0430\u0435\u043c\u0441\u044f \u0441\u043e\u0437\u0434\u0430\u0442\u044c <a href=\"https:\/\/www.djangoproject.com\/\" rel=\"nofollow\">\u0432\u0435\u0431-\u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435 Django<\/a>, \u043a\u043e\u0442\u043e\u0440\u043e\u0435 \u0445\u0440\u0430\u043d\u0438\u0442 \u0441\u0432\u043e\u0438 \u043f\u043e\u0441\u0442\u043e\u044f\u043d\u043d\u044b\u0435 \u0434\u0430\u043d\u043d\u044b\u0435 \u0432 <a href=\"https:\/\/www.mongodb.com\/\" rel=\"nofollow\">MongoDB<\/a>. \u041c\u044b \u043f\u043e\u043c\u0435\u0441\u0442\u0438\u043c \u0438\u0445 \u0432 <a href=\"https:\/\/www.docker.com\/resources\/what-container\" rel=\"nofollow\">\u043a\u043e\u043d\u0442\u0435\u0439\u043d\u0435\u0440<\/a> \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e <a href=\"https:\/\/www.docker.com\/\" rel=\"nofollow\">Docker<\/a>. \u0421\u043a\u043e\u043c\u043f\u0438\u043b\u0438\u0440\u0443\u0439\u0442\u0435 \u0438 \u0437\u0430\u043f\u0443\u0441\u0442\u0438\u0442\u0435 \u0438\u0445 \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e <a href=\"https:\/\/docs.docker.com\/compose\/\" rel=\"nofollow\">Docker Compose<\/a>.<\/p>\n<p>  <\/p>\n<p>\u0427\u0442\u043e\u0431\u044b \u043f\u043e\u043a\u0430\u0437\u0430\u0442\u044c, \u043a\u0430\u043a \u043d\u0430\u0448\u0435 \u0432\u0435\u0431-\u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u0431\u0443\u0434\u0435\u0442 \u043c\u0430\u0441\u0448\u0442\u0430\u0431\u0438\u0440\u043e\u0432\u0430\u0442\u044c\u0441\u044f \u0432 \u044d\u0442\u043e\u043c \u043a\u043e\u043d\u0442\u0435\u043a\u0441\u0442\u0435, \u043c\u044b \u0441\u043e\u0431\u0438\u0440\u0430\u0435\u043c\u0441\u044f \u0437\u0430\u043f\u0443\u0441\u0442\u0438\u0442\u044c \u0434\u0432\u0430 \u044d\u043a\u0437\u0435\u043c\u043f\u043b\u044f\u0440\u0430 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f Django. \u041a\u0440\u043e\u043c\u0435 \u0442\u043e\u0433\u043e, \u0447\u0442\u043e\u0431\u044b \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u044d\u0442\u043e \u0435\u0449\u0435 \u0431\u043e\u043b\u0435\u0435 \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043d\u044b\u043c, \u043c\u044b \u0437\u0430\u043f\u0443\u0441\u0442\u0438\u043c MongoDB \u043a\u0430\u043a <a href=\"https:\/\/docs.mongodb.com\/manual\/replication\" rel=\"nofollow\">\u043d\u0430\u0431\u043e\u0440 \u0440\u0435\u043f\u043b\u0438\u043a<\/a> \u0441 \u043e\u0434\u043d\u0438\u043c \u043f\u0435\u0440\u0432\u0438\u0447\u043d\u044b\u043c \u0443\u0437\u043b\u043e\u043c \u0438 \u0434\u0432\u0443\u043c\u044f \u0432\u0442\u043e\u0440\u0438\u0447\u043d\u044b\u043c\u0438 \u0443\u0437\u043b\u0430\u043c\u0438.<\/p>\n<p>  <\/p>\n<p>\u0423\u0447\u0438\u0442\u044b\u0432\u0430\u044f, \u0447\u0442\u043e \u0443 \u043d\u0430\u0441 \u0435\u0441\u0442\u044c \u0434\u0432\u0430 \u044d\u043a\u0437\u0435\u043c\u043f\u043b\u044f\u0440\u0430 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f Django, \u043d\u0430\u043c \u043f\u043e\u043d\u0430\u0434\u043e\u0431\u0438\u0442\u0441\u044f \u0441\u043f\u043e\u0441\u043e\u0431 \u0441\u0431\u0430\u043b\u0430\u043d\u0441\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u043d\u0430\u0433\u0440\u0443\u0437\u043a\u0443 \u043c\u0435\u0436\u0434\u0443 \u044d\u0442\u0438\u043c\u0438 \u0434\u0432\u0443\u043c\u044f \u044d\u043a\u0437\u0435\u043c\u043f\u043b\u044f\u0440\u0430\u043c\u0438, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u043c\u044b \u0441\u043e\u0431\u0438\u0440\u0430\u0435\u043c\u0441\u044f \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c <a href=\"https:\/\/fabiolb.net\/\" rel=\"nofollow\">Fabio<\/a>, \u0431\u0430\u043b\u0430\u043d\u0441\u0438\u0440\u043e\u0432\u0449\u0438\u043a \u043d\u0430\u0433\u0440\u0443\u0437\u043a\u0438, \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u044e\u0449\u0438\u0439 Consul, \u0434\u043b\u044f \u0434\u043e\u0441\u0442\u0443\u043f\u0430 \u043a \u044d\u043a\u0437\u0435\u043c\u043f\u043b\u044f\u0440\u0430\u043c \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f Django.<\/p>\n<p>  <\/p>\n<p>\u042d\u0442\u043e\u0442 \u043f\u0440\u0438\u043c\u0435\u0440 \u043f\u0440\u0438\u043c\u0435\u0440\u043d\u043e \u043f\u043e\u043c\u043e\u0436\u0435\u0442 \u043d\u0430\u043c \u0441\u043c\u043e\u0434\u0435\u043b\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0440\u0435\u0430\u043b\u044c\u043d\u043e\u0435 \u043f\u0440\u0430\u043a\u0442\u0438\u0447\u0435\u0441\u043a\u043e\u0435 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435.<\/p>\n<p>  <\/p>\n<p><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/yq\/z5\/1d\/yqz51ddx8ce0iqv_0we5l4rwxb0.png\"><\/p>\n<p>  <\/p>\n<p><em>\u041f\u0440\u0438\u043c\u0435\u0440\u044b \u0443\u0437\u043b\u043e\u0432 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0439 \u0438 \u0440\u0430\u0437\u0432\u0435\u0440\u043d\u0443\u0442\u044b\u0445 \u043d\u0430 \u043d\u0438\u0445 \u0441\u043b\u0443\u0436\u0431<\/em><\/p>\n<p>  <\/p>\n<p>\u041f\u043e\u043b\u043d\u044b\u0439 \u0438\u0441\u0445\u043e\u0434\u043d\u044b\u0439 \u043a\u043e\u0434 \u044d\u0442\u043e\u0433\u043e \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u043e\u0442\u043a\u0440\u044b\u0442\u044b\u043c \u0438 \u0434\u043e\u0441\u0442\u0443\u043f\u0435\u043d \u043d\u0430 GitHub \u2014 <a href=\"http:\/\/pranavcode\/consul-demo\" rel=\"nofollow\">pranavcode\/consul-demo<\/a>.<\/p>\n<p>  <\/p>\n<p><em>\u041f\u0440\u0438\u043c\u0435\u0447\u0430\u043d\u0438\u0435. \u041e\u0431\u0441\u0443\u0436\u0434\u0430\u0435\u043c\u0430\u044f \u0437\u0434\u0435\u0441\u044c \u0430\u0440\u0445\u0438\u0442\u0435\u043a\u0442\u0443\u0440\u0430 \u043d\u0435 \u043d\u0430\u043a\u043b\u0430\u0434\u044b\u0432\u0430\u0435\u0442 \u043e\u0441\u043e\u0431\u044b\u0445 \u043e\u0433\u0440\u0430\u043d\u0438\u0447\u0435\u043d\u0438\u0439 \u043d\u0430 \u043a\u0430\u043a\u0438\u0435-\u043b\u0438\u0431\u043e \u0442\u0435\u0445\u043d\u043e\u043b\u043e\u0433\u0438\u0438, \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c\u044b\u0435 \u0434\u043b\u044f \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f \u0443\u0440\u043e\u0432\u043d\u0435\u0439 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0439 \u0438\u043b\u0438 \u0434\u0430\u043d\u043d\u044b\u0445. \u042d\u0442\u043e\u0442 \u043f\u0440\u0438\u043c\u0435\u0440 \u0432\u043f\u043e\u043b\u043d\u0435 \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u043f\u043e\u0441\u0442\u0440\u043e\u0435\u043d \u0441 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435\u043c \u043a\u043e\u043c\u0431\u0438\u043d\u0430\u0446\u0438\u0438 Ruby on Rails \u0438 Postgres, \u0438\u043b\u0438 Node.js \u0438 MongoDB, \u0438\u043b\u0438 Laravel \u0438 MySQL.<\/em><\/p>\n<p>  <\/p>\n<h3 id=\"kakoe-mesto-zanimaet-konsul\">\u041a\u0430\u043a\u043e\u0435 \u043c\u0435\u0441\u0442\u043e \u0437\u0430\u043d\u0438\u043c\u0430\u0435\u0442 \u041a\u043e\u043d\u0441\u0443\u043b?<\/h3>\n<p>  <\/p>\n<p>\u041c\u044b \u0440\u0430\u0437\u0432\u0435\u0440\u0442\u044b\u0432\u0430\u0435\u043c \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u0438 \u0441\u043b\u043e\u0438 \u0434\u0430\u043d\u043d\u044b\u0445 \u0441 \u043a\u043e\u043d\u0442\u0435\u0439\u043d\u0435\u0440\u0430\u043c\u0438 Docker. \u041e\u043d\u0438 \u0431\u0443\u0434\u0443\u0442 \u043f\u043e\u0441\u0442\u0440\u043e\u0435\u043d\u044b \u043a\u0430\u043a \u0441\u043b\u0443\u0436\u0431\u044b \u0438 \u0431\u0443\u0434\u0443\u0442 \u043e\u0431\u0449\u0430\u0442\u044c\u0441\u044f \u0434\u0440\u0443\u0433 \u0441 \u0434\u0440\u0443\u0433\u043e\u043c \u043f\u043e HTTP.<\/p>\n<p>  <\/p>\n<p>\u0422\u0430\u043a\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c, \u043c\u044b \u0431\u0443\u0434\u0435\u043c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c <a href=\"https:\/\/velotio.com\/blog\/2019\/3\/11\/hashicorp-consul-guide-1\" rel=\"nofollow\">Consul \u0434\u043b\u044f Service Discovery<\/a>. \u042d\u0442\u043e \u043f\u043e\u0437\u0432\u043e\u043b\u0438\u0442 \u0441\u0435\u0440\u0432\u0435\u0440\u0430\u043c Django \u043d\u0430\u0439\u0442\u0438 <a href=\"https:\/\/docs.mongodb.com\/manual\/core\/replica-set-primary\" rel=\"nofollow\">\u043f\u0435\u0440\u0432\u0438\u0447\u043d\u044b\u0439 \u0443\u0437\u0435\u043b MongoDB<\/a>. \u0412 \u044d\u0442\u043e\u043c \u043f\u0440\u0438\u043c\u0435\u0440\u0435 \u043c\u044b \u0441\u043e\u0431\u0438\u0440\u0430\u0435\u043c\u0441\u044f \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c Consul \u0434\u043b\u044f \u0440\u0430\u0437\u0440\u0435\u0448\u0435\u043d\u0438\u044f \u0441\u043b\u0443\u0436\u0431 \u0447\u0435\u0440\u0435\u0437 <a href=\"https:\/\/www.consul.io\/docs\/agent\/dns.html\" rel=\"nofollow\">\u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441 Consul DNS<\/a>.<\/p>\n<p>  <\/p>\n<p>Consul \u0442\u0430\u043a\u0436\u0435 \u043f\u043e\u043c\u043e\u0436\u0435\u0442 \u043d\u0430\u043c \u0441 <a href=\"https:\/\/github.com\/fabiolb\/fabio\/wiki\/Configuration\" rel=\"nofollow\">\u0430\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u043e\u0439 \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u043e\u0439 Fabio<\/a> \u0432 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 \u0431\u0430\u043b\u0430\u043d\u0441\u0438\u0440\u043e\u0432\u0449\u0438\u043a\u0430 \u043d\u0430\u0433\u0440\u0443\u0437\u043a\u0438 \u0434\u043b\u044f \u0434\u043e\u0441\u0442\u0443\u043f\u0430 \u043a \u044d\u043a\u0437\u0435\u043c\u043f\u043b\u044f\u0440\u0430\u043c \u043d\u0430\u0448\u0435\u0433\u043e \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f Django.<\/p>\n<p>  <\/p>\n<p>\u041c\u044b \u0442\u0430\u043a\u0436\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c \u0444\u0443\u043d\u043a\u0446\u0438\u044e \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0438 \u0440\u0430\u0431\u043e\u0442\u043e\u0441\u043f\u043e\u0441\u043e\u0431\u043d\u043e\u0441\u0442\u0438 Consul, \u0447\u0442\u043e\u0431\u044b \u043e\u0442\u0441\u043b\u0435\u0436\u0438\u0432\u0430\u0442\u044c \u0440\u0430\u0431\u043e\u0442\u043e\u0441\u043f\u043e\u0441\u043e\u0431\u043d\u043e\u0441\u0442\u044c \u043a\u0430\u0436\u0434\u043e\u0433\u043e \u0438\u0437 \u043d\u0430\u0448\u0438\u0445 \u044d\u043a\u0437\u0435\u043c\u043f\u043b\u044f\u0440\u043e\u0432 \u0432\u043e \u0432\u0441\u0435\u0439 \u0438\u043d\u0444\u0440\u0430\u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0435.<\/p>\n<p>  <\/p>\n<p>Consul \u043f\u0440\u0435\u0434\u043e\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442 \u043a\u0440\u0430\u0441\u0438\u0432\u044b\u0439 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u0441\u043a\u0438\u0439 \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441, \u043a\u0430\u043a \u0447\u0430\u0441\u0442\u044c \u0441\u0432\u043e\u0435\u0433\u043e \u0432\u0435\u0431-\u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441\u0430, \u0447\u0442\u043e\u0431\u044b \u043f\u043e\u043a\u0430\u0437\u0430\u0442\u044c \u0432\u0441\u0435 \u0441\u043b\u0443\u0436\u0431\u044b \u043d\u0430 \u043e\u0434\u043d\u043e\u0439 \u043f\u0430\u043d\u0435\u043b\u0438. \u041c\u044b \u0431\u0443\u0434\u0435\u043c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0435\u0433\u043e, \u0447\u0442\u043e\u0431\u044b \u0443\u0432\u0438\u0434\u0435\u0442\u044c, \u043a\u0430\u043a \u0443\u0441\u0442\u0440\u043e\u0435\u043d\u044b \u043d\u0430\u0448\u0438 \u0443\u0441\u043b\u0443\u0433\u0438.<\/p>\n<p>  <\/p>\n<p>\u0414\u0430\u0432\u0430\u0439\u0442\u0435 \u043d\u0430\u0447\u043d\u0435\u043c.<\/p>\n<p>  <\/p>\n<h3 id=\"nastroyka-mongodb-django-consul-fabio-i-dockerization\">\u041d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0430: MongoDB, Django, Consul, Fabio \u0438 Dockerization<\/h3>\n<p>  <\/p>\n<p>\u041c\u044b \u0441\u0434\u0435\u043b\u0430\u0435\u043c \u044d\u0442\u043e \u043d\u0430\u0441\u0442\u043e\u043b\u044c\u043a\u043e \u0431\u044b\u0441\u0442\u0440\u043e \u0438 \u043f\u0440\u043e\u0441\u0442\u043e, \u043d\u0430\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u044d\u0442\u043e \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e, \u0447\u0442\u043e\u0431\u044b \u043f\u0440\u043e\u0434\u0435\u043c\u043e\u043d\u0441\u0442\u0440\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0432\u0430\u043c \u0432\u0441\u0435 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u0438.<\/p>\n<p>  <\/p>\n<h4 id=\"mongodb\">MongoDB<\/h4>\n<p>  <\/p>\n<p>\u041c\u044b \u043d\u0430\u0446\u0435\u043b\u0435\u043d\u044b \u043d\u0430 \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0443 MongoDB \u0432 \u0444\u043e\u0440\u043c\u0435 \u043d\u0430\u0431\u043e\u0440\u0430 \u0440\u0435\u043f\u043b\u0438\u043a MongoDB. \u041e\u0434\u0438\u043d \u043f\u0435\u0440\u0432\u0438\u0447\u043d\u044b\u0439 \u0443\u0437\u0435\u043b \u0438 \u0434\u0432\u0430 \u0432\u0442\u043e\u0440\u0438\u0447\u043d\u044b\u0445 \u0443\u0437\u043b\u0430.<\/p>\n<p>  <\/p>\n<p>\u041f\u0435\u0440\u0432\u0438\u0447\u043d\u044b\u0439 \u0443\u0437\u0435\u043b \u0431\u0443\u0434\u0435\u0442 \u0443\u043f\u0440\u0430\u0432\u043b\u044f\u0442\u044c \u0432\u0441\u0435\u043c\u0438 <a href=\"https:\/\/docs.mongodb.com\/manual\/core\/replica-set-write-concern\" rel=\"nofollow\">\u043e\u043f\u0435\u0440\u0430\u0446\u0438\u044f\u043c\u0438 \u0437\u0430\u043f\u0438\u0441\u0438<\/a> \u0438 <a href=\"https:\/\/docs.mongodb.com\/manual\/core\/replica-set-oplog\" rel=\"nofollow\">\u0436\u0443\u0440\u043d\u0430\u043b\u043e\u043c \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u0439<\/a>, \u0447\u0442\u043e\u0431\u044b \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u0442\u044c \u043f\u043e\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u044c \u0437\u0430\u043f\u0438\u0441\u0438 \u0438 \u0440\u0435\u043f\u043b\u0438\u0446\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0434\u0430\u043d\u043d\u044b\u0435 \u043c\u0435\u0436\u0434\u0443 <a href=\"https:\/\/docs.mongodb.com\/manual\/core\/replica-set-secondary\" rel=\"nofollow\">\u0432\u0442\u043e\u0440\u0438\u0447\u043d\u044b\u043c\u0438 \u0443\u0437\u043b\u0430\u043c\u0438<\/a>. \u041c\u044b \u0442\u0430\u043a\u0436\u0435 \u043d\u0430\u0441\u0442\u0440\u0430\u0438\u0432\u0430\u0435\u043c \u0432\u0442\u043e\u0440\u0438\u0447\u043d\u044b\u0435 \u0441\u0435\u0440\u0432\u0435\u0440\u044b \u0434\u043b\u044f <a href=\"https:\/\/docs.mongodb.com\/manual\/core\/read-preference\" rel=\"nofollow\">\u043e\u043f\u0435\u0440\u0430\u0446\u0438\u0439 \u0447\u0442\u0435\u043d\u0438\u044f<\/a>. \u0412\u044b \u043c\u043e\u0436\u0435\u0442\u0435 \u0443\u0437\u043d\u0430\u0442\u044c \u0431\u043e\u043b\u044c\u0448\u0435 \u043e <a href=\"https:\/\/docs.mongodb.com\/manual\/tutorial\/deploy-replica-set\" rel=\"nofollow\">MongoDB Replica Set<\/a> \u0432 \u0438\u0445 \u043e\u0444\u0438\u0446\u0438\u0430\u043b\u044c\u043d\u043e\u0439 \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u0438.<\/p>\n<p>  <\/p>\n<p>\u041c\u044b \u0431\u0443\u0434\u0435\u043c \u043d\u0430\u0437\u044b\u0432\u0430\u0442\u044c \u043d\u0430\u0448 \u043d\u0430\u0431\u043e\u0440 \u0440\u0435\u043f\u043b\u0438\u043a\u0430\u0446\u0438\u0438 <code>consuldemo<\/code>.<\/p>\n<p>  <\/p>\n<p>\u041c\u044b \u0437\u0430\u043f\u0443\u0441\u0442\u0438\u043c MongoDB \u043d\u0430 <a href=\"https:\/\/docs.mongodb.com\/manual\/reference\/default-mongodb-port\" rel=\"nofollow\">\u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u043e\u043c \u043f\u043e\u0440\u0442\u0443 27017<\/a> \u0438 \u0443\u043a\u0430\u0436\u0435\u043c \u0438\u043c\u044f \u0440\u0435\u043f\u043b\u0438\u043a\u0438, \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043b\u0435\u043d\u043d\u043e\u0439 \u0432 \u043a\u043e\u043c\u0430\u043d\u0434\u043d\u043e\u0439 \u0441\u0442\u0440\u043e\u043a\u0435, \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u0430 <code>--replSet<\/code>.<\/p>\n<p>  <\/p>\n<p>\u041a\u0430\u043a \u0432\u044b \u043c\u043e\u0436\u0435\u0442\u0435 \u043f\u0440\u043e\u0447\u0438\u0442\u0430\u0442\u044c \u0438\u0437 \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u0438, MongoDB \u0442\u0430\u043a\u0436\u0435 \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u043d\u0430\u0441\u0442\u0440\u0430\u0438\u0432\u0430\u0442\u044c \u0438\u043c\u044f \u043d\u0430\u0431\u043e\u0440\u0430 \u0440\u0435\u043f\u043b\u0438\u043a \u0447\u0435\u0440\u0435\u0437 <a href=\"https:\/\/docs.mongodb.com\/manual\/reference\/configuration-options\" rel=\"nofollow\">\u0444\u0430\u0439\u043b \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u0438<\/a> \u0441 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u043e\u043c \u0440\u0435\u043f\u043b\u0438\u043a\u0430\u0446\u0438\u0438, \u043a\u0430\u043a \u043f\u043e\u043a\u0430\u0437\u0430\u043d\u043e \u043d\u0438\u0436\u0435:<\/p>\n<p>  <\/p>\n<pre><code class=\"plaintext\">replication:     replSetName: &quot;consuldemo&quot;<\/code><\/pre>\n<p>  <\/p>\n<p>\u0412 \u043d\u0430\u0448\u0435\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u044f \u043d\u0430\u0431\u043e\u0440\u0430 \u0440\u0435\u043f\u043b\u0438\u043a\u0430\u0446\u0438\u0438, \u043a\u043e\u0442\u043e\u0440\u0443\u044e \u043c\u044b \u0431\u0443\u0434\u0435\u043c \u043f\u0440\u0438\u043c\u0435\u043d\u044f\u0442\u044c \u043d\u0430 \u043e\u0434\u043d\u043e\u043c \u0438\u0437 \u0443\u0437\u043b\u043e\u0432 MongoDB, \u043f\u043e\u0441\u043b\u0435 \u0442\u043e\u0433\u043e, \u043a\u0430\u043a \u0432\u0441\u0435 \u0443\u0437\u043b\u044b \u0431\u0443\u0434\u0443\u0442 \u0437\u0430\u043f\u0443\u0449\u0435\u043d\u044b, \u0432\u044b\u0433\u043b\u044f\u0434\u0438\u0442 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c:<\/p>\n<p>  <\/p>\n<pre><code class=\"plaintext\">var config = {     _id: &quot;consuldemo&quot;,     version: 1,     members: [{         _id: 0,         host: &quot;mongo_1:27017&quot;,     }, {         _id: 1,         host: &quot;mongo_2:27017&quot;,     }, {         _id: 2,         host: &quot;mongo_3:27017&quot;,     }],     settings: {          chainingAllowed: true      } }; rs.initiate(config, { force: true }); rs.slaveOk(); db.getMongo().setReadPref(&quot;nearest&quot;);<\/code><\/pre>\n<p>  <\/p>\n<p>\u042d\u0442\u0430 \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u044f \u0431\u0443\u0434\u0435\u0442 \u043f\u0440\u0438\u043c\u0435\u043d\u0435\u043d\u0430 \u043a \u043e\u0434\u043d\u043e\u043c\u0443 \u0438\u0437 \u043f\u0440\u0435\u0434\u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u043d\u044b\u0445 \u0443\u0437\u043b\u043e\u0432, \u0438 <a href=\"https:\/\/docs.mongodb.com\/manual\/core\/replica-set-elections\" rel=\"nofollow\">MongoDB \u0440\u0435\u0448\u0438\u0442, \u043a\u0430\u043a\u043e\u0439 \u0443\u0437\u0435\u043b \u0431\u0443\u0434\u0435\u0442 \u043e\u0441\u043d\u043e\u0432\u043d\u044b\u043c \u0438 \u0434\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u043c<\/a>.<\/p>\n<p>  <\/p>\n<p><em>\u041f\u0440\u0438\u043c\u0435\u0447\u0430\u043d\u0438\u0435. \u041c\u044b \u043d\u0435 \u0444\u043e\u0440\u0441\u0438\u0440\u0443\u0435\u043c \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u0435 \u043d\u0430\u0431\u043e\u0440\u0430 \u0441 \u043f\u0440\u0435\u0434\u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u043d\u044b\u043c\u0438 \u043e\u0431\u043e\u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f\u043c\u0438 \u0442\u043e\u0433\u043e, \u043a\u0442\u043e \u0441\u0442\u0430\u043d\u0435\u0442 \u043e\u0441\u043d\u043e\u0432\u043d\u044b\u043c \u0438 \u0432\u0442\u043e\u0440\u043e\u0441\u0442\u0435\u043f\u0435\u043d\u043d\u044b\u043c, \u0447\u0442\u043e\u0431\u044b \u043e\u0431\u0435\u0441\u043f\u0435\u0447\u0438\u0442\u044c \u0434\u0438\u043d\u0430\u043c\u0438\u0437\u043c \u0432 \u043e\u0431\u043d\u0430\u0440\u0443\u0436\u0435\u043d\u0438\u0438 \u0443\u0441\u043b\u0443\u0433. \u041e\u0431\u044b\u0447\u043d\u043e \u0443\u0437\u043b\u044b \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u044e\u0442\u0441\u044f \u0434\u043b\u044f \u043a\u043e\u043d\u043a\u0440\u0435\u0442\u043d\u043e\u0439 \u0440\u043e\u043b\u0438.<\/em><\/p>\n<p>  <\/p>\n<p>\u041c\u044b \u0440\u0430\u0437\u0440\u0435\u0448\u0430\u0435\u043c \u0432\u0435\u0434\u043e\u043c\u043e\u0439 \u0440\u0435\u043f\u043b\u0438\u043a\u0435 \u0447\u0438\u0442\u0430\u0442\u044c \u0441 \u0431\u043b\u0438\u0436\u0430\u0439\u0448\u0435\u0433\u043e \u0443\u0437\u043b\u0430 \u0432 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 <a href=\"https:\/\/docs.mongodb.com\/manual\/core\/read-preference\" rel=\"nofollow\">\u043f\u0440\u0435\u0434\u043f\u043e\u0447\u0442\u0435\u043d\u0438\u044f \u0447\u0442\u0435\u043d\u0438\u044f<\/a>.<\/p>\n<p>  <\/p>\n<p>\u041c\u044b \u0437\u0430\u043f\u0443\u0441\u0442\u0438\u043c MongoDB \u043d\u0430 \u0432\u0441\u0435\u0445 \u0443\u0437\u043b\u0430\u0445 \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u0439 \u043a\u043e\u043c\u0430\u043d\u0434\u044b:<\/p>\n<p>  <\/p>\n<pre><code class=\"plaintext\">mongod --bind_ip_all --port 27017 --dbpath \/data\/db --replSet &quot;consuldemo&quot;<\/code><\/pre>\n<p>  <\/p>\n<p>\u042d\u0442\u043e \u0434\u0430\u0435\u0442 \u043d\u0430\u043c \u043d\u0430\u0431\u043e\u0440 \u0440\u0435\u043f\u043b\u0438\u043a MongoDB \u0441 \u043e\u0434\u043d\u0438\u043c \u043f\u0435\u0440\u0432\u0438\u0447\u043d\u044b\u043c \u044d\u043a\u0437\u0435\u043c\u043f\u043b\u044f\u0440\u043e\u043c \u0438 \u0434\u0432\u0443\u043c\u044f \u0432\u0442\u043e\u0440\u0438\u0447\u043d\u044b\u043c\u0438 \u044d\u043a\u0437\u0435\u043c\u043f\u043b\u044f\u0440\u0430\u043c\u0438, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0440\u0430\u0431\u043e\u0442\u0430\u044e\u0442 \u0438 \u0433\u043e\u0442\u043e\u0432\u044b \u043f\u0440\u0438\u043d\u0438\u043c\u0430\u0442\u044c \u0441\u043e\u0435\u0434\u0438\u043d\u0435\u043d\u0438\u044f.<\/p>\n<p>  <\/p>\n<p>\u041c\u044b \u043e\u0431\u0441\u0443\u0434\u0438\u043c \u043a\u043e\u043d\u0442\u0435\u0439\u043d\u0435\u0440\u0438\u0437\u0430\u0446\u0438\u044e \u0441\u043b\u0443\u0436\u0431\u044b MongoDB \u0432 \u043f\u043e\u0441\u043b\u0435\u0434\u043d\u0435\u0439 \u0447\u0430\u0441\u0442\u0438 \u044d\u0442\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0438.<\/p>\n<p>  <\/p>\n<h4 id=\"django\">Django<\/h4>\n<p>  <\/p>\n<p>\u041c\u044b \u0441\u043e\u0437\u0434\u0430\u0434\u0438\u043c \u043f\u0440\u043e\u0441\u0442\u043e\u0439 <a href=\"https:\/\/realpython.com\/django-setup\/\" rel=\"nofollow\">\u043f\u0440\u043e\u0435\u043a\u0442 Django<\/a>, \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u044f\u044e\u0449\u0438\u0439 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435 Blog, \u0438 \u043a\u043e\u043d\u0442\u0435\u0439\u043d\u0435\u0440 \u0435\u0433\u043e \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e Docker.<\/p>\n<p>  <\/p>\n<p><a href=\"https:\/\/docs.djangoproject.com\/en\/2.1\/intro\/tutorial01\/\" rel=\"nofollow\">\u0421\u043e\u0437\u0434\u0430\u043d\u0438\u0435 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f Django \u0441 \u043d\u0443\u043b\u044f<\/a> \u0432\u044b\u0445\u043e\u0434\u0438\u0442 \u0437\u0430 \u0440\u0430\u043c\u043a\u0438 \u044d\u0442\u043e\u0433\u043e \u0440\u0443\u043a\u043e\u0432\u043e\u0434\u0441\u0442\u0432\u0430, \u043c\u044b \u0440\u0435\u043a\u043e\u043c\u0435\u043d\u0434\u0443\u0435\u043c \u0432\u0430\u043c \u043e\u0431\u0440\u0430\u0442\u0438\u0442\u044c\u0441\u044f \u043a <a href=\"https:\/\/docs.djangoproject.com\/en\/2.1\/\" rel=\"nofollow\">\u043e\u0444\u0438\u0446\u0438\u0430\u043b\u044c\u043d\u043e\u0439 \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u0438 Django<\/a>, \u0447\u0442\u043e\u0431\u044b \u043d\u0430\u0447\u0430\u0442\u044c \u0440\u0430\u0431\u043e\u0442\u0443 \u0441 \u043f\u0440\u043e\u0435\u043a\u0442\u043e\u043c Django. \u041d\u043e \u043c\u044b \u0432\u0441\u0435 \u0436\u0435 \u0440\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0438\u043c \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0432\u0430\u0436\u043d\u044b\u0435 \u0430\u0441\u043f\u0435\u043a\u0442\u044b.<\/p>\n<p>  <\/p>\n<p>\u041f\u043e\u0441\u043a\u043e\u043b\u044c\u043a\u0443 \u043d\u0430\u043c \u043d\u0443\u0436\u043d\u043e, \u0447\u0442\u043e\u0431\u044b \u043d\u0430\u0448\u0435 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435 Django \u0432\u0437\u0430\u0438\u043c\u043e\u0434\u0435\u0439\u0441\u0442\u0432\u043e\u0432\u0430\u043b\u043e \u0441 MongoDB, \u043c\u044b \u0431\u0443\u0434\u0435\u043c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u043a\u043e\u043d\u043d\u0435\u043a\u0442\u043e\u0440 MongoDB \u0434\u043b\u044f Django ORM, <a href=\"https:\/\/nesdis.github.io\/djongo\/\" rel=\"nofollow\">Djongo<\/a>. \u041c\u044b \u043d\u0430\u0441\u0442\u0440\u043e\u0438\u043c \u043d\u0430\u0448\u0438 \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0438 Django \u0434\u043b\u044f \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044f Djongo \u0438 \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u044f \u043a \u043d\u0430\u0448\u0435\u0439 MongoDB. Djongo \u0434\u043e\u0432\u043e\u043b\u044c\u043d\u043e \u043f\u0440\u043e\u0441\u0442 \u0432 \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0435.<\/p>\n<p>  <\/p>\n<p>\u0414\u043b\u044f \u043b\u043e\u043a\u0430\u043b\u044c\u043d\u043e\u0439 \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0438 MongoDB \u043f\u043e\u0442\u0440\u0435\u0431\u0443\u0435\u0442\u0441\u044f \u0432\u0441\u0435\u0433\u043e \u0434\u0432\u0435 \u0441\u0442\u0440\u043e\u043a\u0438 \u043a\u043e\u0434\u0430:<\/p>\n<p>  <\/p>\n<pre><code class=\"plaintext\">...  DATABASES = {     'default': {         'ENGINE': 'djongo',         'NAME': 'db',     } }  ...<\/code><\/pre>\n<p>  <\/p>\n<p>\u0412 \u043d\u0430\u0448\u0435\u043c \u0441\u043b\u0443\u0447\u0430\u0435, \u043f\u043e\u0441\u043a\u043e\u043b\u044c\u043a\u0443 \u043d\u0430\u043c \u043f\u043e\u043d\u0430\u0434\u043e\u0431\u0438\u0442\u0441\u044f \u0434\u043e\u0441\u0442\u0443\u043f \u043a MongoDB \u0447\u0435\u0440\u0435\u0437 \u0434\u0440\u0443\u0433\u043e\u0439 \u043a\u043e\u043d\u0442\u0435\u0439\u043d\u0435\u0440, \u043d\u0430\u0448\u0430 \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u044f \u0431\u0443\u0434\u0435\u0442 \u0432\u044b\u0433\u043b\u044f\u0434\u0435\u0442\u044c \u0442\u0430\u043a:<\/p>\n<p>  <\/p>\n<pre><code class=\"plaintext\">...  DATABASES = {     'default': {         'ENGINE': 'djongo',         'NAME': 'db',         'HOST': 'mongodb:\/\/mongo-primary.service.consul',         'PORT': 27017,     } }  ... @velotiotech<\/code><\/pre>\n<p>  <\/p>\n<p>\u0414\u0435\u0442\u0430\u043b\u0438:<\/p>\n<p>  <\/p>\n<p>\u00b7 ENGINE: \u041a\u043e\u043d\u043d\u0435\u043a\u0442\u043e\u0440 \u0431\u0430\u0437\u044b \u0434\u0430\u043d\u043d\u044b\u0445 \u0434\u043b\u044f \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044f \u0432 Django ORM.<\/p>\n<p>  <\/p>\n<p>\u00b7 NAME: \u0418\u043c\u044f \u0431\u0430\u0437\u044b \u0434\u0430\u043d\u043d\u044b\u0445.<\/p>\n<p>  <\/p>\n<p>\u00b7 HOST: \u0430\u0434\u0440\u0435\u0441 \u0445\u043e\u0441\u0442\u0430, \u043d\u0430 \u043a\u043e\u0442\u043e\u0440\u043e\u043c \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 MongoDB.<\/p>\n<p>  <\/p>\n<p>\u00b7 PORT: \u043a\u0430\u043a\u043e\u0439 \u043f\u043e\u0440\u0442 MongoDB \u043f\u0440\u043e\u0441\u043b\u0443\u0448\u0438\u0432\u0430\u0435\u0442 \u0437\u0430\u043f\u0440\u043e\u0441\u044b.<\/p>\n<p>  <\/p>\n<p>Djongo \u0432\u043d\u0443\u0442\u0440\u0435\u043d\u043d\u0435 \u043e\u0431\u0449\u0430\u0435\u0442\u0441\u044f \u0441 <a href=\"https:\/\/api.mongodb.com\/python\/current\/\" rel=\"nofollow\">PyMongo<\/a> \u0438 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442 <a href=\"http:\/\/api.mongodb.com\/python\/current\/api\/pymongo\/mongo_client.html\" rel=\"nofollow\">MongoClient<\/a> \u0434\u043b\u044f \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f \u0437\u0430\u043f\u0440\u043e\u0441\u043e\u0432 \u0432 Mongo. \u041c\u044b \u0442\u0430\u043a\u0436\u0435 \u043c\u043e\u0436\u0435\u043c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0434\u0440\u0443\u0433\u0438\u0435 \u043a\u043e\u043d\u043d\u0435\u043a\u0442\u043e\u0440\u044b MongoDB, \u0434\u043e\u0441\u0442\u0443\u043f\u043d\u044b\u0435 \u0434\u043b\u044f Django, \u0447\u0442\u043e\u0431\u044b \u0434\u043e\u0441\u0442\u0438\u0447\u044c \u044d\u0442\u043e\u0433\u043e, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, <a href=\"https:\/\/django-mongodb-engine.readthedocs.io\/\" rel=\"nofollow\">django-mongodb-engine<\/a> \u0438\u043b\u0438 <a href=\"https:\/\/github.com\/mongodb\/mongo-python-driver\" rel=\"nofollow\">pymongo<\/a> \u043d\u0430\u043f\u0440\u044f\u043c\u0443\u044e, \u0432 \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u0438 \u043e\u0442 \u043d\u0430\u0448\u0438\u0445 \u043f\u043e\u0442\u0440\u0435\u0431\u043d\u043e\u0441\u0442\u0435\u0439.<\/p>\n<p>  <\/p>\n<p><em>\u041f\u0440\u0438\u043c\u0435\u0447\u0430\u043d\u0438\u0435. \u0412 \u043d\u0430\u0441\u0442\u043e\u044f\u0449\u0435\u0435 \u0432\u0440\u0435\u043c\u044f \u043c\u044b \u0447\u0438\u0442\u0430\u0435\u043c \u0438 \u0437\u0430\u043f\u0438\u0441\u044b\u0432\u0430\u0435\u043c \u0447\u0435\u0440\u0435\u0437 Django \u043d\u0430 \u043e\u0434\u0438\u043d \u0445\u043e\u0441\u0442 MongoDB, \u043e\u0441\u043d\u043e\u0432\u043d\u043e\u0439, \u043d\u043e \u043c\u044b \u043c\u043e\u0436\u0435\u043c \u043d\u0430\u0441\u0442\u0440\u043e\u0438\u0442\u044c Djongo \u0442\u0430\u043a, \u0447\u0442\u043e\u0431\u044b \u043e\u043d \u0442\u0430\u043a\u0436\u0435 \u0440\u0430\u0437\u0433\u043e\u0432\u0430\u0440\u0438\u0432\u0430\u043b \u0441\u043e \u0432\u0442\u043e\u0440\u043e\u0441\u0442\u0435\u043f\u0435\u043d\u043d\u044b\u043c\u0438 \u0445\u043e\u0441\u0442\u0430\u043c\u0438 \u0434\u043b\u044f \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u0439 \u0442\u043e\u043b\u044c\u043a\u043e \u0434\u043b\u044f \u0447\u0442\u0435\u043d\u0438\u044f. \u042d\u0442\u043e \u043d\u0435 \u0432\u0445\u043e\u0434\u0438\u0442 \u0432 \u0440\u0430\u043c\u043a\u0438 \u043d\u0430\u0448\u0435\u0433\u043e \u043e\u0431\u0441\u0443\u0436\u0434\u0435\u043d\u0438\u044f. \u0412\u044b \u043c\u043e\u0436\u0435\u0442\u0435 \u043e\u0431\u0440\u0430\u0442\u0438\u0442\u044c\u0441\u044f \u043a \u043e\u0444\u0438\u0446\u0438\u0430\u043b\u044c\u043d\u043e\u0439 \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u0438 Djongo, \u0447\u0442\u043e\u0431\u044b \u0434\u043e\u0431\u0438\u0442\u044c\u0441\u044f \u0438\u043c\u0435\u043d\u043d\u043e \u044d\u0442\u043e\u0433\u043e.<\/em><\/p>\n<p>  <\/p>\n<p>\u041f\u0440\u043e\u0434\u043e\u043b\u0436\u0430\u044f \u043f\u0440\u043e\u0446\u0435\u0441\u0441 \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f Django, \u043d\u0430\u043c \u043d\u0443\u0436\u043d\u043e \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0438\u0442\u044c \u043d\u0430\u0448\u0438 \u043c\u043e\u0434\u0435\u043b\u0438. \u041f\u043e\u0441\u043a\u043e\u043b\u044c\u043a\u0443 \u043c\u044b \u0441\u043e\u0437\u0434\u0430\u0435\u043c \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435, \u043f\u043e\u0445\u043e\u0436\u0435\u0435 \u043d\u0430 \u0431\u043b\u043e\u0433, \u043d\u0430\u0448\u0438 \u043c\u043e\u0434\u0435\u043b\u0438 \u0431\u0443\u0434\u0443\u0442 \u0432\u044b\u0433\u043b\u044f\u0434\u0435\u0442\u044c \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c:<\/p>\n<p>  <\/p>\n<pre><code class=\"plaintext\">from djongo import models  class Blog(models.Model):     name = models.CharField(max_length=100)     tagline = models.TextField()      class Meta:         abstract = True  class Entry(models.Model):     blog = models.EmbeddedModelField(         model_container=Blog,     )      headline = models.CharField(max_length=255)<\/code><\/pre>\n<p>  <\/p>\n<p>\u041c\u044b \u043c\u043e\u0436\u0435\u043c \u0437\u0430\u043f\u0443\u0441\u0442\u0438\u0442\u044c \u043b\u043e\u043a\u0430\u043b\u044c\u043d\u044b\u0439 \u044d\u043a\u0437\u0435\u043c\u043f\u043b\u044f\u0440 MongoDB \u0438 \u0441\u043e\u0437\u0434\u0430\u0442\u044c \u043c\u0438\u0433\u0440\u0430\u0446\u0438\u0438 \u0434\u043b\u044f \u044d\u0442\u0438\u0445 \u043c\u043e\u0434\u0435\u043b\u0435\u0439. \u041a\u0440\u043e\u043c\u0435 \u0442\u043e\u0433\u043e, \u043c\u043e\u0436\u0435\u043c \u0437\u0430\u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u044d\u0442\u0438 \u043c\u043e\u0434\u0435\u043b\u0438 \u0432 \u0432\u0430\u0448\u0435\u043c \u0430\u0434\u043c\u0438\u043d\u0438\u0441\u0442\u0440\u0430\u0442\u043e\u0440\u0435 Django, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440:<\/p>\n<p>  <\/p>\n<pre><code class=\"plaintext\">from django.contrib import admin from.models import Entry  admin.site.register(Entry)<\/code><\/pre>\n<p>  <\/p>\n<p>\u0412 \u044d\u0442\u043e\u043c \u043f\u0440\u0438\u043c\u0435\u0440\u0435 \u043c\u044b \u043c\u043e\u0436\u0435\u043c \u043f\u043e\u0438\u0433\u0440\u0430\u0442\u044c \u0441 CRUD-\u043e\u043f\u0435\u0440\u0430\u0446\u0438\u044f\u043c\u0438 \u043c\u043e\u0434\u0435\u043b\u0438 Entry \u0447\u0435\u0440\u0435\u0437 Django Admin.<\/p>\n<p>  <\/p>\n<p>\u041a\u0440\u043e\u043c\u0435 \u0442\u043e\u0433\u043e, \u0434\u043b\u044f \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u0438 \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u044f Django-MongoDB \u043c\u044b \u0441\u043e\u0437\u0434\u0430\u0434\u0438\u043c \u043d\u0430\u0441\u0442\u0440\u0430\u0438\u0432\u0430\u0435\u043c\u044b\u0439 \u0432\u0438\u0434 \u0438 \u0448\u0430\u0431\u043b\u043e\u043d, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043e\u0442\u043e\u0431\u0440\u0430\u0436\u0430\u0435\u0442 \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u044e \u043e \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0435 MongoDB \u0438 \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0435\u043d\u043d\u043e\u043c \u0432 \u0434\u0430\u043d\u043d\u044b\u0439 \u043c\u043e\u043c\u0435\u043d\u0442 \u0445\u043e\u0441\u0442\u0435 MongoDB.<\/p>\n<p>  <\/p>\n<p>\u041d\u0430\u0448\u0438 \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0438 Django \u0432\u044b\u0433\u043b\u044f\u0434\u044f\u0442 \u0442\u0430\u043a:<\/p>\n<p>  <\/p>\n<pre><code class=\"plaintext\">from django.shortcuts import render from pymongo import MongoClient  def home(request):     client = MongoClient(&quot;mongo-primary.service.consul&quot;)     replica_set = client.admin.command('ismaster')      return render(request, 'home.html', {          'mongo_hosts': replica_set['hosts'],         'mongo_primary_host': replica_set['primary'],         'mongo_connected_host': replica_set['me'],         'mongo_is_primary': replica_set['ismaster'],         'mongo_is_secondary': replica_set['secondary'],     })<\/code><\/pre>\n<p>  <\/p>\n<p>\u041d\u0430\u0448\u0430 \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u044f URL-\u0430\u0434\u0440\u0435\u0441\u043e\u0432 \u0438\u043b\u0438 \u043c\u0430\u0440\u0448\u0440\u0443\u0442\u043e\u0432 \u0434\u043b\u044f \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f \u0432\u044b\u0433\u043b\u044f\u0434\u0438\u0442 \u0442\u0430\u043a:<\/p>\n<p>  <\/p>\n<pre><code class=\"plaintext\">from django.urls import path from tweetapp import views  urlpatterns = [     path('', views.home, name='home'), ]<\/code><\/pre>\n<p>  <\/p>\n<p>\u0410 \u0434\u043b\u044f \u043f\u0440\u043e\u0435\u043a\u0442\u0430 \u2014 URL-\u0430\u0434\u0440\u0435\u0441\u0430 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0439 \u0432\u043a\u043b\u044e\u0447\u0435\u043d\u044b \u0442\u0430\u043a:<\/p>\n<p>  <\/p>\n<pre><code class=\"plaintext\">from django.contrib import admin from django.urls import path, include from django.conf import settings from django.conf.urls.static import static  urlpatterns = [     path('admin\/', admin.site.urls),     path('web', include('tweetapp.urls')), ] + static(settings.STATIC_URL, document_root=settings.STATIC_ROOT)<\/code><\/pre>\n<p>  <\/p>\n<p>\u041d\u0430\u0448 \u0448\u0430\u0431\u043b\u043e\u043d Django, <code>templates\/home.html<\/code>, \u0432\u044b\u0433\u043b\u044f\u0434\u0438\u0442 \u0442\u0430\u043a:<\/p>\n<p>  <\/p>\n<pre><code class=\"plaintext\">&lt;!doctype html&gt; &lt;html lang=&quot;en&quot;&gt; &lt;head&gt;     &lt;meta charset=&quot;utf-8&quot;&gt;     &lt;meta name=&quot;viewport&quot; content=&quot;width=device-width, initial-scale=1, shrink-to-fit=no&quot;&gt;      &lt;link rel=&quot;stylesheet&quot; href=&quot;https:\/\/stackpath.bootstrapcdn.com\/bootstrap\/4.3.1\/css\/bootstrap.min.css&quot; integrity=&quot;sha384-ggOyR0iXCbMQv3Xipma34MD+dH\/1fQ784\/j6cY\/iJTQUOhcWr7x9JvoRxT2MZw1T&quot; crossorigin=&quot;anonymous&quot;&gt;     &lt;link href=&quot;https:\/\/fonts.googleapis.com\/css?family=Armata&quot; rel=&quot;stylesheet&quot;&gt;      &lt;title&gt;Django-Mongo-Consul&lt;\/title&gt; &lt;\/head&gt; &lt;body class=&quot;bg-dark text-white p-5&quot; style=&quot;font-family: Armata&quot;&gt;     &lt;div class=&quot;p-4 border&quot;&gt;         &lt;div class=&quot;m-2&quot;&gt;             &lt;b&gt;Django Database Connection&lt;\/b&gt;         &lt;\/div&gt;         &lt;table class=&quot;table table-dark&quot;&gt;             &lt;thead&gt;                 &lt;tr&gt;                     &lt;th scope=&quot;col&quot;&gt;#&lt;\/th&gt;                     &lt;th scope=&quot;col&quot;&gt;Property&lt;\/th&gt;                     &lt;th scope=&quot;col&quot;&gt;Value&lt;\/th&gt;                 &lt;\/tr&gt;             &lt;\/thead&gt;             &lt;tbody&gt;                 &lt;tr&gt;                     &lt;td&gt;1&lt;\/td&gt;                     &lt;td&gt;Mongo Hosts&lt;\/td&gt;                     &lt;td&gt;{% for host in mongo_hosts %}{{ host }}&lt;br\/&gt;{% endfor %}&lt;\/td&gt;                 &lt;\/tr&gt;                 &lt;tr&gt;                     &lt;td&gt;2&lt;\/td&gt;                     &lt;td&gt;Mongo Primary Address&lt;\/td&gt;                     &lt;td&gt;{{ mongo_primary_host }}&lt;\/td&gt;                 &lt;\/tr&gt;                 &lt;tr&gt;                     &lt;td&gt;3&lt;\/td&gt;                     &lt;td&gt;Mongo Connected Address&lt;\/td&gt;                     &lt;td&gt;{{ mongo_connected_host }}&lt;\/td&gt;                 &lt;\/tr&gt;                 &lt;tr&gt;                     &lt;td&gt;4&lt;\/td&gt;                     &lt;td&gt;Mongo - Is Primary?&lt;\/td&gt;                     &lt;td&gt;{{ mongo_is_primary }}&lt;\/td&gt;                 &lt;\/tr&gt;                 &lt;tr&gt;                     &lt;td&gt;5&lt;\/td&gt;                     &lt;td&gt;Mongo - Is Secondary?&lt;\/td&gt;                     &lt;td&gt;{{ mongo_is_secondary }}&lt;\/td&gt;                 &lt;\/tr&gt;             &lt;\/tbody&gt;         &lt;\/table&gt;     &lt;\/div&gt;      &lt;script src=&quot;https:\/\/code.jquery.com\/jquery-3.3.1.slim.min.js&quot; integrity=&quot;sha384-q8i\/X+965DzO0rT7abK41JStQIAqVgRVzpbzo5smXKp4YfRvH+8abtTE1Pi6jizo&quot; crossorigin=&quot;anonymous&quot;&gt;&lt;\/script&gt;     &lt;script src=&quot;https:\/\/cdnjs.cloudflare.com\/ajax\/libs\/popper.js\/1.14.7\/umd\/popper.min.js&quot; integrity=&quot;sha384-UO2eT0CpHqdSJQ6hJty5KVphtPhzWj9WO1clHTMGa3JDZwrnQq4sF86dIHNDz0W1&quot; crossorigin=&quot;anonymous&quot;&gt;&lt;\/script&gt;     &lt;script src=&quot;https:\/\/stackpath.bootstrapcdn.com\/bootstrap\/4.3.1\/js\/bootstrap.min.js&quot; integrity=&quot;sha384-JjSmVgyd0p3pXB1rRibZUAYoIIy6OrQ6VrjIEaFf\/nJGzIxFDsf4x0xIM+B07jRM&quot; crossorigin=&quot;anonymous&quot;&gt;&lt;\/script&gt; &lt;\/body&gt; &lt;\/html&gt;<\/code><\/pre>\n<p>  <\/p>\n<p>\u0427\u0442\u043e\u0431\u044b \u0437\u0430\u043f\u0443\u0441\u0442\u0438\u0442\u044c \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435, \u043d\u0430\u043c \u043d\u0443\u0436\u043d\u043e \u0441\u043d\u0430\u0447\u0430\u043b\u0430 \u043f\u0435\u0440\u0435\u043d\u0435\u0441\u0442\u0438 \u0431\u0430\u0437\u0443 \u0434\u0430\u043d\u043d\u044b\u0445, \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044f \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0443\u044e \u043a\u043e\u043c\u0430\u043d\u0434\u0443:<\/p>\n<p>  <\/p>\n<pre><code class=\"plaintext\">python .\/manage.py migrate<\/code><\/pre>\n<p>  <\/p>\n<p>\u0410 \u0442\u0430\u043a\u0436\u0435 \u0441\u043e\u0431\u0440\u0430\u0442\u044c \u0432\u0441\u0435 \u0441\u0442\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0438\u0435 \u0430\u043a\u0442\u0438\u0432\u044b \u0432 \u0441\u0442\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0438\u0439 \u043a\u0430\u0442\u0430\u043b\u043e\u0433:<\/p>\n<p>  <\/p>\n<pre><code class=\"plaintext\">python .\/manage.py collectstatic --noinput<\/code><\/pre>\n<p>  <\/p>\n<p>\u0422\u0435\u043f\u0435\u0440\u044c \u0437\u0430\u043f\u0443\u0441\u0442\u0438\u0442\u0435 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435 Django \u0441 Gunicorn, HTTP-\u0441\u0435\u0440\u0432\u0435\u0440\u043e\u043c WSGI, \u043a\u0430\u043a \u043f\u043e\u043a\u0430\u0437\u0430\u043d\u043e \u043d\u0438\u0436\u0435:<\/p>\n<p>  <\/p>\n<pre><code class=\"plaintext\">gunicorn --bind 0.0.0.0:8000 --access-logfile - tweeter.wsgi:application<\/code><\/pre>\n<p>  <\/p>\n<p>\u042d\u0442\u043e \u0434\u0430\u0435\u0442 \u043d\u0430\u043c \u0431\u0430\u0437\u043e\u0432\u043e\u0435 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435 Django, \u043f\u043e\u0434\u043e\u0431\u043d\u043e\u0435 \u0431\u043b\u043e\u0433\u0443, \u043a\u043e\u0442\u043e\u0440\u043e\u0435 \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0430\u0435\u0442\u0441\u044f \u043a \u0431\u044d\u043a\u044d\u043d\u0434\u0443 MongoDB.<\/p>\n<p>  <\/p>\n<p>\u041c\u044b \u043e\u0431\u0441\u0443\u0434\u0438\u043c \u043a\u043e\u043d\u0442\u0435\u0439\u043d\u0435\u0440\u0438\u0437\u0430\u0446\u0438\u044e \u044d\u0442\u043e\u0433\u043e \u0432\u0435\u0431-\u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f Django \u0432 \u043f\u043e\u0441\u043b\u0435\u0434\u043d\u0435\u0439 \u0447\u0430\u0441\u0442\u0438 \u044d\u0442\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0438.<\/p>\n<p>  <\/p>\n<h4 id=\"consul\">Consul<\/h4>\n<p>  <\/p>\n<p>\u041c\u044b \u0440\u0430\u0437\u043c\u0435\u0449\u0430\u0435\u043c <a href=\"https:\/\/www.consul.io\/docs\/agent\/basics.html\" rel=\"nofollow\">\u0430\u0433\u0435\u043d\u0442 Consul<\/a> \u0434\u043b\u044f \u043a\u0430\u0436\u0434\u043e\u0439 \u0441\u043b\u0443\u0436\u0431\u044b \u0432 \u0440\u0430\u043c\u043a\u0430\u0445 \u043d\u0430\u0448\u0435\u0439 \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0438 Consul.<\/p>\n<p>  <\/p>\n<p>\u0410\u0433\u0435\u043d\u0442 Consul \u043e\u0442\u0432\u0435\u0447\u0430\u0435\u0442 \u0437\u0430 \u043e\u0431\u043d\u0430\u0440\u0443\u0436\u0435\u043d\u0438\u0435 \u0441\u043b\u0443\u0436\u0431\u044b \u043f\u0443\u0442\u0435\u043c <a href=\"https:\/\/velotio.com\/blog\/2019\/3\/11\/hashicorp-consul-guide-1\" rel=\"nofollow\">\u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0430\u0446\u0438\u0438 \u0441\u043b\u0443\u0436\u0431\u044b \u0432 \u043a\u043b\u0430\u0441\u0442\u0435\u0440\u0435 Consul<\/a>, \u0430 \u0442\u0430\u043a\u0436\u0435 \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u0438\u0440\u0443\u0435\u0442 \u0440\u0430\u0431\u043e\u0442\u043e\u0441\u043f\u043e\u0441\u043e\u0431\u043d\u043e\u0441\u0442\u044c \u043a\u0430\u0436\u0434\u043e\u0433\u043e \u044d\u043a\u0437\u0435\u043c\u043f\u043b\u044f\u0440\u0430 \u0441\u043b\u0443\u0436\u0431\u044b.<\/p>\n<p>  <\/p>\n<h3 id=\"consul-na-uzlah-na-kotoryh-rabotaet-mongodb-replica-set\">Consul \u043d\u0430 \u0443\u0437\u043b\u0430\u0445, \u043d\u0430 \u043a\u043e\u0442\u043e\u0440\u044b\u0445 \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 MongoDB Replica Set<\/h3>\n<p>  <\/p>\n<p>\u0421\u043d\u0430\u0447\u0430\u043b\u0430 \u043c\u044b \u043e\u0431\u0441\u0443\u0434\u0438\u043c \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0443 Consul \u0432 \u043a\u043e\u043d\u0442\u0435\u043a\u0441\u0442\u0435 MongoDB Replica Set, \u043f\u043e\u0441\u043a\u043e\u043b\u044c\u043a\u0443 \u043e\u043d\u0430 \u0440\u0435\u0448\u0430\u0435\u0442 \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043d\u0443\u044e \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u0443. \u0412 \u043b\u044e\u0431\u043e\u0439 \u043c\u043e\u043c\u0435\u043d\u0442 \u0432\u0440\u0435\u043c\u0435\u043d\u0438 \u043e\u0434\u0438\u043d \u0438\u0437 \u044d\u043a\u0437\u0435\u043c\u043f\u043b\u044f\u0440\u043e\u0432 MongoDB \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u043f\u0435\u0440\u0432\u0438\u0447\u043d\u044b\u043c \u0438\u043b\u0438 \u0432\u0442\u043e\u0440\u0438\u0447\u043d\u044b\u043c.<\/p>\n<p>  <\/p>\n<p>\u0410\u0433\u0435\u043d\u0442 Consul, \u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0438\u0440\u0443\u044e\u0449\u0438\u0439 \u0438 \u043e\u0442\u0441\u043b\u0435\u0436\u0438\u0432\u0430\u044e\u0449\u0438\u0439 \u043d\u0430\u0448 \u044d\u043a\u0437\u0435\u043c\u043f\u043b\u044f\u0440 MongoDB \u0432 \u043d\u0430\u0431\u043e\u0440\u0435 \u0440\u0435\u043f\u043b\u0438\u043a, \u0438\u043c\u0435\u0435\u0442 \u0443\u043d\u0438\u043a\u0430\u043b\u044c\u043d\u044b\u0439 \u043c\u0435\u0445\u0430\u043d\u0438\u0437\u043c \u2014 \u0434\u0438\u043d\u0430\u043c\u0438\u0447\u0435\u0441\u043a\u0443\u044e \u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0430\u0446\u0438\u044e \u0438 \u043e\u0442\u043c\u0435\u043d\u0443 \u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0430\u0446\u0438\u0438 \u0441\u043b\u0443\u0436\u0431\u044b MongoDB \u0432 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 \u043f\u0435\u0440\u0432\u0438\u0447\u043d\u043e\u0433\u043e \u0438\u043b\u0438 \u0432\u0442\u043e\u0440\u0438\u0447\u043d\u043e\u0433\u043e \u044d\u043a\u0437\u0435\u043c\u043f\u043b\u044f\u0440\u0430 \u0432 \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u0438 \u043e\u0442 \u0442\u043e\u0433\u043e, \u043a\u0430\u043a\u043e\u0439 \u043d\u0430\u0431\u043e\u0440 \u0440\u0435\u043f\u043b\u0438\u043a \u043d\u0430\u0437\u043d\u0430\u0447\u0438\u043b \u0435\u0433\u043e.<\/p>\n<p>  <\/p>\n<p>\u041c\u044b \u0434\u043e\u0441\u0442\u0438\u0433\u0430\u0435\u043c \u044d\u0442\u043e\u0433\u043e \u0434\u0438\u043d\u0430\u043c\u0438\u0437\u043c\u0430 \u043f\u0443\u0442\u0435\u043c \u043d\u0430\u043f\u0438\u0441\u0430\u043d\u0438\u044f \u0438 \u0437\u0430\u043f\u0443\u0441\u043a\u0430 \u0441\u0446\u0435\u043d\u0430\u0440\u0438\u044f \u043e\u0431\u043e\u043b\u043e\u0447\u043a\u0438 \u043f\u043e\u0441\u043b\u0435 \u0438\u043d\u0442\u0435\u0440\u0432\u0430\u043b\u0430, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043f\u0435\u0440\u0435\u043a\u043b\u044e\u0447\u0430\u0435\u0442 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u0435 \u0441\u043b\u0443\u0436\u0431\u044b Consul \u0434\u043b\u044f MongoDB Primary \u0438 MongoDB Secondary \u043d\u0430 Consul Agent \u0443\u0437\u043b\u0430 \u044d\u043a\u0437\u0435\u043c\u043f\u043b\u044f\u0440\u0430.<\/p>\n<p>  <\/p>\n<p>\u041e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u044f \u0441\u0435\u0440\u0432\u0438\u0441\u043e\u0432 \u0434\u043b\u044f \u0441\u0435\u0440\u0432\u0438\u0441\u043e\u0432 MongoDB \u0445\u0440\u0430\u043d\u044f\u0442\u0441\u044f \u0432 \u0432\u0438\u0434\u0435 \u0444\u0430\u0439\u043b\u043e\u0432 JSON \u0432 \u043a\u0430\u0442\u0430\u043b\u043e\u0433\u0435 \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u0438 Consul <code>\/etc\/config.d<\/code>.<\/p>\n<p>  <\/p>\n<p>\u041e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u0435 \u0441\u043b\u0443\u0436\u0431\u044b \u0434\u043b\u044f \u043f\u0435\u0440\u0432\u0438\u0447\u043d\u043e\u0433\u043e \u044d\u043a\u0437\u0435\u043c\u043f\u043b\u044f\u0440\u0430 MongoDB:<\/p>\n<p>  <\/p>\n<pre><code class=\"plaintext\">{     &quot;service&quot;: {         &quot;name&quot;: &quot;mongo-primary&quot;,         &quot;port&quot;: 27017,         &quot;tags&quot;: [             &quot;nosql&quot;,             &quot;database&quot;         ],         &quot;check&quot;: {             &quot;id&quot;: &quot;mongo_primary_status&quot;,             &quot;name&quot;: &quot;Mongo Primary Status&quot;,             &quot;args&quot;: [&quot;\/etc\/consul.d\/check_scripts\/mongo_primary_check.sh&quot;],             &quot;interval&quot;: &quot;30s&quot;,             &quot;timeout&quot;: &quot;20s&quot;         }     } }<\/code><\/pre>\n<p>  <\/p>\n<p>\u0415\u0441\u043b\u0438 \u0432\u044b \u043f\u0440\u0438\u0441\u043c\u043e\u0442\u0440\u0438\u0442\u0435\u0441\u044c, \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u0435 \u0441\u043b\u0443\u0436\u0431\u044b \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u043d\u0430\u043c \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u0437\u0430\u043f\u0438\u0441\u044c DNS, \u0441\u043f\u0435\u0446\u0438\u0444\u0438\u0447\u043d\u0443\u044e \u0434\u043b\u044f MongoDB Primary, \u0430 \u043d\u0435 \u043e\u0431\u0449\u0438\u0439 \u044d\u043a\u0437\u0435\u043c\u043f\u043b\u044f\u0440 MongoDB. \u042d\u0442\u043e \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u043d\u0430\u043c \u043e\u0442\u043f\u0440\u0430\u0432\u043b\u044f\u0442\u044c \u0437\u0430\u043f\u0438\u0441\u0438 \u0431\u0430\u0437\u044b \u0434\u0430\u043d\u043d\u044b\u0445 \u0432 \u043a\u043e\u043d\u043a\u0440\u0435\u0442\u043d\u044b\u0439 \u044d\u043a\u0437\u0435\u043c\u043f\u043b\u044f\u0440 MongoDB. \u0412 \u0441\u043b\u0443\u0447\u0430\u0435 \u043d\u0430\u0431\u043e\u0440\u0430 \u0440\u0435\u043f\u043b\u0438\u043a \u0437\u0430\u043f\u0438\u0441\u0438 \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u044e\u0442\u0441\u044f MongoDB Primary.<\/p>\n<p>  <\/p>\n<p>\u0422\u0430\u043a\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c, \u043c\u044b \u043c\u043e\u0436\u0435\u043c \u0434\u043e\u0441\u0442\u0438\u0447\u044c \u043a\u0430\u043a \u043e\u0431\u043d\u0430\u0440\u0443\u0436\u0435\u043d\u0438\u044f \u0441\u0435\u0440\u0432\u0438\u0441\u043e\u0432, \u0442\u0430\u043a \u0438 \u043c\u043e\u043d\u0438\u0442\u043e\u0440\u0438\u043d\u0433\u0430 \u0440\u0430\u0431\u043e\u0442\u043e\u0441\u043f\u043e\u0441\u043e\u0431\u043d\u043e\u0441\u0442\u0438 \u0434\u043b\u044f \u043f\u0435\u0440\u0432\u0438\u0447\u043d\u043e\u0433\u043e \u044d\u043a\u0437\u0435\u043c\u043f\u043b\u044f\u0440\u0430 MongoDB.<\/p>\n<p>  <\/p>\n<p>\u0422\u043e\u0447\u043d\u043e \u0442\u0430\u043a \u0436\u0435 \u0441 \u043d\u0435\u0431\u043e\u043b\u044c\u0448\u0438\u043c \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u0435\u043c \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u0435 \u0441\u043b\u0443\u0436\u0431\u044b \u0434\u043b\u044f \u0432\u0442\u043e\u0440\u0438\u0447\u043d\u043e\u0433\u043e \u044d\u043a\u0437\u0435\u043c\u043f\u043b\u044f\u0440\u0430 MongoDB \u0432\u044b\u0433\u043b\u044f\u0434\u0438\u0442 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c:<\/p>\n<p>  <\/p>\n<pre><code class=\"plaintext\">{     &quot;service&quot;: {         &quot;name&quot;: &quot;mongo-secondary&quot;,         &quot;port&quot;: 27017,         &quot;tags&quot;: [             &quot;nosql&quot;,             &quot;database&quot;         ],         &quot;check&quot;: {             &quot;id&quot;: &quot;mongo_secondary_status&quot;,             &quot;name&quot;: &quot;Mongo Secondary Status&quot;,             &quot;args&quot;: [&quot;\/etc\/consul.d\/check_scripts\/mongo_secondary_check.sh&quot;],             &quot;interval&quot;: &quot;30s&quot;,             &quot;timeout&quot;: &quot;20s&quot;         }     } }<\/code><\/pre>\n<p>  <\/p>\n<p>\u0423\u0447\u0438\u0442\u044b\u0432\u0430\u044f \u0432\u0435\u0441\u044c \u044d\u0442\u043e\u0442 \u043a\u043e\u043d\u0442\u0435\u043a\u0441\u0442, \u043c\u043e\u0436\u0435\u0442\u0435 \u043b\u0438 \u0432\u044b \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u0438\u0442\u044c, \u043a\u0430\u043a \u043c\u044b \u043c\u043e\u0436\u0435\u043c \u0434\u0438\u043d\u0430\u043c\u0438\u0447\u0435\u0441\u043a\u0438 \u043f\u0435\u0440\u0435\u043a\u043b\u044e\u0447\u0430\u0442\u044c \u044d\u0442\u0438 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u044f \u0441\u0435\u0440\u0432\u0438\u0441\u043e\u0432?<\/p>\n<p>  <\/p>\n<p>\u041c\u044b \u043c\u043e\u0436\u0435\u043c \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0438\u0442\u044c, \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u043b\u0438 \u0434\u0430\u043d\u043d\u044b\u0439 <a href=\"https:\/\/docs.mongodb.com\/manual\/reference\/command\/isMaster\" rel=\"nofollow\">\u044d\u043a\u0437\u0435\u043c\u043f\u043b\u044f\u0440 MongoDB \u043e\u0441\u043d\u043e\u0432\u043d\u044b\u043c<\/a> \u0438\u043b\u0438 \u043d\u0435\u0442, \u0437\u0430\u043f\u0443\u0441\u0442\u0438\u0432 \u043a\u043e\u043c\u0430\u043d\u0434\u0443 <code>db.isMaster()<\/code> \u0432 MongoDB shell.<\/p>\n<p>  <\/p>\n<p>\u041c\u043e\u0436\u043d\u043e \u043e\u0444\u043e\u0440\u043c\u0438\u0442\u044c \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0443 \u0432 \u0432\u0438\u0434\u0435 \u0441\u043a\u0440\u0438\u043f\u0442\u0430 \u043e\u0431\u043e\u043b\u043e\u0447\u043a\u0438 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c:<\/p>\n<p>  <\/p>\n<pre><code class=\"plaintext\">#!\/bin\/bash  mongo_primary=$(mongo --quiet --eval 'JSON.stringify(db.isMaster())' | jq -r .ismaster 2&gt; \/dev\/null) if [[ $mongo_primary == false ]]; then     exit 1 fi  echo &quot;Mongo primary healthy and reachable&quot;<\/code><\/pre>\n<p>  <\/p>\n<p>\u0422\u043e\u0447\u043d\u043e \u0442\u0430\u043a \u0436\u0435 \u043d\u0435\u043e\u0441\u043d\u043e\u0432\u043d\u044b\u0435 \u044d\u043a\u0437\u0435\u043c\u043f\u043b\u044f\u0440\u044b MongoDB \u0442\u0430\u043a\u0436\u0435 \u043c\u043e\u0433\u0443\u0442 \u0431\u044b\u0442\u044c \u043f\u0440\u043e\u0432\u0435\u0440\u0435\u043d\u044b \u043d\u0430 \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0438\u0435 \u0442\u043e\u0439 \u0436\u0435 \u043a\u043e\u043c\u0430\u043d\u0434\u0435, \u043f\u0443\u0442\u0435\u043c \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0438 <code>\u0432\u0442\u043e\u0440\u0438\u0447\u043d\u043e\u0433\u043e<\/code> \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f:<\/p>\n<p>  <\/p>\n<pre><code class=\"plaintext\">#!\/bin\/bash  mongo_secondary=$(mongo --quiet --eval 'JSON.stringify(db.isMaster())' | jq -r .secondary 2&gt; \/dev\/null) if [[ $mongo_secondary == false ]]; then     exit 1 fi  echo &quot;Mongo secondary healthy and reachable&quot;<\/code><\/pre>\n<p>  <\/p>\n<p>\u041f\u0440\u0438\u043c\u0435\u0447\u0430\u043d\u0438\u0435. \u041c\u044b \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c <code>jq<\/code> \u2014 \u043b\u0435\u0433\u043a\u0438\u0439 \u0438 \u0433\u0438\u0431\u043a\u0438\u0439 \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u043e\u0440 JSON \u043a\u043e\u043c\u0430\u043d\u0434\u043d\u043e\u0439 \u0441\u0442\u0440\u043e\u043a\u0438 \u2014 \u0434\u043b\u044f \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0438 \u0432\u044b\u0445\u043e\u0434\u043d\u044b\u0445 \u0434\u0430\u043d\u043d\u044b\u0445 \u043a\u043e\u043c\u0430\u043d\u0434 \u043e\u0431\u043e\u043b\u043e\u0447\u043a\u0438 MongoDB \u0432 \u043a\u043e\u0434\u0438\u0440\u043e\u0432\u043a\u0435 JSON.<\/p>\n<p>  <\/p>\n<p>\u041e\u0434\u0438\u043d \u0438\u0437 \u0441\u043f\u043e\u0441\u043e\u0431\u043e\u0432 \u043d\u0430\u043f\u0438\u0441\u0430\u043d\u0438\u044f \u0441\u0446\u0435\u043d\u0430\u0440\u0438\u044f, \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u044e\u0449\u0435\u0433\u043e \u044d\u0442\u043e\u0442 \u0434\u0438\u043d\u0430\u043c\u0438\u0447\u0435\u0441\u043a\u0438\u0439 \u043f\u0435\u0440\u0435\u043a\u043b\u044e\u0447\u0430\u0442\u0435\u043b\u044c, \u0432\u044b\u0433\u043b\u044f\u0434\u0438\u0442 \u0442\u0430\u043a:<\/p>\n<p>  <\/p>\n<pre><code class=\"plaintext\">#!\/bin\/bash  # Wait until Mongo starts while [[ $(ps aux | grep [m]ongod | wc -l) -ne 1 ]]; do     sleep 5 done  REGISTER_MASTER=0 REGISTER_SECONDARY=0  mongo_primary=$(mongo --quiet --eval 'JSON.stringify(db.isMaster())' | jq -r .ismaster 2&gt; \/dev\/null) mongo_secondary=$(mongo --quiet --eval 'JSON.stringify(db.isMaster())' | jq -r .secondary 2&gt; \/dev\/null)    if [[ $mongo_primary == false &amp;&amp; $mongo_secondary == true ]]; then    # Deregister as Mongo Master   if [[ -a \/etc\/consul.d\/check_scripts\/mongo_primary_check.sh &amp;&amp; -a \/etc\/consul.d\/mongo_primary.json ]]; then     rm -f \/etc\/consul.d\/check_scripts\/mongo_primary_check.sh     rm -f \/etc\/consul.d\/mongo_primary.json      REGISTER_MASTER=1   fi    # Register as Mongo Secondary   if [[ ! -a \/etc\/consul.d\/check_scripts\/mongo_secondary_check.sh &amp;&amp; ! -a \/etc\/consul.d\/mongo_secondary.json ]]; then     cp -u \/opt\/checks\/check_scripts\/mongo_secondary_check.sh \/etc\/consul.d\/check_scripts\/     cp -u \/opt\/checks\/mongo_secondary.json \/etc\/consul.d\/      REGISTER_SECONDARY=1   fi  else    # Register as Mongo Master   if [[ ! -a \/etc\/consul.d\/check_scripts\/mongo_primary_check.sh &amp;&amp; ! -a \/etc\/consul.d\/mongo_primary.json ]]; then     cp -u \/opt\/checks\/check_scripts\/mongo_primary_check.sh \/etc\/consul.d\/check_scripts\/     cp -u \/opt\/checks\/mongo_primary.json \/etc\/consul.d\/      REGISTER_MASTER=2   fi    # Deregister as Mongo Secondary   if [[ -a \/etc\/consul.d\/check_scripts\/mongo_secondary_check.sh &amp;&amp; -a \/etc\/consul.d\/mongo_secondary.json ]]; then     rm -f \/etc\/consul.d\/check_scripts\/mongo_secondary_check.sh     rm -f \/etc\/consul.d\/mongo_secondary.json      REGISTER_SECONDARY=2   fi  fi  if [[ $REGISTER_MASTER -ne 0 &amp;&amp; $REGISTER_SECONDARY -ne 0 ]]; then   consul reload fi<\/code><\/pre>\n<p>  <\/p>\n<p>\u041f\u0440\u0438\u043c\u0435\u0447\u0430\u043d\u0438\u0435. \u042d\u0442\u043e \u043f\u0440\u0438\u043c\u0435\u0440 \u0441\u0446\u0435\u043d\u0430\u0440\u0438\u044f. \u041d\u043e \u043c\u044b \u043c\u043e\u0436\u0435\u043c \u043f\u0440\u043e\u044f\u0432\u0438\u0442\u044c \u0431\u043e\u043b\u0435\u0435 \u0442\u0432\u043e\u0440\u0447\u0435\u0441\u043a\u0438\u0439 \u043f\u043e\u0434\u0445\u043e\u0434 \u0438 \u043e\u043f\u0442\u0438\u043c\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0441\u0446\u0435\u043d\u0430\u0440\u0438\u0439.<\/p>\n<p>  <\/p>\n<p>\u041a\u043e\u0433\u0434\u0430 \u043c\u044b \u0437\u0430\u043a\u043e\u043d\u0447\u0438\u043c \u0441 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u044f\u043c\u0438 \u043d\u0430\u0448\u0438\u0445 \u0441\u0435\u0440\u0432\u0438\u0441\u043e\u0432, \u043c\u044b \u043c\u043e\u0436\u0435\u043c \u0437\u0430\u043f\u0443\u0441\u0442\u0438\u0442\u044c \u0430\u0433\u0435\u043d\u0442 Consul \u043d\u0430 \u043a\u0430\u0436\u0434\u043e\u043c \u0443\u0437\u043b\u0435 MongoDB. \u0414\u043b\u044f \u0437\u0430\u043f\u0443\u0441\u043a\u0430 \u0430\u0433\u0435\u043d\u0442\u0430 \u043c\u044b \u0431\u0443\u0434\u0435\u043c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0443\u044e \u043a\u043e\u043c\u0430\u043d\u0434\u0443:<\/p>\n<p>  <\/p>\n<pre><code class=\"plaintext\">consul agent -bind 33.10.0.3 \\     -advertise 33.10.0.3 \\     -join consul_server \\     -node mongo_1 \\     -dns-port 53 \\     -data-dir \/data \\     -config-dir \/etc\/consul.d \\     -enable-local-script-checks<\/code><\/pre>\n<p>  <\/p>\n<p>\u0417\u0434\u0435\u0441\u044c <code>consul_server<\/code> \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442 \u0445\u043e\u0441\u0442, \u043d\u0430 \u043a\u043e\u0442\u043e\u0440\u043e\u043c \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 Consul Server. \u0422\u043e\u0447\u043d\u043e \u0442\u0430\u043a \u0436\u0435 \u043c\u044b \u043c\u043e\u0436\u0435\u043c \u0437\u0430\u043f\u0443\u0441\u043a\u0430\u0442\u044c \u0442\u0430\u043a\u0438\u0435 \u0430\u0433\u0435\u043d\u0442\u044b \u043d\u0430 \u043a\u0430\u0436\u0434\u043e\u043c \u0438\u0437 \u0434\u0440\u0443\u0433\u0438\u0445 \u0443\u0437\u043b\u043e\u0432 \u044d\u043a\u0437\u0435\u043c\u043f\u043b\u044f\u0440\u0430 MongoDB.<\/p>\n<p>  <\/p>\n<p>\u041f\u0440\u0438\u043c\u0435\u0447\u0430\u043d\u0438\u0435. \u0415\u0441\u043b\u0438 \u0443 \u043d\u0430\u0441 \u0435\u0441\u0442\u044c \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u044d\u043a\u0437\u0435\u043c\u043f\u043b\u044f\u0440\u043e\u0432 MongoDB, \u0440\u0430\u0431\u043e\u0442\u0430\u044e\u0449\u0438\u0445 \u043d\u0430 \u043e\u0434\u043d\u043e\u043c \u0445\u043e\u0441\u0442\u0435, \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u0435 \u0441\u043b\u0443\u0436\u0431\u044b \u0438\u0437\u043c\u0435\u043d\u0438\u0442\u0441\u044f, \u0447\u0442\u043e\u0431\u044b \u043e\u0442\u0440\u0430\u0437\u0438\u0442\u044c \u0440\u0430\u0437\u043d\u044b\u0435 \u043f\u043e\u0440\u0442\u044b, \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c\u044b\u0435 \u043a\u0430\u0436\u0434\u044b\u043c \u044d\u043a\u0437\u0435\u043c\u043f\u043b\u044f\u0440\u043e\u043c \u0434\u043b\u044f \u0443\u043d\u0438\u043a\u0430\u043b\u044c\u043d\u043e\u0439 \u0438\u0434\u0435\u043d\u0442\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u0438, \u043e\u0431\u043d\u0430\u0440\u0443\u0436\u0435\u043d\u0438\u044f \u0438 \u043c\u043e\u043d\u0438\u0442\u043e\u0440\u0438\u043d\u0433\u0430 \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u043e\u0433\u043e \u044d\u043a\u0437\u0435\u043c\u043f\u043b\u044f\u0440\u0430 MongoDB.<\/p>\n<p>  <\/p>\n<h3 id=\"consul-na-uzlah-na-kotoryh-zapuscheno-prilozhenie-django\">Consul \u043d\u0430 \u0443\u0437\u043b\u0430\u0445, \u043d\u0430 \u043a\u043e\u0442\u043e\u0440\u044b\u0445 \u0437\u0430\u043f\u0443\u0449\u0435\u043d\u043e \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435 Django<\/h3>\n<p>  <\/p>\n<p>\u0414\u043b\u044f \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f Django \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0430 Consul \u0431\u0443\u0434\u0435\u0442 \u043e\u0447\u0435\u043d\u044c \u043f\u0440\u043e\u0441\u0442\u043e\u0439. \u041d\u0430\u043c \u043d\u0443\u0436\u043d\u043e \u0442\u043e\u043b\u044c\u043a\u043e \u043e\u0442\u0441\u043b\u0435\u0436\u0438\u0432\u0430\u0442\u044c \u043f\u043e\u0440\u0442 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f Django, \u043d\u0430 \u043a\u043e\u0442\u043e\u0440\u043e\u043c Gunicorn \u043f\u0440\u043e\u0441\u043b\u0443\u0448\u0438\u0432\u0430\u0435\u0442 \u0437\u0430\u043f\u0440\u043e\u0441\u044b.<\/p>\n<p>  <\/p>\n<p>\u041e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u0435 \u0441\u043b\u0443\u0436\u0431\u044b Consul \u0431\u0443\u0434\u0435\u0442 \u0432\u044b\u0433\u043b\u044f\u0434\u0435\u0442\u044c \u0442\u0430\u043a:<\/p>\n<p>  <\/p>\n<pre><code class=\"plaintext\">{     &quot;service&quot;: {         &quot;name&quot;: &quot;web&quot;,         &quot;port&quot;: 8000,         &quot;tags&quot;: [             &quot;web&quot;,             &quot;application&quot;,             &quot;urlprefix-\/web&quot;         ],         &quot;check&quot;: {             &quot;id&quot;: &quot;web_app_status&quot;,             &quot;name&quot;: &quot;Web Application Status&quot;,             &quot;tcp&quot;: &quot;localhost:8000&quot;,             &quot;interval&quot;: &quot;30s&quot;,             &quot;timeout&quot;: &quot;20s&quot;         }     } }<\/code><\/pre>\n<p>  <\/p>\n<p>\u041a\u043e\u0433\u0434\u0430 \u0443 \u043d\u0430\u0441 \u0435\u0441\u0442\u044c \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u0435 \u0441\u043b\u0443\u0436\u0431\u044b Consul \u0434\u043b\u044f \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f Django, \u043c\u044b \u043c\u043e\u0436\u0435\u043c \u0437\u0430\u043f\u0443\u0441\u0442\u0438\u0442\u044c \u0430\u0433\u0435\u043d\u0442\u0430 Consul, \u0441\u0438\u0434\u044f\u0449\u0435\u0433\u043e \u043d\u0430 \u0443\u0437\u043b\u0435, \u0432 \u043a\u043e\u0442\u043e\u0440\u043e\u043c \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435 Django \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u043a\u0430\u043a \u0441\u043b\u0443\u0436\u0431\u0430. \u0427\u0442\u043e\u0431\u044b \u0437\u0430\u043f\u0443\u0441\u0442\u0438\u0442\u044c \u0430\u0433\u0435\u043d\u0442\u0430 Consul, \u043c\u044b \u0434\u043e\u043b\u0436\u043d\u044b \u0437\u0430\u043f\u0443\u0441\u0442\u0438\u0442\u044c \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0443\u044e \u043a\u043e\u043c\u0430\u043d\u0434\u0443:<\/p>\n<p>  <\/p>\n<pre><code class=\"plaintext\">consul agent -bind 33.10.0.10 \\     -advertise 33.10.0.10 \\     -join consul_server \\     -node web_1 \\     -dns-port 53 \\     -data-dir \/data \\     -config-dir \/etc\/consul.d \\     -enable-local-script-checks<\/code><\/pre>\n<p>  <\/p>\n<h3 id=\"consul-server\">Consul \u0421\u0435\u0440\u0432\u0435\u0440<\/h3>\n<p>  <\/p>\n<p>\u041c\u044b \u0437\u0430\u043f\u0443\u0441\u043a\u0430\u0435\u043c \u043a\u043b\u0430\u0441\u0442\u0435\u0440 Consul \u0441 \u0432\u044b\u0434\u0435\u043b\u0435\u043d\u043d\u044b\u043c \u0441\u0435\u0440\u0432\u0435\u0440\u043d\u044b\u043c \u0443\u0437\u043b\u043e\u043c Consul. \u0423\u0437\u0435\u043b \u0441\u0435\u0440\u0432\u0435\u0440\u0430 Consul \u043c\u043e\u0436\u0435\u0442 \u043b\u0435\u0433\u043a\u043e \u0440\u0430\u0437\u043c\u0435\u0449\u0430\u0442\u044c, \u043e\u0431\u043d\u0430\u0440\u0443\u0436\u0438\u0432\u0430\u0442\u044c \u0438 \u043e\u0442\u0441\u043b\u0435\u0436\u0438\u0432\u0430\u0442\u044c \u0440\u0430\u0431\u043e\u0442\u0430\u044e\u0449\u0438\u0435 \u043d\u0430 \u043d\u0435\u043c \u0441\u043b\u0443\u0436\u0431\u044b \u0442\u043e\u0447\u043d\u043e \u0442\u0430\u043a \u0436\u0435, \u043a\u0430\u043a \u043c\u044b \u0434\u0435\u043b\u0430\u043b\u0438 \u044d\u0442\u043e \u0432 \u043f\u0440\u0438\u0432\u0435\u0434\u0435\u043d\u043d\u044b\u0445 \u0432\u044b\u0448\u0435 \u0440\u0430\u0437\u0434\u0435\u043b\u0430\u0445 \u0434\u043b\u044f \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0439 MongoDB \u0438 Django.<\/p>\n<p>  <\/p>\n<p>\u0427\u0442\u043e\u0431\u044b \u0437\u0430\u043f\u0443\u0441\u0442\u0438\u0442\u044c Consul \u0432 \u0440\u0435\u0436\u0438\u043c\u0435 \u0441\u0435\u0440\u0432\u0435\u0440\u0430 \u0438 \u0440\u0430\u0437\u0440\u0435\u0448\u0438\u0442\u044c \u0430\u0433\u0435\u043d\u0442\u0430\u043c \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0430\u0442\u044c\u0441\u044f \u043a \u043d\u0435\u043c\u0443, \u043c\u044b \u0437\u0430\u043f\u0443\u0441\u0442\u0438\u043c \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0443\u044e \u043a\u043e\u043c\u0430\u043d\u0434\u0443 \u043d\u0430 \u0443\u0437\u043b\u0435, \u043d\u0430 \u043a\u043e\u0442\u043e\u0440\u043e\u043c \u043c\u044b \u0445\u043e\u0442\u0438\u043c \u0437\u0430\u043f\u0443\u0441\u0442\u0438\u0442\u044c \u043d\u0430\u0448 \u0441\u0435\u0440\u0432\u0435\u0440 Consul:<\/p>\n<p>  <\/p>\n<pre><code class=\"plaintext\">consul agent -server \\     -bind 33.10.0.2 \\     -advertise 33.10.0.2 \\     -node consul_server \\     -client 0.0.0.0 \\     -dns-port 53 \\     -data-dir \/data \\     -ui -bootstrap<\/code><\/pre>\n<p>  <\/p>\n<p>\u041d\u0430 \u0434\u0430\u043d\u043d\u044b\u0439 \u043c\u043e\u043c\u0435\u043d\u0442 \u043d\u0430 \u043d\u0430\u0448\u0435\u043c \u0443\u0437\u043b\u0435 \u0441\u0435\u0440\u0432\u0435\u0440\u0430 Consul \u043d\u0435\u0442 \u0441\u043b\u0443\u0436\u0431, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u043d\u0435\u0442 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u0439 \u0441\u043b\u0443\u0436\u0431, \u0441\u0432\u044f\u0437\u0430\u043d\u043d\u044b\u0445 \u0441 \u044d\u0442\u043e\u0439 \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u0435\u0439 \u0430\u0433\u0435\u043d\u0442\u0430 Consul.<\/p>\n<p>  <\/p>\n<h3 id=\"fabio\">Fabio<\/h3>\n<p>  <\/p>\n<p>\u041c\u044b \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u0438 Fabio \u0434\u043b\u044f <a href=\"https:\/\/github.com\/fabiolb\/fabio\" rel=\"nofollow\">\u0430\u0432\u0442\u043e\u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u0438<\/a> \u0438 \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u043a\u0438 Consul.<\/p>\n<p>  <\/p>\n<p>\u042d\u0442\u043e \u043e\u0447\u0435\u043d\u044c \u0443\u043f\u0440\u043e\u0449\u0430\u0435\u0442 \u043d\u0430\u0448\u0443 \u0437\u0430\u0434\u0430\u0447\u0443 \u043f\u043e \u0431\u0430\u043b\u0430\u043d\u0441\u0438\u0440\u043e\u0432\u043a\u0435 \u043d\u0430\u0433\u0440\u0443\u0437\u043a\u0438 \u0442\u0440\u0430\u0444\u0438\u043a\u0430 \u0434\u043b\u044f \u043d\u0430\u0448\u0438\u0445 \u044d\u043a\u0437\u0435\u043c\u043f\u043b\u044f\u0440\u043e\u0432 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f Django.<\/p>\n<p>  <\/p>\n<p>\u0427\u0442\u043e\u0431\u044b \u043f\u043e\u0437\u0432\u043e\u043b\u0438\u0442\u044c Fabio \u0430\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0438 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u0442\u044c \u0441\u043b\u0443\u0436\u0431\u044b \u0447\u0435\u0440\u0435\u0437 Consul, \u043e\u0434\u043d\u0438\u043c \u0438\u0437 \u0441\u043f\u043e\u0441\u043e\u0431\u043e\u0432 \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0434\u043e\u0431\u0430\u0432\u043b\u0435\u043d\u0438\u0435 <a href=\"https:\/\/github.com\/fabiolb\/fabio\/wiki\/Service-Configuration\" rel=\"nofollow\">\u0442\u0435\u0433\u0430 \u0438\u043b\u0438 \u043e\u0431\u043d\u043e\u0432\u043b\u0435\u043d\u0438\u0435 \u0442\u0435\u0433\u0430 \u0432 <strong>\u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u0438<\/strong><\/a> \u0441\u0435\u0440\u0432\u0438\u0441\u0430 \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u043f\u0440\u0435\u0444\u0438\u043a\u0441\u0430 \u0438 \u0438\u0434\u0435\u043d\u0442\u0438\u0444\u0438\u043a\u0430\u0442\u043e\u0440\u0430 \u0441\u043b\u0443\u0436\u0431\u044b <code>urlprefix-\/&lt;service&gt;<\/code>. \u041e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u0435 \u0441\u043b\u0443\u0436\u0431\u044b \u043d\u0430\u0448\u0435\u0433\u043e Consul \u0434\u043b\u044f \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f Django \u0442\u0435\u043f\u0435\u0440\u044c \u0431\u0443\u0434\u0435\u0442 \u0432\u044b\u0433\u043b\u044f\u0434\u0435\u0442\u044c \u0442\u0430\u043a:<\/p>\n<p>  <\/p>\n<pre><code class=\"plaintext\">{     &quot;service&quot;: {         &quot;name&quot;: &quot;web&quot;,         &quot;port&quot;: 8000,         &quot;tags&quot;: [             &quot;web&quot;,             &quot;application&quot;,             &quot;urlprefix-\/web&quot;         ],         &quot;check&quot;: {             &quot;id&quot;: &quot;web_app_status&quot;,             &quot;name&quot;: &quot;Web Application Status&quot;,             &quot;tcp&quot;: &quot;localhost:8000&quot;,             &quot;interval&quot;: &quot;30s&quot;,             &quot;timeout&quot;: &quot;20s&quot;         }     } }<\/code><\/pre>\n<p>  <\/p>\n<p>\u0412 \u043d\u0430\u0448\u0435\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u0438\u043b\u0438 \u0441\u043b\u0443\u0436\u0431\u0430 Django \u2014 \u0435\u0434\u0438\u043d\u0441\u0442\u0432\u0435\u043d\u043d\u0430\u044f \u0441\u043b\u0443\u0436\u0431\u0430, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u043d\u0443\u0436\u0434\u0430\u0435\u0442\u0441\u044f \u0432 \u0431\u0430\u043b\u0430\u043d\u0441\u0438\u0440\u043e\u0432\u043a\u0435 \u043d\u0430\u0433\u0440\u0443\u0437\u043a\u0438, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u044d\u0442\u043e \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u0435 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u044f \u0441\u043b\u0443\u0436\u0431\u044b Consul \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0435\u0442 \u0442\u0440\u0435\u0431\u043e\u0432\u0430\u043d\u0438\u044f \u043f\u043e \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0435 Fabio.<\/p>\n<p>  <\/p>\n<h3 id=\"dokerizaciya\">\u0414\u043e\u043a\u0435\u0440\u0438\u0437\u0430\u0446\u0438\u044f<\/h3>\n<p>  <\/p>\n<p>\u0412\u0441\u0435 \u043d\u0430\u0448\u0435 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u0431\u0443\u0434\u0435\u0442 \u0440\u0430\u0437\u0432\u0435\u0440\u043d\u0443\u0442\u043e \u043a\u0430\u043a \u043d\u0430\u0431\u043e\u0440 \u043a\u043e\u043d\u0442\u0435\u0439\u043d\u0435\u0440\u043e\u0432 Docker. \u0414\u0430\u0432\u0430\u0439\u0442\u0435 \u043f\u043e\u0433\u043e\u0432\u043e\u0440\u0438\u043c \u043e \u0442\u043e\u043c, \u043a\u0430\u043a \u043c\u044b \u044d\u0442\u043e\u0433\u043e \u0434\u043e\u0441\u0442\u0438\u0433\u0430\u0435\u043c \u0432 \u043a\u043e\u043d\u0442\u0435\u043a\u0441\u0442\u0435 Consul.<\/p>\n<p>  <\/p>\n<h3 id=\"dokerizaciya-nabora-replik-mongodb-vmeste-s-agentom-consul\">\u0414\u043e\u043a\u0435\u0440\u0438\u0437\u0430\u0446\u0438\u044f \u043d\u0430\u0431\u043e\u0440\u0430 \u0440\u0435\u043f\u043b\u0438\u043a MongoDB \u0432\u043c\u0435\u0441\u0442\u0435 \u0441 \u0430\u0433\u0435\u043d\u0442\u043e\u043c Consul<\/h3>\n<p>  <\/p>\n<p>\u041d\u0430\u043c \u043d\u0443\u0436\u043d\u043e \u0437\u0430\u043f\u0443\u0441\u0442\u0438\u0442\u044c \u0430\u0433\u0435\u043d\u0442 Consul, \u043a\u0430\u043a \u043e\u043f\u0438\u0441\u0430\u043d\u043e \u0432\u044b\u0448\u0435, \u0432\u043c\u0435\u0441\u0442\u0435 \u0441 MongoDB \u0432 \u0442\u043e\u043c \u0436\u0435 \u043a\u043e\u043d\u0442\u0435\u0439\u043d\u0435\u0440\u0435 Docker, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u043d\u0430\u043c \u043d\u0443\u0436\u043d\u043e \u0431\u0443\u0434\u0435\u0442 \u0437\u0430\u043f\u0443\u0441\u0442\u0438\u0442\u044c \u043d\u0430\u0441\u0442\u0440\u0430\u0438\u0432\u0430\u0435\u043c\u044b\u0439 ENTRYPOINT \u0432 \u043a\u043e\u043d\u0442\u0435\u0439\u043d\u0435\u0440\u0435, \u0447\u0442\u043e\u0431\u044b \u0440\u0430\u0437\u0440\u0435\u0448\u0438\u0442\u044c \u0437\u0430\u043f\u0443\u0441\u043a \u0434\u0432\u0443\u0445 \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u043e\u0432.<\/p>\n<p>  <\/p>\n<p>\u041f\u0440\u0438\u043c\u0435\u0447\u0430\u043d\u0438\u0435. \u042d\u0442\u043e\u0433\u043e \u0442\u0430\u043a\u0436\u0435 \u043c\u043e\u0436\u043d\u043e \u0434\u043e\u0431\u0438\u0442\u044c\u0441\u044f \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u043f\u0440\u043e\u0432\u0435\u0440\u043e\u043a \u0443\u0440\u043e\u0432\u043d\u044f \u043a\u043e\u043d\u0442\u0435\u0439\u043d\u0435\u0440\u0430 Docker \u0432 Consul. \u0422\u0430\u043a\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c, \u0432\u044b \u0441\u043c\u043e\u0436\u0435\u0442\u0435 \u0437\u0430\u043f\u0443\u0441\u0442\u0438\u0442\u044c \u0430\u0433\u0435\u043d\u0442 Consul \u043d\u0430 \u0445\u043e\u0441\u0442\u0435 \u0438 \u043f\u0440\u043e\u0432\u0435\u0440\u0438\u0442\u044c \u0441\u0435\u0440\u0432\u0438\u0441, \u0440\u0430\u0431\u043e\u0442\u0430\u044e\u0449\u0438\u0439 \u0432 \u043a\u043e\u043d\u0442\u0435\u0439\u043d\u0435\u0440\u0435 Docker. \u0427\u0442\u043e, \u043f\u043e \u0441\u0443\u0442\u0438, \u0431\u0443\u0434\u0435\u0442 \u0437\u0430\u043f\u0443\u0441\u043a\u0430\u0442\u044c\u0441\u044f \u0432 \u043a\u043e\u043d\u0442\u0435\u0439\u043d\u0435\u0440 \u0434\u043b\u044f \u043c\u043e\u043d\u0438\u0442\u043e\u0440\u0438\u043d\u0433\u0430 \u0441\u043b\u0443\u0436\u0431\u044b.<\/p>\n<p>  <\/p>\n<p>\u0414\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u043c\u044b \u0431\u0443\u0434\u0435\u043c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442, \u043f\u043e\u0445\u043e\u0436\u0438\u0439 \u043d\u0430 <a href=\"https:\/\/www.theforeman.org\/\" rel=\"nofollow\">Foreman<\/a>. \u042d\u0442\u043e \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442 \u0443\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u044f \u0436\u0438\u0437\u043d\u0435\u043d\u043d\u044b\u043c \u0446\u0438\u043a\u043b\u043e\u043c \u0444\u0438\u0437\u0438\u0447\u0435\u0441\u043a\u0438\u0445 \u0438 \u0432\u0438\u0440\u0442\u0443\u0430\u043b\u044c\u043d\u044b\u0445 \u0441\u0435\u0440\u0432\u0435\u0440\u043e\u0432, \u0432\u043a\u043b\u044e\u0447\u0430\u044f \u0432\u044b\u0434\u0435\u043b\u0435\u043d\u0438\u0435 \u0440\u0435\u0441\u0443\u0440\u0441\u043e\u0432, \u043c\u043e\u043d\u0438\u0442\u043e\u0440\u0438\u043d\u0433 \u0438 \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0443.<\/p>\n<p>  <\/p>\n<p>\u0427\u0442\u043e\u0431\u044b \u0431\u044b\u0442\u044c \u0442\u043e\u0447\u043d\u044b\u043c, \u043c\u044b \u0431\u0443\u0434\u0435\u043c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c Golang, \u0437\u0430\u0438\u043c\u0441\u0442\u0432\u043e\u0432\u0430\u043d\u043d\u044b\u0439 \u0443 Foreman, <a href=\"https:\/\/github.com\/mattn\/goreman\" rel=\"nofollow\">Goreman<\/a>. \u041e\u043d \u043f\u0440\u0438\u043d\u0438\u043c\u0430\u0435\u0442 \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u044e \u0432 \u0444\u043e\u0440\u043c\u0435 <a href=\"https:\/\/devcenter.heroku.com\/articles\/procfile\" rel=\"nofollow\">Procfile Heroku<\/a>, \u0447\u0442\u043e\u0431\u044b \u043f\u043e\u043d\u0438\u043c\u0430\u0442\u044c, \u043a\u0430\u043a\u0438\u0435 \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u044b \u0434\u043e\u043b\u0436\u043d\u044b \u043e\u0441\u0442\u0430\u0432\u0430\u0442\u044c\u0441\u044f \u0430\u043a\u0442\u0438\u0432\u043d\u044b\u043c\u0438 \u043d\u0430 \u0445\u043e\u0441\u0442\u0435.<\/p>\n<p>  <\/p>\n<p>\u0412 \u043d\u0430\u0448\u0435\u043c \u0441\u043b\u0443\u0447\u0430\u0435 Procfile \u0432\u044b\u0433\u043b\u044f\u0434\u0438\u0442 \u0442\u0430\u043a:<\/p>\n<p>  <\/p>\n<pre><code class=\"plaintext\"># Mongo mongo: \/opt\/mongo.sh  # Consul Client Agent consul: \/opt\/consul.sh  # Consul Client Health Checks consul_check: while true; do \/opt\/checks_toggler.sh &amp;&amp; sleep 10; done<\/code><\/pre>\n<p>  <\/p>\n<p><code>consul_check<\/code> \u0432 \u043a\u043e\u043d\u0446\u0435 \u043f\u0440\u043e\u0444\u0438\u043b\u044f \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u0435\u0442 \u0434\u0438\u043d\u0430\u043c\u0438\u0437\u043c \u043c\u0435\u0436\u0434\u0443 \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0430\u043c\u0438 \u043a\u0430\u043a \u043f\u0435\u0440\u0432\u0438\u0447\u043d\u043e\u0433\u043e, \u0442\u0430\u043a \u0438 \u0432\u0442\u043e\u0440\u0438\u0447\u043d\u043e\u0433\u043e \u0443\u0437\u043b\u0430 MongoDB \u0432 \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u0438 \u043e\u0442 \u0442\u043e\u0433\u043e, \u0437\u0430 \u043a\u0430\u043a\u0443\u044e \u0440\u043e\u043b\u044c \u0432 \u043d\u0430\u0431\u043e\u0440\u0435 \u0440\u0435\u043f\u043b\u0438\u043a MongoDB \u043f\u0440\u043e\u0433\u043e\u043b\u043e\u0441\u043e\u0432\u0430\u043b\u0438.<\/p>\n<p>  <\/p>\n<p>\u0421\u0446\u0435\u043d\u0430\u0440\u0438\u0438 \u043e\u0431\u043e\u043b\u043e\u0447\u043a\u0438, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u044e\u0442\u0441\u044f \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u044e\u0449\u0438\u043c\u0438 \u043a\u043b\u0430\u0432\u0438\u0448\u0430\u043c\u0438 \u0432 \u0444\u0430\u0439\u043b\u0435 Procfile, \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u044b \u0440\u0430\u043d\u0435\u0435 \u0432 \u044d\u0442\u043e\u043c \u043e\u0431\u0441\u0443\u0436\u0434\u0435\u043d\u0438\u0438.<\/p>\n<p>  <\/p>\n<p>\u041d\u0430\u0448 <a href=\"https:\/\/docs.docker.com\/engine\/reference\/builder\/\" rel=\"nofollow\">Dockerfile<\/a> \u0441 \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u043c\u0438 \u0434\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u043c\u0438 \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442\u0430\u043c\u0438 \u0434\u043b\u044f \u043e\u0442\u043b\u0430\u0434\u043a\u0438 \u0438 \u0434\u0438\u0430\u0433\u043d\u043e\u0441\u0442\u0438\u043a\u0438 \u0431\u0443\u0434\u0435\u0442 \u0432\u044b\u0433\u043b\u044f\u0434\u0435\u0442\u044c \u0442\u0430\u043a:<\/p>\n<p>  <\/p>\n<pre><code class=\"plaintext\">FROM ubuntu:18.04  RUN apt-get update &amp;&amp; \\     apt-get install -y \\     bash curl nano net-tools zip unzip \\     jq dnsutils iputils-ping  # Install MongoDB RUN apt-get install -y mongodb  RUN mkdir -p \/data\/db VOLUME data:\/data\/db  # Setup Consul and Goreman ADD https:\/\/releases.hashicorp.com\/consul\/1.4.4\/consul_1.4.4_linux_amd64.zip \/tmp\/consul.zip RUN cd \/bin &amp;&amp; unzip \/tmp\/consul.zip &amp;&amp; chmod +x \/bin\/consul &amp;&amp; rm \/tmp\/consul.zip  ADD https:\/\/github.com\/mattn\/goreman\/releases\/download\/v0.0.10\/goreman_linux_amd64.zip \/tmp\/goreman.zip RUN cd \/bin &amp;&amp; unzip \/tmp\/goreman.zip &amp;&amp; chmod +x \/bin\/goreman &amp;&amp; rm \/tmp\/goreman.zip  RUN mkdir -p \/etc\/consul.d\/check_scripts ADD .\/config\/mongod \/etc  RUN mkdir -p \/etc\/checks ADD .\/config\/checks \/opt\/checks  ADD checks_toggler.sh \/opt ADD mongo.sh \/opt ADD consul.sh \/opt  ADD Procfile \/root\/Procfile  EXPOSE 27017  # Launch both MongoDB server and Consul ENTRYPOINT [ &quot;goreman&quot; ] CMD [ &quot;-f&quot;, &quot;\/root\/Procfile&quot;, &quot;start&quot; ]<\/code><\/pre>\n<p>  <\/p>\n<p><em>\u041f\u0440\u0438\u043c\u0435\u0447\u0430\u043d\u0438\u0435. \u041c\u044b \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043b\u0438 \u0437\u0434\u0435\u0441\u044c \u0447\u0438\u0441\u0442\u044b\u0439 \u043e\u0431\u0440\u0430\u0437 Ubuntu 18.04 \u0434\u043b\u044f \u043d\u0430\u0448\u0438\u0445 \u0446\u0435\u043b\u0435\u0439, \u043d\u043e \u0432\u044b \u043c\u043e\u0436\u0435\u0442\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c <a href=\"https:\/\/hub.docker.com\/_\/mongo\" rel=\"nofollow\">\u043e\u0444\u0438\u0446\u0438\u0430\u043b\u044c\u043d\u044b\u0439 \u043e\u0431\u0440\u0430\u0437 MongoDB<\/a> \u0438 \u0430\u0434\u0430\u043f\u0442\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0435\u0433\u043e \u0434\u043b\u044f \u0437\u0430\u043f\u0443\u0441\u043a\u0430 Consul \u0432\u043c\u0435\u0441\u0442\u0435 \u0441 MongoDB \u0438\u043b\u0438 \u0434\u0430\u0436\u0435 \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0442\u044c \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0438 Consul \u043d\u0430 \u0443\u0440\u043e\u0432\u043d\u0435 \u043a\u043e\u043d\u0442\u0435\u0439\u043d\u0435\u0440\u0430 Docker, \u043a\u0430\u043a \u0443\u043a\u0430\u0437\u0430\u043d\u043e \u0432 \u043e\u0444\u0438\u0446\u0438\u0430\u043b\u044c\u043d\u043e\u0439 \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u0438.<\/em><\/p>\n<p>  <\/p>\n<h3 id=\"dokerizaciya-veb-prilozheniya-django-vmeste-s-consul-agent\">\u0414\u043e\u043a\u0435\u0440\u0438\u0437\u0430\u0446\u0438\u044f \u0432\u0435\u0431-\u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f Django \u0432\u043c\u0435\u0441\u0442\u0435 \u0441 Consul Agent<\/h3>\n<p>  <\/p>\n<p>\u041d\u0430\u043c \u0442\u0430\u043a\u0436\u0435 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u0437\u0430\u043f\u0443\u0441\u0442\u0438\u0442\u044c \u0430\u0433\u0435\u043d\u0442 Consul \u0432\u043c\u0435\u0441\u0442\u0435 \u0441 \u043d\u0430\u0448\u0438\u043c \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435\u043c Django \u0432 \u0442\u043e\u043c \u0436\u0435 \u043a\u043e\u043d\u0442\u0435\u0439\u043d\u0435\u0440\u0435 Docker, \u0447\u0442\u043e \u0438 \u0443 \u043d\u0430\u0441 \u0441 \u043a\u043e\u043d\u0442\u0435\u0439\u043d\u0435\u0440\u043e\u043c MongoDB.<\/p>\n<p>  <\/p>\n<pre><code class=\"plaintext\"># Django django: \/web\/tweeter.sh  # Consul Client Agent consul: \/opt\/consul.sh<\/code><\/pre>\n<p>  <\/p>\n<p>\u0422\u043e\u0447\u043d\u043e \u0442\u0430\u043a \u0436\u0435 \u0443 \u043d\u0430\u0441 \u0431\u0443\u0434\u0435\u0442 Dockerfile \u0434\u043b\u044f \u0432\u0435\u0431-\u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f Django, \u043a\u0430\u043a \u0438 \u0434\u043b\u044f \u043d\u0430\u0448\u0438\u0445 \u043a\u043e\u043d\u0442\u0435\u0439\u043d\u0435\u0440\u043e\u0432 MongoDB.<\/p>\n<p>  <\/p>\n<pre><code class=\"plaintext\">FROM python:3.7  RUN apt-get update &amp;&amp; \\     apt-get install -y \\     bash curl nano net-tools zip unzip \\     jq dnsutils iputils-ping  # Python Environment Setup ENV PYTHONDONTWRITEBYTECODE 1 ENV PYTHONUNBUFFERED 1  # Setup Consul and Goreman RUN mkdir -p \/data\/db \/etc\/consul.d  ADD https:\/\/releases.hashicorp.com\/consul\/1.4.4\/consul_1.4.4_linux_amd64.zip \/tmp\/consul.zip RUN cd \/bin &amp;&amp; unzip \/tmp\/consul.zip &amp;&amp; chmod +x \/bin\/consul &amp;&amp; rm \/tmp\/consul.zip  ADD https:\/\/github.com\/mattn\/goreman\/releases\/download\/v0.0.10\/goreman_linux_amd64.zip \/tmp\/goreman.zip RUN cd \/bin &amp;&amp; unzip \/tmp\/goreman.zip &amp;&amp; chmod +x \/bin\/goreman &amp;&amp; rm \/tmp\/goreman.zip  ADD .\/consul \/etc\/consul.d ADD Procfile \/root\/Procfile  # Install pipenv RUN pip3 install --upgrade pip RUN pip3 install pipenv  # Setting workdir ADD consul.sh \/opt ADD . \/web WORKDIR \/web\/tweeter  # Exposing appropriate ports EXPOSE 8000\/tcp  # Install dependencies RUN pipenv install --system --deploy --ignore-pipfile  # Migrates the database, uploads staticfiles, run API server and background tasks ENTRYPOINT [ &quot;goreman&quot; ] CMD [ &quot;-f&quot;, &quot;\/root\/Procfile&quot;, &quot;start&quot; ]<\/code><\/pre>\n<p>  <\/p>\n<h4 id=\"dokerizaciya-consul-server\">\u0414\u043e\u043a\u0435\u0440\u0438\u0437\u0430\u0446\u0438\u044f Consul Server<\/h4>\n<p>  <\/p>\n<p>\u041c\u044b \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u0435\u043c \u0442\u043e\u0442 \u0436\u0435 \u043f\u043e\u0442\u043e\u043a \u0441 \u0441\u0435\u0440\u0432\u0435\u0440\u043d\u044b\u043c \u0443\u0437\u043b\u043e\u043c Consul, \u0447\u0442\u043e\u0431\u044b \u0437\u0430\u043f\u0443\u0441\u0442\u0438\u0442\u044c \u0435\u0433\u043e \u0441 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u0441\u043a\u0438\u043c ENTRYPOINT. \u042d\u0442\u043e \u043d\u0435 \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u043e\u0431\u044f\u0437\u0430\u0442\u0435\u043b\u044c\u043d\u044b\u043c \u0442\u0440\u0435\u0431\u043e\u0432\u0430\u043d\u0438\u0435\u043c, \u043d\u043e \u043c\u044b \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u0435\u043c \u0435\u0434\u0438\u043d\u043e\u043e\u0431\u0440\u0430\u0437\u043d\u043e\u0435 \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u0438\u0435 \u0440\u0430\u0437\u043b\u0438\u0447\u043d\u044b\u0445 \u0444\u0430\u0439\u043b\u043e\u0432 \u0437\u0430\u043f\u0443\u0441\u043a\u0430 Consul.<\/p>\n<p>  <\/p>\n<p>\u041a\u0440\u043e\u043c\u0435 \u0442\u043e\u0433\u043e, \u0434\u043b\u044f \u0434\u0435\u043c\u043e\u043d\u0441\u0442\u0440\u0430\u0446\u0438\u0438 \u043c\u044b \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c \u043e\u0431\u0440\u0430\u0437 Ubuntu 18.04. \u0414\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u0432\u044b \u043c\u043e\u0436\u0435\u0442\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c <a href=\"https:\/\/hub.docker.com\/_\/consul\" rel=\"nofollow\">\u043e\u0444\u0438\u0446\u0438\u0430\u043b\u044c\u043d\u044b\u0439 \u043e\u0431\u0440\u0430\u0437 Consul<\/a>, \u043a\u043e\u0442\u043e\u0440\u043e\u0435 \u043f\u0440\u0438\u043d\u0438\u043c\u0430\u0435\u0442 \u0432\u0441\u0435 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u0441\u043a\u0438\u0435 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u044b, \u0443\u043a\u0430\u0437\u0430\u043d\u043d\u044b\u0435 \u0437\u0434\u0435\u0441\u044c.<\/p>\n<p>  <\/p>\n<pre><code class=\"plaintext\">FROM ubuntu:18.04  RUN apt-get update &amp;&amp; \\     apt-get install -y \\     bash curl nano net-tools zip unzip \\     jq dnsutils iputils-ping  ADD https:\/\/releases.hashicorp.com\/consul\/1.4.4\/consul_1.4.4_linux_amd64.zip \/tmp\/consul.zip RUN cd \/bin &amp;&amp; unzip \/tmp\/consul.zip &amp;&amp; chmod +x \/bin\/consul &amp;&amp; rm \/tmp\/consul.zip  # Consul ports EXPOSE 8300 8301 8302 8400 8500  ADD consul_server.sh \/opt RUN mkdir -p \/data VOLUME \/data  CMD [&quot;\/opt\/consul_server.sh&quot;]<\/code><\/pre>\n<p>  <\/p>\n<h3 id=\"docker-compose\">Docker Compose<\/h3>\n<p>  <\/p>\n<p>\u041c\u044b \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c <a href=\"https:\/\/github.com\/docker\/compose\" rel=\"nofollow\">Compose<\/a> \u0434\u043b\u044f \u0437\u0430\u043f\u0443\u0441\u043a\u0430 \u0432\u0441\u0435\u0445 \u043d\u0430\u0448\u0438\u0445 \u043a\u043e\u043d\u0442\u0435\u0439\u043d\u0435\u0440\u043e\u0432 Docker \u0432 \u0436\u0435\u043b\u0430\u0435\u043c\u043e\u0439, \u043f\u043e\u0432\u0442\u043e\u0440\u044f\u0435\u043c\u043e\u0439 \u0444\u043e\u0440\u043c\u0435.<\/p>\n<p>  <\/p>\n<p>\u041d\u0430\u0448 <a href=\"https:\/\/docs.docker.com\/compose\/compose-file\/\" rel=\"nofollow\">\u0444\u0430\u0439\u043b Compose<\/a> \u043d\u0430\u043f\u0438\u0441\u0430\u043d \u0434\u043b\u044f \u043e\u0431\u043e\u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u0432\u0441\u0435\u0445 \u0430\u0441\u043f\u0435\u043a\u0442\u043e\u0432, \u043e \u043a\u043e\u0442\u043e\u0440\u044b\u0445 \u043c\u044b \u0443\u043f\u043e\u043c\u044f\u043d\u0443\u043b\u0438 \u0432\u044b\u0448\u0435, \u0438 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u0438 \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442\u0430 Docker Compose \u0434\u043b\u044f \u0438\u0445 \u0431\u0435\u0441\u043f\u0440\u0435\u043f\u044f\u0442\u0441\u0442\u0432\u0435\u043d\u043d\u043e\u0433\u043e \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f.<\/p>\n<p>  <\/p>\n<p>\u0424\u0430\u0439\u043b Docker Compose \u0431\u0443\u0434\u0435\u0442 \u0432\u044b\u0433\u043b\u044f\u0434\u0435\u0442\u044c \u0442\u0430\u043a, \u043a\u0430\u043a \u043f\u043e\u043a\u0430\u0437\u0430\u043d\u043e \u043d\u0438\u0436\u0435:<\/p>\n<p>  <\/p>\n<pre><code class=\"plaintext\">version: &quot;3.6&quot;  services:    consul_server:     build:       context: consul_server       dockerfile: Dockerfile     image: consul_server     ports:       - 8300:8300       - 8301:8301       - 8302:8302       - 8400:8400       - 8500:8500     environment:       - NODE=consul_server       - PRIVATE_IP_ADDRESS=33.10.0.2     networks:       consul_network:         ipv4_address: 33.10.0.2    load_balancer:     image: fabiolb\/fabio     ports:       - 9998:9998       - 9999:9999     command: -registry.consul.addr=&quot;33.10.0.2:8500&quot;     networks:       consul_network:         ipv4_address: 33.10.0.100    mongo_1:     build:       context: mongo       dockerfile: Dockerfile     image: mongo_consul     dns:       - 127.0.0.1       - 8.8.8.8       - 8.8.4.4     environment:       - NODE=mongo_1       - MONGO_PORT=27017       - PRIMARY_MONGO=33.10.0.3       - PRIVATE_IP_ADDRESS=33.10.0.3     restart: always     ports:       - 27017:27017       - 28017:28017     depends_on:       - consul_server       - mongo_2       - mongo_3     networks:       consul_network:         ipv4_address: 33.10.0.3    mongo_2:     build:       context: mongo       dockerfile: Dockerfile     image: mongo_consul     dns:       - 127.0.0.1       - 8.8.8.8       - 8.8.4.4     environment:       - NODE=mongo_2       - MONGO_PORT=27017       - PRIMARY_MONGO=33.10.0.3       - PRIVATE_IP_ADDRESS=33.10.0.4     restart: always     ports:       - 27018:27017       - 28018:28017     depends_on:       - consul_server     networks:       consul_network:         ipv4_address: 33.10.0.4    mongo_3:     build:       context: mongo       dockerfile: Dockerfile     image: mongo_consul     dns:       - 127.0.0.1       - 8.8.8.8       - 8.8.4.4     environment:       - NODE=mongo_3       - MONGO_PORT=27017       - PRIMARY_MONGO=33.10.0.3       - PRIVATE_IP_ADDRESS=33.10.0.5     restart: always     ports:       - 27019:27017       - 28019:28017     depends_on:       - consul_server     networks:       consul_network:         ipv4_address: 33.10.0.5    web_1:     build:       context: django       dockerfile: Dockerfile     image: web_consul     ports:       - 8080:8000     environment:       - NODE=web_1       - PRIMARY=1       - LOAD_BALANCER=33.10.0.100       - PRIVATE_IP_ADDRESS=33.10.0.10     dns:       - 127.0.0.1       - 8.8.8.8       - 8.8.4.4     depends_on:       - consul_server       - mongo_1     volumes:       - .\/django:\/web     cap_add:       - NET_ADMIN     networks:       consul_network:         ipv4_address: 33.10.0.10    web_2:     build:       context: django       dockerfile: Dockerfile     image: web_consul     ports:       - 8081:8000     environment:       - NODE=web_2       - LOAD_BALANCER=33.10.0.100       - PRIVATE_IP_ADDRESS=33.10.0.11     dns:       - 127.0.0.1       - 8.8.8.8       - 8.8.4.4     depends_on:       - consul_server       - mongo_1     volumes:       - .\/django:\/web     cap_add:       - NET_ADMIN     networks:       consul_network:         ipv4_address: 33.10.0.11  networks:   consul_network:     driver: bridge     ipam:      config:        - subnet: 33.10.0.0\/16<\/code><\/pre>\n<p>  <\/p>\n<p>\u041d\u0430 \u044d\u0442\u043e\u043c \u043c\u044b \u043f\u043e\u0434\u043e\u0448\u043b\u0438 \u043a \u043a\u043e\u043d\u0446\u0443 \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0438 \u0432\u0441\u0435\u0439 \u0441\u0440\u0435\u0434\u044b. \u0422\u0435\u043f\u0435\u0440\u044c \u043c\u044b \u043c\u043e\u0436\u0435\u043c \u0437\u0430\u043f\u0443\u0441\u0442\u0438\u0442\u044c Docker Compose \u0434\u043b\u044f \u0441\u0431\u043e\u0440\u043a\u0438 \u0438 \u0437\u0430\u043f\u0443\u0441\u043a\u0430 \u043a\u043e\u043d\u0442\u0435\u0439\u043d\u0435\u0440\u043e\u0432.<\/p>\n<p>  <\/p>\n<h3 id=\"obnaruzhenie-servisov-s-ispolzovaniem-consul\">\u041e\u0431\u043d\u0430\u0440\u0443\u0436\u0435\u043d\u0438\u0435 \u0441\u0435\u0440\u0432\u0438\u0441\u043e\u0432 \u0441 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435\u043c Consul<\/h3>\n<p>  <\/p>\n<p>\u041a\u043e\u0433\u0434\u0430 \u0432\u0441\u0435 \u0441\u043b\u0443\u0436\u0431\u044b \u0437\u0430\u043f\u0443\u0449\u0435\u043d\u044b \u0438 \u0440\u0430\u0431\u043e\u0442\u0430\u044e\u0442, \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u0441\u043a\u0438\u0439 \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441 Consul Web \u0434\u0430\u0435\u0442 \u043d\u0430\u043c \u0445\u043e\u0440\u043e\u0448\u0438\u0439 \u043e\u0431\u0437\u043e\u0440 \u043d\u0430\u0448\u0435\u0439 \u043e\u0431\u0449\u0435\u0439 \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0438.<\/p>\n<p>  <\/p>\n<p><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/72\/vj\/_k\/72vj_k_n7thle30ldz6pn44rrck.png\"><\/p>\n<p>  <\/p>\n<p><em>\u0421\u0435\u0440\u0432\u0438\u0441 MongoDB \u0434\u043e\u0441\u0442\u0443\u043f\u0435\u043d \u0434\u043b\u044f \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f Django \u0434\u043b\u044f \u043e\u0431\u043d\u0430\u0440\u0443\u0436\u0435\u043d\u0438\u044f \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441\u0430 Consul DNS.<\/em><\/p>\n<p>  <\/p>\n<pre><code class=\"plaintext\">root@82857c424b15:\/web\/tweeter# dig @127.0.0.1 mongo-primary.service.consul  ; &lt;&lt;&gt;&gt; DiG 9.10.3-P4-Debian &lt;&lt;&gt;&gt; @127.0.0.1 mongo-primary.service.consul ; (1 server found) ;; global options: +cmd ;; Got answer: ;; -&gt;&gt;HEADER&lt;&lt;- opcode: QUERY, status: NOERROR, id: 8369 ;; flags: qr aa rd; QUERY: 1, ANSWER: 1, AUTHORITY: 0, ADDITIONAL: 2 ;; WARNING: recursion requested but not available  ;; OPT PSEUDOSECTION: ; EDNS: version: 0, flags:; udp: 4096 ;; QUESTION SECTION: ;mongo-primary.service.consul.  IN  A  ;; ANSWER SECTION: mongo-primary.service.consul. 0 IN  A   33.10.0.3  ;; ADDITIONAL SECTION: mongo-primary.service.consul. 0 IN  TXT &quot;consul-network-segment=&quot;  ;; Query time: 139 msec ;; SERVER: 127.0.0.1#53(127.0.0.1) ;; WHEN: Mon Apr 01 11:50:45 UTC 2019 ;; MSG SIZE  rcvd: 109<\/code><\/pre>\n<p>  <\/p>\n<p>\u041f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435 Django \u0442\u0435\u043f\u0435\u0440\u044c \u043c\u043e\u0436\u0435\u0442 \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0438\u0442\u044c \u043f\u0435\u0440\u0432\u0438\u0447\u043d\u044b\u0439 \u044d\u043a\u0437\u0435\u043c\u043f\u043b\u044f\u0440 MongoDB \u0438 \u043d\u0430\u0447\u0430\u0442\u044c \u0437\u0430\u043f\u0438\u0441\u044b\u0432\u0430\u0442\u044c \u0432 \u043d\u0435\u0433\u043e \u0434\u0430\u043d\u043d\u044b\u0435.<\/p>\n<p>  <\/p>\n<p>\u041c\u044b \u043c\u043e\u0436\u0435\u043c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c <a href=\"https:\/\/velotio.com\/blog\/2017\/7\/5\/http-load-balancing-in-kubernetes-with-ingress\" rel=\"nofollow\">\u0431\u0430\u043b\u0430\u043d\u0441\u0438\u0440\u043e\u0432\u0449\u0438\u043a<\/a> \u043d\u0430\u0433\u0440\u0443\u0437\u043a\u0438 Fabio \u0434\u043b\u044f \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u044f \u043a \u044d\u043a\u0437\u0435\u043c\u043f\u043b\u044f\u0440\u0443 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f Django, \u0430\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0438 \u043e\u0431\u043d\u0430\u0440\u0443\u0436\u0438\u0432\u0430\u044f \u0435\u0433\u043e \u0447\u0435\u0440\u0435\u0437 \u0440\u0435\u0435\u0441\u0442\u0440 Consul \u0441 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435\u043c \u0441\u043f\u0435\u0446\u0438\u0430\u043b\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0445 \u0441\u0435\u0440\u0432\u0438\u0441\u043d\u044b\u0445 \u0442\u0435\u0433\u043e\u0432 \u0438 \u043e\u0442\u043e\u0431\u0440\u0430\u0436\u0430\u044f \u0441\u0442\u0440\u0430\u043d\u0438\u0446\u0443 \u0441\u043e \u0432\u0441\u0435\u0439 \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u0435\u0439 \u043e \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0438 \u043a \u0431\u0430\u0437\u0435 \u0434\u0430\u043d\u043d\u044b\u0445, \u043e \u043a\u043e\u0442\u043e\u0440\u043e\u0439 \u043c\u044b \u0433\u043e\u0432\u043e\u0440\u0438\u043c.<\/p>\n<p>  <\/p>\n<p>\u041d\u0430\u0448 \u0431\u0430\u043b\u0430\u043d\u0441\u0438\u0440\u043e\u0432\u0449\u0438\u043a \u043d\u0430\u0433\u0440\u0443\u0437\u043a\u0438 \u043d\u0430\u0445\u043e\u0434\u0438\u0442\u0441\u044f \u043d\u0430 <code>33.10.0.100<\/code>, \u0430 <code>\/web<\/code> \u043d\u0430\u0441\u0442\u0440\u043e\u0435\u043d \u0434\u043b\u044f \u043f\u0435\u0440\u0435\u043d\u0430\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u044f \u043d\u0430 \u043e\u0434\u0438\u043d \u0438\u0437 \u043d\u0430\u0448\u0438\u0445 \u044d\u043a\u0437\u0435\u043c\u043f\u043b\u044f\u0440\u043e\u0432 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f Django, \u0440\u0430\u0431\u043e\u0442\u0430\u044e\u0449\u0438\u0439 \u0437\u0430 \u0431\u0430\u043b\u0430\u043d\u0441\u0438\u0440\u043e\u0432\u0449\u0438\u043a\u043e\u043c \u043d\u0430\u0433\u0440\u0443\u0437\u043a\u0438.<\/p>\n<p>  <\/p>\n<p><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/tt\/59\/oi\/tt59oi-jm7kmm40vdqvaravdzpo.png\"><\/p>\n<p>  <\/p>\n<p><em>Fabio \u0430\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0438 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u0435\u0442 \u043a\u043e\u043d\u0435\u0447\u043d\u044b\u0435 \u0442\u043e\u0447\u043a\u0438 \u0432\u0435\u0431-\u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f Django<\/em><\/p>\n<p>  <\/p>\n<p>\u041a\u0430\u043a \u0432\u044b \u043c\u043e\u0436\u0435\u0442\u0435 \u0432\u0438\u0434\u0435\u0442\u044c \u0438\u0437 \u0430\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u043e\u0433\u043e \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u044f \u0438 \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0438 \u0431\u0430\u043b\u0430\u043d\u0441\u0438\u0440\u043e\u0432\u0449\u0438\u043a\u0430 \u043d\u0430\u0433\u0440\u0443\u0437\u043a\u0438 Fabio \u0438\u0437 \u0435\u0433\u043e \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u0441\u043a\u043e\u0433\u043e \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441\u0430 \u0432\u044b\u0448\u0435, \u043e\u043d \u043e\u0434\u0438\u043d\u0430\u043a\u043e\u0432\u043e \u0432\u0437\u0432\u0435\u0448\u0438\u0432\u0430\u043b \u043a\u043e\u043d\u0435\u0447\u043d\u044b\u0435 \u0442\u043e\u0447\u043a\u0438 \u0432\u0435\u0431-\u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f Django. \u042d\u0442\u043e \u043f\u043e\u043c\u043e\u0436\u0435\u0442 \u0441\u0431\u0430\u043b\u0430\u043d\u0441\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u043d\u0430\u0433\u0440\u0443\u0437\u043a\u0443 \u0437\u0430\u043f\u0440\u043e\u0441\u0430 \u0438\u043b\u0438 \u0442\u0440\u0430\u0444\u0438\u043a\u0430 \u043d\u0430 \u044d\u043a\u0437\u0435\u043c\u043f\u043b\u044f\u0440\u044b \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f Django.<\/p>\n<p>  <\/p>\n<p>\u041a\u043e\u0433\u0434\u0430 \u043c\u044b \u043f\u043e\u0441\u0435\u0449\u0430\u0435\u043c \u043d\u0430\u0448 URL-\u0430\u0434\u0440\u0435\u0441 Fabio <code>33.10.0.100:9999<\/code> \u0438 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c \u0438\u0441\u0445\u043e\u0434\u043d\u044b\u0439 \u043c\u0430\u0440\u0448\u0440\u0443\u0442 \u043a\u0430\u043a <code>\/web<\/code>, \u043c\u044b \u043f\u0435\u0440\u0435\u043d\u0430\u043f\u0440\u0430\u0432\u043b\u044f\u0435\u043c\u0441\u044f \u043d\u0430 \u043e\u0434\u0438\u043d \u0438\u0437 \u044d\u043a\u0437\u0435\u043c\u043f\u043b\u044f\u0440\u043e\u0432 Django. \u0418\u0442\u0430\u043a, \u043f\u043e\u0441\u0435\u0449\u0435\u043d\u0438\u0435 <code>33.10.0.100:9999\/web<\/code> \u0434\u0430\u0435\u0442 \u043d\u0430\u043c \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0439 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442.<\/p>\n<p>  <\/p>\n<p><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/dj\/gn\/o8\/djgno8tjtf-5asfkbdzgf6zvglk.png\"><\/p>\n<p>  <\/p>\n<p><em>\u0412\u0435\u0431-\u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435 Django \u043e\u0442\u043e\u0431\u0440\u0430\u0436\u0430\u0435\u0442 \u0441\u0442\u0430\u0442\u0443\u0441 \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u044f MongoDB \u043d\u0430 \u0434\u043e\u043c\u0430\u0448\u043d\u0435\u0439 \u0441\u0442\u0440\u0430\u043d\u0438\u0446\u0435<\/em><\/p>\n<p>  <\/p>\n<p>\u041c\u044b \u043c\u043e\u0436\u0435\u043c \u043e\u0433\u0440\u0430\u043d\u0438\u0447\u0438\u0442\u044c Fabio \u0442\u043e\u043b\u044c\u043a\u043e \u044d\u043a\u0437\u0435\u043c\u043f\u043b\u044f\u0440\u0430\u043c\u0438 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f Django \u0441 \u0431\u0430\u043b\u0430\u043d\u0441\u0438\u0440\u043e\u0432\u043a\u043e\u0439 \u043d\u0430\u0433\u0440\u0443\u0437\u043a\u0438, \u0434\u043e\u0431\u0430\u0432\u0438\u0432 \u0442\u043e\u043b\u044c\u043a\u043e \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u044b\u0435 \u0442\u0435\u0433\u0438 \u0432 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u044f \u0441\u043b\u0443\u0436\u0431 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0439 Django \u0432 Consul.<\/p>\n<p>  <\/p>\n<p>\u042d\u0442\u043e \u043e\u0431\u043d\u0430\u0440\u0443\u0436\u0435\u043d\u0438\u0435 \u043f\u0435\u0440\u0432\u0438\u0447\u043d\u043e\u0433\u043e \u044d\u043a\u0437\u0435\u043c\u043f\u043b\u044f\u0440\u0430 MongoDB \u043f\u043e\u043c\u043e\u0433\u0430\u0435\u0442 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044e Django \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0442\u044c \u043c\u0438\u0433\u0440\u0430\u0446\u0438\u044e \u0431\u0430\u0437\u044b \u0434\u0430\u043d\u043d\u044b\u0445 \u0438 \u0440\u0430\u0437\u0432\u0435\u0440\u0442\u044b\u0432\u0430\u043d\u0438\u0435 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f.<\/p>\n<p>  <\/p>\n<p>\u041c\u043e\u0436\u043d\u043e \u0438\u0437\u0443\u0447\u0438\u0442\u044c \u0432\u0435\u0431-\u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441 Consul, \u0447\u0442\u043e\u0431\u044b \u0443\u0432\u0438\u0434\u0435\u0442\u044c \u0432\u0441\u0435 \u044d\u043a\u0437\u0435\u043c\u043f\u043b\u044f\u0440\u044b \u0441\u043b\u0443\u0436\u0431 \u0432\u0435\u0431-\u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0439 Django.<\/p>\n<p>  <\/p>\n<p><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/kt\/zs\/lw\/ktzslw35zj7uq56j-ksal3si8w4.png\"><\/p>\n<p>  <\/p>\n<p><em>\u0421\u0435\u0440\u0432\u0438\u0441\u044b \u0432\u0435\u0431-\u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0439 Django \u0432 \u0432\u0435\u0431-\u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441\u0435 Consul<\/em><\/p>\n<p>  <\/p>\n<p>\u0422\u043e\u0447\u043d\u043e \u0442\u0430\u043a \u0436\u0435 \u043f\u043e\u0441\u043c\u043e\u0442\u0440\u0438\u0442\u0435, \u043a\u0430\u043a \u0443\u0441\u0442\u0440\u043e\u0435\u043d\u044b \u044d\u043a\u0437\u0435\u043c\u043f\u043b\u044f\u0440\u044b \u043d\u0430\u0431\u043e\u0440\u0430 \u0440\u0435\u043f\u043b\u0438\u043a MongoDB.<\/p>\n<p>  <\/p>\n<p><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/xg\/5j\/uo\/xg5juovp_7ahtrynrpqvpkljtfq.png\"><\/p>\n<p>  <\/p>\n<p><em>MongoDB Replica Set Primary service \u0432\u0438\u0434\u0438\u043c\u044b\u0439 \u0432 \u0432\u0435\u0431-\u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441\u0435 Consul<\/em><\/p>\n<p>  <\/p>\n<p><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/z2\/xb\/ut\/z2xbut_xm9mkhpzv_ne9emanu5m.png\"><\/p>\n<p>  <\/p>\n<p><em>MongoDB Replica Set Secondary service \u0432\u0438\u0434\u0438\u043c\u044b\u0439 \u0432 \u0432\u0435\u0431-\u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441\u0435 Consul<\/em><\/p>\n<p>  <\/p>\n<p>\u0414\u0430\u0432\u0430\u0439\u0442\u0435 \u043f\u043e\u0441\u043c\u043e\u0442\u0440\u0438\u043c, \u043a\u0430\u043a Consul \u043f\u043e\u043c\u043e\u0433\u0430\u0435\u0442 \u0441 \u0443\u0441\u043b\u0443\u0433\u0430\u043c\u0438 \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0438 \u0440\u0430\u0431\u043e\u0442\u043e\u0441\u043f\u043e\u0441\u043e\u0431\u043d\u043e\u0441\u0442\u0438 \u0438 \u043e\u0431\u043d\u0430\u0440\u0443\u0436\u0435\u043d\u0438\u0435\u043c \u0442\u043e\u043b\u044c\u043a\u043e \u0434\u0435\u0439\u0441\u0442\u0432\u0443\u044e\u0449\u0438\u0445 \u0441\u043b\u0443\u0436\u0431.<\/p>\n<p>  <\/p>\n<p>\u041c\u044b \u043e\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u043c \u0442\u0435\u043a\u0443\u0449\u0438\u0439 \u043a\u043e\u043d\u0442\u0435\u0439\u043d\u0435\u0440 MongoDB Replica Set Primary (<code>mongo_2<\/code>), \u0447\u0442\u043e\u0431\u044b \u043f\u043e\u0441\u043c\u043e\u0442\u0440\u0435\u0442\u044c, \u0447\u0442\u043e \u043f\u0440\u043e\u0438\u0437\u043e\u0439\u0434\u0435\u0442.<\/p>\n<p>  <\/p>\n<p><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/77\/bz\/2z\/77bz2z7cr-3vbq_orajymfujn7m.png\"><\/p>\n<p>  <\/p>\n<p><em>\u041f\u0435\u0440\u0432\u0438\u0447\u043d\u0430\u044f \u0441\u043b\u0443\u0436\u0431\u0430 MongoDB \u0437\u0430\u043c\u0435\u043d\u044f\u0435\u0442\u0441\u044f \u043e\u0434\u043d\u0438\u043c \u0438\u0437 \u0432\u0442\u043e\u0440\u0438\u0447\u043d\u044b\u0445 \u044d\u043a\u0437\u0435\u043c\u043f\u043b\u044f\u0440\u043e\u0432 MongoDB<\/em><\/p>\n<p>  <\/p>\n<p><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/cd\/5g\/i6\/cd5gi6bnn7gnunoien3gym6zrfw.png\"><\/p>\n<p>  <\/p>\n<p><em>\u0412\u043e \u0432\u0442\u043e\u0440\u0438\u0447\u043d\u043e\u043c \u044d\u043a\u0437\u0435\u043c\u043f\u043b\u044f\u0440\u0435 MongoDB \u0442\u0435\u043f\u0435\u0440\u044c \u043e\u0441\u0442\u0430\u043b\u0441\u044f \u0442\u043e\u043b\u044c\u043a\u043e \u043e\u0434\u0438\u043d \u044d\u043a\u0437\u0435\u043c\u043f\u043b\u044f\u0440 \u0441\u043b\u0443\u0436\u0431\u044b<\/em><\/p>\n<p>  <\/p>\n<p>Consul \u043f\u0435\u0440\u0435\u0441\u0442\u0430\u043b \u043f\u0440\u043e\u0445\u043e\u0434\u0438\u0442\u044c \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0443 \u0440\u0430\u0431\u043e\u0442\u043e\u0441\u043f\u043e\u0441\u043e\u0431\u043d\u043e\u0441\u0442\u0438 \u0434\u043b\u044f \u043f\u0440\u0435\u0434\u044b\u0434\u0443\u0449\u0435\u0439 \u043e\u0441\u043d\u043e\u0432\u043d\u043e\u0439 \u0441\u043b\u0443\u0436\u0431\u044b MongoDB. \u041d\u0430\u0431\u043e\u0440 \u0440\u0435\u043f\u043b\u0438\u043a MongoDB \u0442\u0430\u043a\u0436\u0435 \u043e\u0431\u043d\u0430\u0440\u0443\u0436\u0438\u043b, \u0447\u0442\u043e \u0443\u0437\u0435\u043b \u043d\u0435 \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u0438 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u043f\u0435\u0440\u0435\u0438\u0437\u0431\u0440\u0430\u0442\u044c \u043e\u0441\u043d\u043e\u0432\u043d\u043e\u0439 \u0443\u0437\u0435\u043b. \u0422\u0430\u043a\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c, \u043c\u044b \u0430\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0438 \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u043c \u043d\u043e\u0432\u044b\u0439 MongoDB Primary (<code>mongo_3<\/code>).<\/p>\n<p>  <\/p>\n<p>\u041d\u0430\u0448 \u043f\u0435\u0440\u0435\u043a\u043b\u044e\u0447\u0430\u0442\u0435\u043b\u044c \u043f\u0440\u043e\u0432\u0435\u0440\u043e\u043a \u0441\u0440\u0430\u0431\u043e\u0442\u0430\u043b \u0438 \u0437\u0430\u043c\u0435\u043d\u0438\u043b \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0443 <code>mongo_3<\/code> \u0441\u043e \u0432\u0442\u043e\u0440\u0438\u0447\u043d\u043e\u0439 \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0438 MongoDB \u043d\u0430 \u043f\u0435\u0440\u0432\u0438\u0447\u043d\u0443\u044e \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0443 MongoDB.<\/p>\n<p>  <\/p>\n<p>\u041a\u043e\u0433\u0434\u0430 \u043c\u044b \u0441\u043c\u043e\u0442\u0440\u0438\u043c \u043d\u0430 \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u0438\u0435 \u0438\u0437 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f Django, \u043c\u044b \u0432\u0438\u0434\u0438\u043c, \u0447\u0442\u043e \u0442\u0435\u043f\u0435\u0440\u044c \u043e\u043d\u043e \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0435\u043d\u043e \u043a \u043d\u043e\u0432\u043e\u0439 \u043f\u0435\u0440\u0432\u0438\u0447\u043d\u043e\u0439 \u0441\u043b\u0443\u0436\u0431\u0435 MongoDB (<code>mongo_3<\/code>).<\/p>\n<p>  <\/p>\n<p><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/hx\/ge\/oz\/hxgeozzkdi2ewdktqbigjqjmwmq.png\"><\/p>\n<p>  <\/p>\n<p><em>\u041e\u0442\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435 MongoDB Primary \u0442\u0430\u043a\u0436\u0435 \u043e\u0442\u0440\u0430\u0436\u0430\u0435\u0442\u0441\u044f \u0432 \u0432\u0435\u0431-\u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0438 Django.<\/em><\/p>\n<p>  <\/p>\n<p>\u0414\u0430\u0432\u0430\u0439\u0442\u0435 \u043f\u043e\u0441\u043c\u043e\u0442\u0440\u0438\u043c, \u043a\u0430\u043a \u044d\u0442\u043e \u0440\u0430\u0437\u043e\u0432\u044c\u0435\u0442\u0441\u044f, \u043a\u043e\u0433\u0434\u0430 \u043c\u044b \u0432\u0435\u0440\u043d\u0435\u043c \u043e\u0441\u0442\u0430\u043d\u043e\u0432\u043b\u0435\u043d\u043d\u044b\u0439 \u044d\u043a\u0437\u0435\u043c\u043f\u043b\u044f\u0440 MongoDB.<\/p>\n<p>  <\/p>\n<p><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/_q\/km\/nl\/_qkmnlrjyqua8oi_9emofpdx2aw.png\"><\/p>\n<p>  <\/p>\n<p><em>\u041d\u0435\u0438\u0441\u043f\u0440\u0430\u0432\u043d\u044b\u0439 \u044d\u043a\u0437\u0435\u043c\u043f\u043b\u044f\u0440 \u043f\u0435\u0440\u0432\u0438\u0447\u043d\u043e\u0439 \u0441\u043b\u0443\u0436\u0431\u044b MongoDB \u0442\u0435\u043f\u0435\u0440\u044c \u0443\u0434\u0430\u043b\u0435\u043d \u0438\u0437 \u044d\u043a\u0437\u0435\u043c\u043f\u043b\u044f\u0440\u043e\u0432 \u0441\u043b\u0443\u0436\u0431\u044b, \u0442\u0430\u043a \u043a\u0430\u043a \u0442\u0435\u043f\u0435\u0440\u044c \u043e\u043d \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0438\u0441\u043f\u0440\u0430\u0432\u043d\u044b\u043c \u044d\u043a\u0437\u0435\u043c\u043f\u043b\u044f\u0440\u043e\u043c \u0432\u0442\u043e\u0440\u0438\u0447\u043d\u043e\u0439 \u0441\u043b\u0443\u0436\u0431\u044b MongoDB.<\/em><\/p>\n<p>  <\/p>\n<p><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/hy\/le\/if\/hyleifzakuglm745rz_pybppwwc.png\"><\/p>\n<p>  <\/p>\n<p><em>\u0420\u0430\u043d\u0435\u0435 \u043e\u0442\u043a\u0430\u0437\u0430\u0432\u0448\u0438\u0439 \u044d\u043a\u0437\u0435\u043c\u043f\u043b\u044f\u0440 \u043f\u0435\u0440\u0432\u0438\u0447\u043d\u043e\u0439 \u0441\u043b\u0443\u0436\u0431\u044b MongoDB \u0442\u0435\u043f\u0435\u0440\u044c \u043f\u043e\u0432\u0442\u043e\u0440\u043d\u043e \u043f\u0440\u0438\u043d\u044f\u0442 \u0432 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 \u0432\u0442\u043e\u0440\u0438\u0447\u043d\u043e\u0433\u043e \u044d\u043a\u0437\u0435\u043c\u043f\u043b\u044f\u0440\u0430 \u0441\u043b\u0443\u0436\u0431\u044b MongoDB, \u043f\u043e\u0441\u043a\u043e\u043b\u044c\u043a\u0443 \u043e\u043d \u0441\u043d\u043e\u0432\u0430 \u0441\u0442\u0430\u043b \u0440\u0430\u0431\u043e\u0442\u043e\u0441\u043f\u043e\u0441\u043e\u0431\u043d\u044b\u043c<\/em><\/p>\n<p>  <\/p>\n<p>\u0422\u043e\u0447\u043d\u043e \u0442\u0430\u043a \u0436\u0435, \u0435\u0441\u043b\u0438 \u043c\u044b \u043e\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u043c \u044d\u043a\u0437\u0435\u043c\u043f\u043b\u044f\u0440\u044b \u0441\u043b\u0443\u0436\u0431\u044b \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f Django, Fabio \u0442\u0435\u043f\u0435\u0440\u044c \u0441\u043c\u043e\u0436\u0435\u0442 \u043e\u0431\u043d\u0430\u0440\u0443\u0436\u0438\u0432\u0430\u0442\u044c \u0442\u043e\u043b\u044c\u043a\u043e \u0440\u0430\u0431\u043e\u0442\u043e\u0441\u043f\u043e\u0441\u043e\u0431\u043d\u044b\u0439 \u044d\u043a\u0437\u0435\u043c\u043f\u043b\u044f\u0440 \u0438 \u043d\u0430\u043f\u0440\u0430\u0432\u043b\u044f\u0442\u044c \u0442\u0440\u0430\u0444\u0438\u043a \u0442\u043e\u043b\u044c\u043a\u043e \u043d\u0430 \u044d\u0442\u043e\u0442 \u044d\u043a\u0437\u0435\u043c\u043f\u043b\u044f\u0440.<\/p>\n<p>  <\/p>\n<p><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/uz\/ya\/s_\/uzyas_24bjt97ypblawnstk02ys.png\"><\/p>\n<p>  <\/p>\n<p><em>Fabio \u043c\u043e\u0436\u0435\u0442 \u0430\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0438 \u043d\u0430\u0441\u0442\u0440\u0430\u0438\u0432\u0430\u0442\u044c\u0441\u044f, \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044f \u0440\u0435\u0435\u0441\u0442\u0440 \u0441\u043b\u0443\u0436\u0431 Consul \u0438 \u043e\u0431\u043d\u0430\u0440\u0443\u0436\u0438\u0432\u0430\u044f \u0434\u0435\u0439\u0441\u0442\u0432\u0443\u044e\u0449\u0438\u0435 \u044d\u043a\u0437\u0435\u043c\u043f\u043b\u044f\u0440\u044b \u0441\u043b\u0443\u0436\u0431.<\/em><\/p>\n<p>  <\/p>\n<p>\u0412\u043e\u0442 \u043a\u0430\u043a \u043c\u043e\u0436\u043d\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044c \u043e\u0431\u043d\u0430\u0440\u0443\u0436\u0435\u043d\u0438\u044f \u0441\u043b\u0443\u0436\u0431 Consul \u0434\u043b\u044f \u043e\u0431\u043d\u0430\u0440\u0443\u0436\u0435\u043d\u0438\u044f, \u043c\u043e\u043d\u0438\u0442\u043e\u0440\u0438\u043d\u0433\u0430 \u0438 \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0438 \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u044f \u0441\u043b\u0443\u0436\u0431.<\/p>\n<p>  <\/p>\n<h3 id=\"nastroyka-servisa-s-pomoschyu-consul\">\u041d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0430 \u0441\u0435\u0440\u0432\u0438\u0441\u0430 \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e Consul<\/h3>\n<p>  <\/p>\n<p>\u0412 \u043d\u0430\u0441\u0442\u043e\u044f\u0449\u0435\u0435 \u0432\u0440\u0435\u043c\u044f \u043c\u044b \u043d\u0430\u0441\u0442\u0440\u0430\u0438\u0432\u0430\u0435\u043c \u044d\u043a\u0437\u0435\u043c\u043f\u043b\u044f\u0440\u044b \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f Django \u043d\u0430\u043f\u0440\u044f\u043c\u0443\u044e \u043b\u0438\u0431\u043e \u0438\u0437 <a href=\"https:\/\/docs.djangoproject.com\/en\/2.1\/topics\/settings\/\" rel=\"nofollow\">\u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0445 \u0441\u0440\u0435\u0434\u044b, \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043b\u0435\u043d\u043d\u044b\u0445 \u0432 \u043a\u043e\u043d\u0442\u0435\u0439\u043d\u0435\u0440\u0430\u0445 \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e Docker Compose<\/a>, \u0438 \u043f\u043e\u0442\u0440\u0435\u0431\u043b\u044f\u0435\u043c \u0438\u0445 \u0432 \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0430\u0445 \u043f\u0440\u043e\u0435\u043a\u0442\u0430 Django, \u043b\u0438\u0431\u043e <a href=\"https:\/\/docs.djangoproject.com\/en\/2.1\/ref\/settings\/\" rel=\"nofollow\">\u043f\u0443\u0442\u0435\u043c \u0436\u0435\u0441\u0442\u043a\u043e\u0433\u043e \u043a\u043e\u0434\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u043e\u0432 \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u0438<\/a> \u043d\u0430\u043f\u0440\u044f\u043c\u0443\u044e.<\/p>\n<p>  <\/p>\n<p>\u041c\u044b \u043c\u043e\u0436\u0435\u043c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0445\u0440\u0430\u043d\u0438\u043b\u0438\u0449\u0435 <a href=\"https:\/\/www.consul.io\/api\/kv.html\" rel=\"nofollow\">\u043a\u043b\u044e\u0447\u0435\u0439 \/ \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0439 Consul<\/a> \u0434\u043b\u044f \u043e\u0431\u043c\u0435\u043d\u0430 \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u0435\u0439 \u043c\u0435\u0436\u0434\u0443 \u043e\u0431\u043e\u0438\u043c\u0438 \u044d\u043a\u0437\u0435\u043c\u043f\u043b\u044f\u0440\u0430\u043c\u0438 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f Django.<\/p>\n<p>  <\/p>\n<p>\u041c\u044b \u043c\u043e\u0436\u0435\u043c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c <a href=\"https:\/\/www.consul.io\/api\/index.html\" rel=\"nofollow\">HTTP-\u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441 Consul<\/a> \u0434\u043b\u044f \u0445\u0440\u0430\u043d\u0435\u043d\u0438\u044f \u043f\u0430\u0440\u044b \u043a\u043b\u044e\u0447 \/ \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u0438 \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u044f \u0438\u0445 \u0432 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0438, \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044f \u043a\u043b\u0438\u0435\u043d\u0442 Python \u0441 \u043e\u0442\u043a\u0440\u044b\u0442\u044b\u043c \u0438\u0441\u0445\u043e\u0434\u043d\u044b\u043c \u043a\u043e\u0434\u043e\u043c \u0434\u043b\u044f Consul, \u043d\u0430\u0437\u044b\u0432\u0430\u0435\u043c\u044b\u0439 <a href=\"https:\/\/python-consul.readthedocs.io\/en\/latest\/\" rel=\"nofollow\">python-consul<\/a>. \u0412\u044b \u0442\u0430\u043a\u0436\u0435 \u043c\u043e\u0436\u0435\u0442\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u043b\u044e\u0431\u0443\u044e \u0434\u0440\u0443\u0433\u0443\u044e \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0443 Python, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u043c\u043e\u0436\u0435\u0442 \u0432\u0437\u0430\u0438\u043c\u043e\u0434\u0435\u0439\u0441\u0442\u0432\u043e\u0432\u0430\u0442\u044c \u0441 Consul KV, \u0435\u0441\u043b\u0438 \u0445\u043e\u0442\u0438\u0442\u0435.<\/p>\n<p>  <\/p>\n<p>\u0414\u0430\u0432\u0430\u0439\u0442\u0435 \u043d\u0430\u0447\u043d\u0435\u043c \u0441 \u0442\u043e\u0433\u043e, \u0447\u0442\u043e \u043f\u043e\u0441\u043c\u043e\u0442\u0440\u0438\u043c, \u043a\u0430\u043a \u043c\u044b \u043c\u043e\u0436\u0435\u043c \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442\u044c \u043f\u0430\u0440\u0443 \u043a\u043b\u044e\u0447 \/ \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u0432 Consul, \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044f \u0435\u0433\u043e HTTP-\u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441.<\/p>\n<p>  <\/p>\n<pre><code class=\"bash\"># Flag to run Django app in debug mode curl -X PUT -d 'True' consul_server:8500\/v1\/kv\/web\/debug  # Dynamic entries into Django app configuration  # to denote allowed set of hosts curl -X PUT -d 'localhost, 33.10.0.100' consul_server:8500\/v1\/kv\/web\/allowed_hosts  # Dynamic entries into Django app configuration # to denote installed apps curl -X PUT -d 'tweetapp' consul_server:8500\/v1\/kv\/web\/installed_apps<\/code><\/pre>\n<p>  <\/p>\n<p>\u041f\u043e\u0441\u043b\u0435 \u0442\u043e\u0433\u043e, \u043a\u0430\u043a \u043c\u044b \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u043b\u0438 \u0445\u0440\u0430\u043d\u0438\u043b\u0438\u0449\u0435 KV, \u043c\u044b \u043c\u043e\u0436\u0435\u043c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0435\u0433\u043e \u0432 \u044d\u043a\u0437\u0435\u043c\u043f\u043b\u044f\u0440\u0430\u0445 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f Django, \u0447\u0442\u043e\u0431\u044b \u043d\u0430\u0441\u0442\u0440\u043e\u0438\u0442\u044c \u0435\u0433\u043e \u0441 \u044d\u0442\u0438\u043c\u0438 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f\u043c\u0438.<\/p>\n<p>  <\/p>\n<p>\u0414\u0430\u0432\u0430\u0439\u0442\u0435 \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u043c <a href=\"https:\/\/pypi.org\/project\/python-consul\/\" rel=\"nofollow\">python-consul<\/a> \u0438 \u0434\u043e\u0431\u0430\u0432\u0438\u043c \u0435\u0433\u043e \u043a\u0430\u043a \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u044c \u043f\u0440\u043e\u0435\u043a\u0442\u0430.<\/p>\n<p>  <\/p>\n<pre><code class=\"bash\">$ pipenv shell Launching subshell in virtual environment\u2026  . \/home\/pranav\/.local\/share\/virtualenvs\/tweeter-PYSn2zRU\/bin\/activate  $  . \/home\/pranav\/.local\/share\/virtualenvs\/tweeter-PYSn2zRU\/bin\/activate  (tweeter) $ pipenv install python-consul Installing python-consul\u2026 Adding python-consul to Pipfile's [packages]\u2026  Installation Succeeded  Locking [dev-packages] dependencies\u2026 Locking [packages] dependencies\u2026  Success!  Updated Pipfile.lock (9590cc)! Installing dependencies from Pipfile.lock (9590cc)\u2026      \u2589\u2589\u2589\u2589\u2589\u2589\u2589\u2589\u2589\u2589\u2589\u2589\u2589\u2589\u2589\u2589\u2589\u2589\u2589\u2589\u2589\u2589\u2589\u2589\u2589\u2589\u2589\u2589\u2589\u2589\u2589\u2589 14\/14 \u2014 00:00:20<\/code><\/pre>\n<p>  <\/p>\n<p>\u041d\u0430\u043c \u043d\u0443\u0436\u043d\u043e \u0431\u0443\u0434\u0435\u0442 \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0438\u0442\u044c \u043d\u0430\u0448\u0435 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u043a Consul \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e python-consul.<\/p>\n<p>  <\/p>\n<pre><code class=\"bash\">import consul  consul_client = consul.Consul(     host='consul_server',     port=8500, )<\/code><\/pre>\n<p>  <\/p>\n<p>\u041c\u044b \u043c\u043e\u0436\u0435\u043c \u0437\u0430\u0445\u0432\u0430\u0442\u0438\u0442\u044c \u0438 \u043d\u0430\u0441\u0442\u0440\u043e\u0438\u0442\u044c \u043d\u0430\u0448\u0435 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435 Django \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u044e\u0449\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0438 <code>python-consul<\/code>.<\/p>\n<p>  <\/p>\n<pre><code class=\"bash\"># Set DEBUG flag using Consul KV store index, data = consul_client.kv.get('web\/debug') DEBUG = data.get('Value', True)  # Set ALLOWED_HOSTS dynamically using Consul KV store ALLOWED_HOSTS = []  index, hosts = consul_client.kv.get('web\/allowed_hosts') ALLOWED_HOSTS.append(hosts.get('Value'))  # Set INSTALLED_APPS dynamically using Consul KV store INSTALLED_APPS = [     'django.contrib.admin',     'django.contrib.auth',     'django.contrib.contenttypes',     'django.contrib.sessions',     'django.contrib.messages',     'django.contrib.staticfiles', ]  index, apps = consul_client.kv.get('web\/installed_apps') INSTALLED_APPS += (bytes(apps.get('Value')).decode('utf-8'),)<\/code><\/pre>\n<p>  <\/p>\n<p>\u042d\u0442\u0438 \u043f\u0430\u0440\u044b \u043a\u043b\u044e\u0447 \/ \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u0438\u0437 \u043c\u0430\u0433\u0430\u0437\u0438\u043d\u0430 Consul KV \u0442\u0430\u043a\u0436\u0435 \u043c\u043e\u0436\u043d\u043e \u043f\u0440\u043e\u0441\u043c\u0430\u0442\u0440\u0438\u0432\u0430\u0442\u044c \u0438 \u043e\u0431\u043d\u043e\u0432\u043b\u044f\u0442\u044c \u0447\u0435\u0440\u0435\u0437 \u0435\u0433\u043e \u0432\u0435\u0431-\u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441.<\/p>\n<p>  <\/p>\n<p><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/83\/oy\/38\/83oy38ag475voobbycc5mos7jhk.png\"><\/p>\n<p>  <\/p>\n<p><em>Consul KV store \u0432 \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441\u0435 Consul Web \u0441 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u0430\u043c\u0438 \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u0438 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f Django<\/em><\/p>\n<p>  <\/p>\n<p>\u041a\u043e\u0434, \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c\u044b\u0439 \u043a\u0430\u043a \u0447\u0430\u0441\u0442\u044c \u044d\u0442\u043e\u0433\u043e \u0440\u0443\u043a\u043e\u0432\u043e\u0434\u0441\u0442\u0432\u0430 \u0434\u043b\u044f \u0440\u0430\u0437\u0434\u0435\u043b\u0430 \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u0438 \u0441\u043b\u0443\u0436\u0431\u044b Consul, \u0434\u043e\u0441\u0442\u0443\u043f\u0435\u043d \u0432 \u0432\u0435\u0442\u0432\u0438 \u00abservice-configuration\u00bb \u043f\u0440\u043e\u0435\u043a\u0442\u0430 <a href=\"http:\/\/pranavcode\/consul-demo\" rel=\"nofollow\">pranavcode\/consul-demo<\/a>.<\/p>\n<p>  <\/p>\n<p>\u0412\u043e\u0442 \u043a\u0430\u043a \u043c\u043e\u0436\u043d\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c Consul KV \u0438 \u043b\u0435\u0433\u043a\u043e \u043d\u0430\u0441\u0442\u0440\u0430\u0438\u0432\u0430\u0442\u044c \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u044b\u0435 \u0441\u043b\u0443\u0436\u0431\u044b \u0432 \u0438\u0445 \u0430\u0440\u0445\u0438\u0442\u0435\u043a\u0442\u0443\u0440\u0435.<\/p>\n<p>  <\/p>\n<h3 id=\"segmentaciya-uslug-s-ispolzovaniem-consul\">\u0421\u0435\u0433\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u044f \u0443\u0441\u043b\u0443\u0433 \u0441 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435\u043c Consul<\/h3>\n<p>  <\/p>\n<p>\u0412 \u0440\u0430\u043c\u043a\u0430\u0445 <a href=\"https:\/\/www.consul.io\/segmentation.html\" rel=\"nofollow\">\u0441\u0435\u0433\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u0438 \u0441\u0435\u0440\u0432\u0438\u0441\u043e\u0432<\/a> Consul \u043c\u044b \u0440\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0438\u043c <a href=\"https:\/\/www.consul.io\/docs\/connect\/intentions.html\" rel=\"nofollow\">\u0438\u0434\u0435\u044e Consul Connect<\/a> \u0438 \u0440\u0430\u0441\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u043d\u044b\u0439 \u0434\u0430\u0442\u0430-\u0446\u0435\u043d\u0442\u0440.<\/p>\n<p>  <\/p>\n<p>Connect \u043e\u0431\u0435\u0441\u043f\u0435\u0447\u0438\u0432\u0430\u0435\u0442 \u0430\u0432\u0442\u043e\u0440\u0438\u0437\u0430\u0446\u0438\u044e \u0438 \u0448\u0438\u0444\u0440\u043e\u0432\u0430\u043d\u0438\u0435 \u0441\u043e\u0435\u0434\u0438\u043d\u0435\u043d\u0438\u0439 \u043c\u0435\u0436\u0434\u0443 \u0441\u0435\u0440\u0432\u0438\u0441\u0430\u043c\u0438 \u0441 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435\u043c <a href=\"https:\/\/en.wikipedia.org\/wiki\/Mutual_authentication\" rel=\"nofollow\">\u0432\u0437\u0430\u0438\u043c\u043d\u043e\u0433\u043e TLS<\/a>.<\/p>\n<p>  <\/p>\n<p>\u0427\u0442\u043e\u0431\u044b \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c Consul, \u0432\u0430\u043c \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u0432\u043a\u043b\u044e\u0447\u0438\u0442\u044c \u0435\u0433\u043e \u0432 \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u0438 \u0441\u0435\u0440\u0432\u0435\u0440\u0430. \u0414\u043b\u044f \u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u043e\u0433\u043e \u0444\u0443\u043d\u043a\u0446\u0438\u043e\u043d\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u043a\u043b\u0430\u0441\u0442\u0435\u0440\u0430 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u0432\u043a\u043b\u044e\u0447\u0438\u0442\u044c \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435 \u0432 \u043a\u043b\u0430\u0441\u0442\u0435\u0440\u0435 Consul.<\/p>\n<p>  <\/p>\n<pre><code class=\"plaintext\">{     &quot;connect&quot;: {         &quot;enabled&quot;: true     } }<\/code><\/pre>\n<p>  <\/p>\n<p>\u0412 \u043d\u0430\u0448\u0435\u043c \u043a\u043e\u043d\u0442\u0435\u043a\u0441\u0442\u0435 \u043c\u044b \u043c\u043e\u0436\u0435\u043c \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0438\u0442\u044c, \u0447\u0442\u043e \u0441\u0432\u044f\u0437\u044c \u0434\u043e\u043b\u0436\u043d\u0430 \u0431\u044b\u0442\u044c \u0438\u0434\u0435\u043d\u0442\u0438\u0444\u0438\u0446\u0438\u0440\u043e\u0432\u0430\u043d\u0430 \u0438 \u0437\u0430\u0449\u0438\u0449\u0435\u043d\u0430 TLS, \u043c\u044b \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0438\u043c \u0432\u043e\u0441\u0445\u043e\u0434\u044f\u0449\u0443\u044e \u0441\u043e\u043f\u0443\u0442\u0441\u0442\u0432\u0443\u044e\u0449\u0443\u044e \u0441\u043b\u0443\u0436\u0431\u0443 \u0441 \u043f\u0440\u043e\u043a\u0441\u0438 \u0432 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0438 Django \u0434\u043b\u044f \u0435\u0435 \u0441\u0432\u044f\u0437\u0438 \u0441 \u043f\u0435\u0440\u0432\u0438\u0447\u043d\u044b\u043c \u044d\u043a\u0437\u0435\u043c\u043f\u043b\u044f\u0440\u043e\u043c MongoDB.<\/p>\n<p>  <\/p>\n<pre><code class=\"plaintext\">{     &quot;service&quot;: {         &quot;name&quot;: &quot;web&quot;,         &quot;port&quot;: 8000,         &quot;tags&quot;: [             &quot;web&quot;,             &quot;application&quot;,             &quot;urlprefix-\/web&quot;         ],         &quot;connect&quot;: {             &quot;sidecar_service&quot;: {                 &quot;proxy&quot;: {                     &quot;upstreams&quot;: [{                         &quot;destination_name&quot;: &quot;mongo-primary&quot;,                         &quot;local_bind_port&quot;: 5501                     }]                 }             }         },         &quot;check&quot;: {             &quot;id&quot;: &quot;web_app_status&quot;,             &quot;name&quot;: &quot;Web Application Status&quot;,             &quot;tcp&quot;: &quot;localhost:8000&quot;,             &quot;interval&quot;: &quot;30s&quot;,             &quot;timeout&quot;: &quot;20s&quot;         }     } }<\/code><\/pre>\n<p>  <\/p>\n<p>\u041d\u0430\u0440\u044f\u0434\u0443 \u0441 \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u043e\u0439 Connect \u0434\u043b\u044f \u0431\u043e\u043a\u043e\u0432\u043e\u0433\u043e \u043f\u0440\u043e\u043a\u0441\u0438 \u043d\u0430\u043c \u0442\u0430\u043a\u0436\u0435 \u043f\u043e\u0442\u0440\u0435\u0431\u0443\u0435\u0442\u0441\u044f \u0437\u0430\u043f\u0443\u0441\u0442\u0438\u0442\u044c \u043f\u0440\u043e\u043a\u0441\u0438-\u0441\u0435\u0440\u0432\u0435\u0440 Connect \u0434\u043b\u044f \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f Django. \u042d\u0442\u043e\u0433\u043e \u043c\u043e\u0436\u043d\u043e \u0434\u043e\u0431\u0438\u0442\u044c\u0441\u044f, \u0432\u044b\u043f\u043e\u043b\u043d\u0438\u0432 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0443\u044e \u043a\u043e\u043c\u0430\u043d\u0434\u0443.<\/p>\n<p>  <\/p>\n<pre><code class=\"plaintext\">{     &quot;service&quot;: {         &quot;name&quot;: &quot;web&quot;,         &quot;port&quot;: 8000,         &quot;tags&quot;: [             &quot;web&quot;,             &quot;application&quot;,             &quot;urlprefix-\/web&quot;         ],         &quot;connect&quot;: {             &quot;sidecar_service&quot;: {                 &quot;proxy&quot;: {                     &quot;upstreams&quot;: [{                         &quot;destination_name&quot;: &quot;mongo-primary&quot;,                         &quot;local_bind_port&quot;: 5501                     }]                 }             }         },         &quot;check&quot;: {             &quot;id&quot;: &quot;web_app_status&quot;,             &quot;name&quot;: &quot;Web Application Status&quot;,             &quot;tcp&quot;: &quot;localhost:8000&quot;,             &quot;interval&quot;: &quot;30s&quot;,             &quot;timeout&quot;: &quot;20s&quot;         }     } }<\/code><\/pre>\n<p>  <\/p>\n<p>\u041c\u044b \u043c\u043e\u0436\u0435\u043c \u0434\u043e\u0431\u0430\u0432\u0438\u0442\u044c Consul Connect Intentions \u0434\u043b\u044f \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f <a href=\"https:\/\/velotio.com\/blog\/2019\/3\/11\/hashicorp-consul-guide-1\" rel=\"nofollow\">\u0433\u0440\u0430\u0444\u0430 \u0441\u0435\u0440\u0432\u0438\u0441\u043e\u0432<\/a> \u0434\u043b\u044f \u0432\u0441\u0435\u0445 \u0441\u0435\u0440\u0432\u0438\u0441\u043e\u0432 \u0438 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u044f \u0448\u0430\u0431\u043b\u043e\u043d\u043e\u0432 \u0442\u0440\u0430\u0444\u0438\u043a\u0430. \u041c\u044b \u043c\u043e\u0436\u0435\u043c \u0441\u043e\u0437\u0434\u0430\u0432\u0430\u0442\u044c \u043d\u0430\u043c\u0435\u0440\u0435\u043d\u0438\u044f, \u043a\u0430\u043a \u043f\u043e\u043a\u0430\u0437\u0430\u043d\u043e \u043d\u0438\u0436\u0435:<\/p>\n<p>  <\/p>\n<pre><code class=\"plaintext\">$ consul connect proxy -sidecar-for web<\/code><\/pre>\n<p>  <\/p>\n<p>\u041d\u0430\u043c\u0435\u0440\u0435\u043d\u0438\u044f\u043c\u0438 \u0434\u043b\u044f \u0433\u0440\u0430\u0444\u0430 \u0443\u0441\u043b\u0443\u0433 \u0442\u0430\u043a\u0436\u0435 \u043c\u043e\u0436\u043d\u043e \u0443\u043f\u0440\u0430\u0432\u043b\u044f\u0442\u044c \u0438\u0437 \u0432\u0435\u0431-\u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441\u0430 Consul.<\/p>\n<p>  <\/p>\n<p><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/cm\/hm\/ax\/cmhmaxjf6psd0zbbe7kmajcvcwm.png\"><\/p>\n<p>  <\/p>\n<p>\u042d\u0442\u043e \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u0435\u0442 \u043e\u0433\u0440\u0430\u043d\u0438\u0447\u0435\u043d\u0438\u044f \u043d\u0430 \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435 \u043a \u0441\u043b\u0443\u0436\u0431\u0435, \u0447\u0442\u043e\u0431\u044b \u0440\u0430\u0437\u0440\u0435\u0448\u0438\u0442\u044c \u0438\u043b\u0438 \u0437\u0430\u043f\u0440\u0435\u0442\u0438\u0442\u044c \u0438\u043c \u043e\u0431\u0449\u0430\u0442\u044c\u0441\u044f \u0447\u0435\u0440\u0435\u0437 Connect.<\/p>\n<p>  <\/p>\n<p>\u041c\u044b \u0442\u0430\u043a\u0436\u0435 \u0434\u043e\u0431\u0430\u0432\u0438\u043b\u0438 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044c \u0434\u043b\u044f \u0430\u0433\u0435\u043d\u0442\u043e\u0432 Consul \u0443\u043a\u0430\u0437\u044b\u0432\u0430\u0442\u044c, \u043a \u043a\u0430\u043a\u0438\u043c \u0446\u0435\u043d\u0442\u0440\u0430\u043c \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0438 \u0434\u0430\u043d\u043d\u044b\u0445 \u043e\u043d\u0438 \u043f\u0440\u0438\u043d\u0430\u0434\u043b\u0435\u0436\u0430\u0442, \u0438 \u0431\u044b\u0442\u044c \u0434\u043e\u0441\u0442\u0443\u043f\u043d\u044b\u043c\u0438 \u0447\u0435\u0440\u0435\u0437 \u043e\u0434\u0438\u043d \u0438\u043b\u0438 \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0441\u0435\u0440\u0432\u0435\u0440\u043e\u0432 Consul \u0432 \u0434\u0430\u043d\u043d\u043e\u043c \u0446\u0435\u043d\u0442\u0440\u0435 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0438 \u0434\u0430\u043d\u043d\u044b\u0445.<\/p>\n<p>  <\/p>\n<p>\u041a\u043e\u0434, \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c\u044b\u0439 \u043a\u0430\u043a \u0447\u0430\u0441\u0442\u044c \u044d\u0442\u043e\u0433\u043e \u0440\u0443\u043a\u043e\u0432\u043e\u0434\u0441\u0442\u0432\u0430 \u0434\u043b\u044f \u0440\u0430\u0437\u0434\u0435\u043b\u0430 \u0441\u0435\u0433\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u0438 \u0443\u0441\u043b\u0443\u0433 Consul, \u0434\u043e\u0441\u0442\u0443\u043f\u0435\u043d \u0432 \u0432\u0435\u0442\u0432\u0438 <code>service-segmentation<\/code> \u043f\u0440\u043e\u0435\u043a\u0442\u0430 <a href=\"http:\/\/velotiotech\/consul-demo\" rel=\"nofollow\">velotiotech\/consul-demo<\/a>.<\/p>\n<p>  <\/p>\n<p>\u0412\u043e\u0442 \u043a\u0430\u043a \u043c\u043e\u0436\u043d\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0444\u0443\u043d\u043a\u0446\u0438\u044e \u0441\u0435\u0433\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u0438 \u0443\u0441\u043b\u0443\u0433 Consul \u0438 \u043d\u0430\u0441\u0442\u0440\u043e\u0438\u0442\u044c \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u044c \u0434\u043e\u0441\u0442\u0443\u043f\u0430 \u043a \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u044e \u043d\u0430 \u0443\u0440\u043e\u0432\u043d\u0435 \u043e\u0431\u0441\u043b\u0443\u0436\u0438\u0432\u0430\u043d\u0438\u044f.<\/p>\n<p>  <\/p>\n<h3 id=\"vyvod\">\u0412\u044b\u0432\u043e\u0434<\/h3>\n<p>  <\/p>\n<p>\u0412\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044c \u0431\u0435\u0441\u043f\u0440\u0435\u043f\u044f\u0442\u0441\u0442\u0432\u0435\u043d\u043d\u043e \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0441\u0435\u0440\u0432\u0438\u0441\u043d\u0443\u044e \u0441\u0435\u0442\u044c, \u043a\u043e\u0442\u043e\u0440\u0443\u044e \u043f\u0440\u0435\u0434\u043e\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442 Consul, \u043e\u0447\u0435\u043d\u044c \u0443\u043f\u0440\u043e\u0449\u0430\u0435\u0442 \u0436\u0438\u0437\u043d\u044c \u043e\u043f\u0435\u0440\u0430\u0442\u043e\u0440\u0430. \u041c\u044b \u043d\u0430\u0434\u0435\u0435\u043c\u0441\u044f, \u0447\u0442\u043e \u0432\u044b \u0443\u0437\u043d\u0430\u043b\u0438, \u043a\u0430\u043a Consul \u043c\u043e\u0436\u043d\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0434\u043b\u044f \u043e\u0431\u043d\u0430\u0440\u0443\u0436\u0435\u043d\u0438\u044f, \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0438 \u0438 \u0441\u0435\u0433\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u0438 \u0441\u0435\u0440\u0432\u0438\u0441\u043e\u0432 \u0441 \u0435\u0433\u043e \u043f\u0440\u0430\u043a\u0442\u0438\u0447\u0435\u0441\u043a\u043e\u0439 \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0435\u0439.<\/p>\n<p>  <\/p>\n<p>\u041a\u0430\u043a \u043e\u0431\u044b\u0447\u043d\u043e, \u043c\u044b \u043d\u0430\u0434\u0435\u0435\u043c\u0441\u044f, \u0447\u0442\u043e \u0438\u0437\u0443\u0447\u0435\u043d\u0438\u0435 \u041a\u043e\u043d\u0441\u0443\u043b\u0430 \u0431\u044b\u043b\u043e \u043f\u043e\u0437\u043d\u0430\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u044b\u043c. \u042d\u0442\u043e \u0431\u044b\u043b\u0430 \u043f\u043e\u0441\u043b\u0435\u0434\u043d\u044f\u044f \u0447\u0430\u0441\u0442\u044c \u044d\u0442\u043e\u0439 \u0441\u0435\u0440\u0438\u0438 \u0438\u0437 \u0434\u0432\u0443\u0445 \u0447\u0430\u0441\u0442\u0435\u0439. \u0412 \u044d\u0442\u043e\u0439 \u0447\u0430\u0441\u0442\u0438 \u0434\u0435\u043b\u0430\u0435\u0442\u0441\u044f \u043f\u043e\u043f\u044b\u0442\u043a\u0430 \u043e\u0445\u0432\u0430\u0442\u0438\u0442\u044c \u0431\u043e\u043b\u044c\u0448\u0438\u043d\u0441\u0442\u0432\u043e \u0430\u0441\u043f\u0435\u043a\u0442\u043e\u0432 \u0430\u0440\u0445\u0438\u0442\u0435\u043a\u0442\u0443\u0440\u044b Consul \u0438 \u0442\u043e, \u043a\u0430\u043a \u043e\u043d\u0430 \u0432\u043f\u0438\u0441\u044b\u0432\u0430\u0435\u0442\u0441\u044f \u0432 \u0432\u0430\u0448 \u0442\u0435\u043a\u0443\u0449\u0438\u0439 \u043f\u0440\u043e\u0435\u043a\u0442. \u0415\u0441\u043b\u0438 \u0432\u044b \u043f\u0440\u043e\u043f\u0443\u0441\u0442\u0438\u043b\u0438 \u043f\u0435\u0440\u0432\u0443\u044e \u0447\u0430\u0441\u0442\u044c, \u0432\u044b \u0441\u043c\u043e\u0436\u0435\u0442\u0435 \u043d\u0430\u0439\u0442\u0438 \u0435\u0435 <a href=\"https:\/\/velotio.com\/blog\/2019\/3\/11\/hashicorp-consul-guide-1\" rel=\"nofollow\">\u0437\u0434\u0435\u0441\u044c<\/a>.<\/p>\n<p>  <\/p>\n<p>\u041c\u044b \u043f\u0440\u043e\u0434\u043e\u043b\u0436\u0438\u043c \u0438\u0437\u0443\u0447\u0430\u0442\u044c \u0440\u0430\u0437\u043b\u0438\u0447\u043d\u044b\u0435 \u0442\u0435\u0445\u043d\u043e\u043b\u043e\u0433\u0438\u0438 \u0438 \u043f\u0440\u0435\u0434\u043e\u0441\u0442\u0430\u0432\u0438\u043c \u0432\u0430\u043c \u043d\u0430\u0438\u0431\u043e\u043b\u0435\u0435 \u0446\u0435\u043d\u043d\u0443\u044e \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u044e. \u0421\u043e\u043e\u0431\u0449\u0438\u0442\u0435 \u043d\u0430\u043c, \u0447\u0442\u043e \u0432\u044b \u0445\u043e\u0442\u0435\u043b\u0438 \u0431\u044b \u0443\u0441\u043b\u044b\u0448\u0430\u0442\u044c \u043e\u0442 \u043d\u0430\u0441 \u0432 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0439 \u0440\u0430\u0437, \u0438\u043b\u0438, \u0435\u0441\u043b\u0438 \u0443 \u0432\u0430\u0441 \u0435\u0441\u0442\u044c \u043a\u0430\u043a\u0438\u0435-\u043b\u0438\u0431\u043e \u0432\u043e\u043f\u0440\u043e\u0441\u044b \u043f\u043e \u044d\u0442\u043e\u0439 \u0442\u0435\u043c\u0435, \u043c\u044b \u0431\u0443\u0434\u0435\u043c \u043e\u0447\u0435\u043d\u044c \u0440\u0430\u0434\u044b \u043d\u0430 \u043d\u0438\u0445 \u043e\u0442\u0432\u0435\u0442\u0438\u0442\u044c.<\/p>\n<p>  <\/p>\n<h3 id=\"ssylki\">\u0421\u0441\u044b\u043b\u043a\u0438<\/h3>\n<p>  <\/p>\n<ul>\n<li><a href=\"https:\/\/github.com\/pranavcode\/consul-demo\" rel=\"nofollow\">Consul Demo that complements this guide<\/a><\/li>\n<li><a href=\"https:\/\/www.consul.io\/\" rel=\"nofollow\">HashiCorp Consul<\/a> and<a href=\"https:\/\/github.com\/hashicorp\/consul\" rel=\"nofollow\"> its repo on GitHub<\/a><\/li>\n<li><a href=\"https:\/\/www.consul.io\/docs\/guides\/index.html\" rel=\"nofollow\">HashiCorp Consul Guides<\/a> and<a href=\"https:\/\/github.com\/hashicorp\/consul-guides\" rel=\"nofollow\"> Code<\/a><\/li>\n<\/ul>\n<\/div>\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:\/\/habr.com\/ru\/post\/536444\/\"> https:\/\/habr.com\/ru\/post\/536444\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"\n<div class=\"post__text post__text-html post__text_v1\" id=\"post-content-body\">\n<p><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/r-\/-d\/a0\/r--da0gbyafieifqbiwxezr48a4.jpeg\"><\/p>\n<p>  <\/p>\n<p>\u042d\u0442\u043e \u0432\u0442\u043e\u0440\u0430\u044f \u0447\u0430\u0441\u0442\u044c \u0438\u0437 2 \u0447\u0430\u0441\u0442\u0435\u0439 \u041f\u0440\u0430\u043a\u0442\u0438\u0447\u0435\u0441\u043a\u043e\u0433\u043e \u0440\u0443\u043a\u043e\u0432\u043e\u0434\u0441\u0442\u0432\u0430 \u043f\u043e HashiCorp Consul. <a href=\"https:\/\/habr.com\/ru\/post\/531602\/\">\u041f\u0440\u0435\u0434\u044b\u0434\u0443\u0449\u0430\u044f<\/a> \u0447\u0430\u0441\u0442\u044c \u0431\u044b\u043b\u0430 \u0432 \u043f\u0435\u0440\u0432\u0443\u044e \u043e\u0447\u0435\u0440\u0435\u0434\u044c \u0441\u043e\u0441\u0440\u0435\u0434\u043e\u0442\u043e\u0447\u0435\u043d\u0430 \u043d\u0430 \u043f\u043e\u043d\u0438\u043c\u0430\u043d\u0438\u0438 \u043f\u0440\u043e\u0431\u043b\u0435\u043c, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0440\u0435\u0448\u0430\u0435\u0442 Consul, \u0438 \u043d\u0430 \u0442\u043e\u043c, \u043a\u0430\u043a \u043e\u043d \u0438\u0445 \u0440\u0435\u0448\u0430\u0435\u0442. \u042d\u0442\u0430 \u0447\u0430\u0441\u0442\u044c \u043f\u043e\u0441\u0432\u044f\u0449\u0435\u043d\u0430 \u043f\u0440\u0430\u043a\u0442\u0438\u0447\u0435\u0441\u043a\u043e\u043c\u0443 \u043f\u0440\u0438\u043c\u0435\u043d\u0435\u043d\u0438\u044e Consul \u043d\u0430 \u043f\u0440\u0438\u043c\u0435\u0440\u0435 \u0440\u0435\u0430\u043b\u044c\u043d\u043e\u0439 \u0436\u0438\u0437\u043d\u0438. \u0414\u0430\u0432\u0430\u0439\u0442\u0435 \u043d\u0430\u0447\u043d\u0435\u043c.<\/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-316075","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/316075","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=316075"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/316075\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=316075"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=316075"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=316075"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}