{"id":315501,"date":"2020-12-24T21:00:24","date_gmt":"2020-12-24T21:00:24","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=315501"},"modified":"-0001-11-30T00:00:00","modified_gmt":"2020-12-24T21:00:24","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=315501","title":{"rendered":"\u0417\u0430\u0440\u044f\u0436\u0430\u0439 Patroni. \u0422\u0435\u0441\u0442\u0438\u0440\u0443\u0435\u043c Patroni + Zookeeper \u043a\u043b\u0430\u0441\u0442\u0435\u0440 (\u0427\u0430\u0441\u0442\u044c \u043f\u0435\u0440\u0432\u0430\u044f)"},"content":{"rendered":"\n<div class=\"post__text post__text_v2\" id=\"post-content-body\">\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/351\/b3c\/28a\/351b3c28a56325f119bbf2f0db490d0e.jpg\" alt=\"\u041a\u0430\u0434\u0440 \u0438\u0437 \u0444\u0438\u043b\u044c\u043c\u0430 \u00ab\u0420\u0435\u043c\u0431\u043e IV\u00bb\" title=\"\u041a\u0430\u0434\u0440 \u0438\u0437 \u0444\u0438\u043b\u044c\u043c\u0430 \u00ab\u0420\u0435\u043c\u0431\u043e IV\u00bb\" width=\"1280\" height=\"720\"><figcaption>\u041a\u0430\u0434\u0440 \u0438\u0437 \u0444\u0438\u043b\u044c\u043c\u0430 \u00ab\u0420\u0435\u043c\u0431\u043e IV\u00bb<\/figcaption><\/figure>\n<h2>\u0412\u0441\u0442\u0443\u043f\u043b\u0435\u043d\u0438\u0435<\/h2>\n<p>\u0415\u0441\u043b\u0438 \u0432\u044b&nbsp;\u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442\u0435 \u0441&nbsp;crucial data, \u0442\u043e&nbsp;\u0440\u0430\u043d\u043e \u0438\u043b\u0438 \u043f\u043e\u0437\u0434\u043d\u043e \u0437\u0430\u0434\u0443\u043c\u0430\u0435\u0442\u0435\u0441\u044c \u043e&nbsp;\u0442\u043e\u043c, \u0447\u0442\u043e \u043d\u0435\u043f\u043b\u043e\u0445\u043e&nbsp;\u0431\u044b \u043f\u043e\u0434\u043d\u044f\u0442\u044c \u043a\u043b\u0430\u0441\u0442\u0435\u0440 \u043e\u0442\u043a\u0430\u0437\u043e\u0443\u0441\u0442\u043e\u0439\u0447\u0438\u0432\u043e\u0441\u0442\u0438. \u0414\u0430\u0436\u0435 \u0435\u0441\u043b\u0438 \u043e\u0441\u043d\u043e\u0432\u043d\u043e\u0439 \u0441\u0435\u0440\u0432\u0435\u0440 \u0441&nbsp;\u0431\u0430\u0437\u043e\u0439 \u0443\u043b\u0435\u0442\u0438\u0442 \u0432&nbsp;\u0433\u043b\u0443\u0445\u043e\u0439 \u043d\u043e\u043a\u0430\u0443\u0442, show must go&nbsp;on, \u043d\u0435&nbsp;\u0442\u0430\u043a&nbsp;\u043b\u0438? \u041f\u0440\u0438 \u044d\u0442\u043e\u043c \u043c\u044b&nbsp;\u043f\u043e\u0434\u0440\u0430\u0437\u0443\u043c\u0435\u0432\u0430\u0435\u043c \u0434\u0432\u0435 \u0432\u0435\u0449\u0438:<\/p>\n<ul>\n<li>\n<p>\u0431\u0430\u0437\u0430 \u0434\u0430\u043d\u043d\u044b\u0445 \u0441\u043e&nbsp;\u0432\u0441\u0435\u0439 \u0435\u0435&nbsp;\u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u043e\u0439 \u043d\u0430\u043c \u043f\u043e-\u043f\u0440\u0435\u0436\u043d\u0435\u043c\u0443 \u0434\u043e\u0441\u0442\u0443\u043f\u043d\u0430; &nbsp;<\/p>\n<\/li>\n<\/ul>\n<ul>\n<li>\n<p>\u0432\u0441\u0435 \u0434\u0430\u043d\u043d\u044b\u0435 \u043d\u0430\u0445\u043e\u0434\u044f\u0442\u0441\u044f \u0432&nbsp;\u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u0438 \u043c\u0430\u043a\u0441\u0438\u043c\u0430\u043b\u044c\u043d\u043e \u0431\u043b\u0438\u0437\u043a\u043e\u043c \u043a&nbsp;\u0442\u043e\u043c\u0443, \u043a\u043e\u0442\u043e\u0440\u043e\u0435 \u0431\u044b\u043b\u043e \u043d\u0430&nbsp;\u0433\u0435\u0440\u043e\u0438\u0447\u0435\u0441\u043a\u0438 \u043f\u0430\u0432\u0448\u0435\u043c \u043b\u0438\u0434\u0435\u0440\u0435.<\/p>\n<\/li>\n<\/ul>\n<p>Patroni \u043b\u0438\u0448\u044c \u043e\u0434\u043d\u043e \u0438\u0437&nbsp;\u0440\u0435\u0448\u0435\u043d\u0438\u0439 \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u044b. \u0414\u043e&nbsp;\u043d\u0435\u0433\u043e \u044f&nbsp;\u043f\u043e\u043f\u0440\u043e\u0431\u043e\u0432\u0430\u043b \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0434\u0440\u0443\u0433\u0438\u0445 \u0441\u0435\u0440\u0432\u0438\u0441\u043e\u0432 \u0438&nbsp;\u043d\u0430&nbsp;Github \u043e\u0434\u043d\u043e\u0433\u043e \u0438\u0437&nbsp;\u043d\u0438\u0445 (\u043d\u0435&nbsp;\u0431\u0443\u0434\u0443 \u043f\u043e\u043a\u0430\u0437\u044b\u0432\u0430\u0442\u044c \u043a\u0443\u0440\u0441\u043e\u0440\u043e\u043c) \u0434\u043e&nbsp;\u0441\u0438\u0445 \u043f\u043e\u0440 \u0432\u0438\u0441\u0438\u0442 \u0431\u0435\u0437 \u043e\u0442\u0432\u0435\u0442\u0430 \u043e\u0442\u043a\u0440\u044b\u0442\u044b\u0439 \u043c\u043d\u043e\u0439 \u0431\u0430\u0433 \u0440\u0435\u043f\u043e\u0440\u0442, \u0445\u043e\u0442\u044f \u043f\u0440\u043e\u0448\u043b\u043e \u0443\u0436\u0435 \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u043c\u0435\u0441\u044f\u0446\u0435\u0432. \u0423&nbsp;\u0434\u0440\u0443\u0433\u043e\u0433\u043e \u0431\u044b\u043b\u0430 \u043d\u0435&nbsp;\u0441\u0430\u043c\u0430\u044f \u043f\u043e\u043b\u043d\u0430\u044f \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u044f. \u041a\u0430\u043a\u0438\u0435-\u0442\u043e \u043c\u043d\u0435 \u043f\u043e\u043a\u0430\u0437\u0430\u043b\u0438\u0441\u044c \u043d\u0435\u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u043d\u0430\u0434\u0435\u0436\u043d\u044b\u043c\u0438.<\/p>\n<p>\u041f\u043e&nbsp;Patroni&nbsp;\u0436\u0435 \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u043c\u043d\u043e\u0433\u043e \u0438\u043d\u0444\u044b, \u0438&nbsp;\u043e\u043d&nbsp;\u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435\u043d\u043d\u043e \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u0435\u0442\u0441\u044f \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u0430\u043c\u0438. \u0422\u0430\u043a\u0436\u0435 \u043e\u043d&nbsp;\u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442 DCS \u0434\u043b\u044f \u0441\u0438\u043d\u0445\u0440\u043e\u043d\u0438\u0437\u0430\u0446\u0438\u0438 \u043d\u043e\u0434, \u0447\u0442\u043e \u0434\u043e\u043b\u0436\u043d\u043e \u043f\u0440\u0435\u0434\u043e\u0442\u0432\u0440\u0430\u0449\u0430\u0442\u044c \u0441\u0438\u0442\u0443\u0430\u0446\u0438\u0438 \u0441\u043e&nbsp;\u00absplit brain\u00bb.<\/p>\n<p>\u0418\u0437&nbsp;\u043c\u0438\u043d\u0443\u0441\u043e\u0432 \u0441\u043e\u0432\u0435\u0440\u0448\u0435\u043d\u043d\u043e \u0442\u043e\u0447\u043d\u043e \u043d\u0443\u0436\u043d\u043e \u043d\u0430\u0437\u0432\u0430\u0442\u044c&nbsp;\u0442\u043e, \u0447\u0442\u043e \u044d\u0442\u043e \u043d\u0435&nbsp;\u00about of&nbsp;the box solution. \u041a\u0430\u043a \u0441\u043a\u0430\u0437\u0430\u043d\u043e \u0432&nbsp;\u0434\u043e\u043a\u0435:&nbsp; <\/p>\n<blockquote>\n<p>\u201cPatroni is a template for you to create your own customized, high-availability solution using Python&#8230;\u201d<\/p>\n<\/p>\n<\/blockquote>\n<p>\u0418&nbsp;\u043a\u043b\u044e\u0447\u0435\u0432\u043e\u0435 \u0437\u0434\u0435\u0441\u044c \u0441\u043b\u043e\u0432\u043e \u00abtemplate\u00bb. \u0422\u043e&nbsp;\u0435\u0441\u0442\u044c \u0432\u0441\u0435 \u043f\u0440\u0438\u0434\u0435\u0442\u0441\u044f \u0441\u043e\u0431\u0438\u0440\u0430\u0442\u044c \u0441\u0430\u043c\u043e\u043c\u0443. \u041d\u043e&nbsp;\u0432&nbsp;\u043a\u0430\u043a\u043e\u043c-\u0442\u043e \u0441\u043c\u044b\u0441\u043b\u0435 \u044d\u0442\u043e \u043f\u043b\u044e\u0441&nbsp;\u2014 \u043f\u043e&nbsp;\u043a\u0440\u0430\u0439\u043d\u0435\u0439 \u043c\u0435\u0440\u0435, \u043c\u044b&nbsp;\u0434\u0435\u0442\u0430\u043b\u044c\u043d\u043e \u0431\u0443\u0434\u0435\u043c \u0437\u043d\u0430\u0442\u044c, \u0447\u0442\u043e \u0438\u043c\u0435\u043d\u043d\u043e \u0438\u0434\u0451\u0442 \u0432&nbsp;\u043f\u0440\u043e\u0434. <\/p>\n<p>\u041f\u043e&nbsp;\u0441\u043f\u0435\u0446\u0438\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438, \u043a\u0441\u0442\u0430\u0442\u0438, \u044f&nbsp;\u043d\u0435&nbsp;DevOps \u0438\u043d\u0436\u0435\u043d\u0435\u0440. \u041a\u043e\u0433\u0434\u0430 \u043f\u043e\u044f\u0432\u0438\u043b\u0430\u0441\u044c \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e\u0441\u0442\u044c \u043f\u043e\u0434\u043d\u044f\u0442\u044c \u043e\u0442\u043a\u0430\u0437\u043e\u0443\u0441\u0442\u043e\u0439\u0447\u0438\u0432\u044b\u0439 \u043a\u043b\u0430\u0441\u0442\u0435\u0440 \u043c\u043d\u0435 \u043f\u0440\u0438\u0448\u043b\u043e\u0441\u044c \u0441\u043e\u0431\u0440\u0430\u0442\u044c \u0432\u0441\u0435 \u044f\u043c\u044b \u0438&nbsp;\u0441\u0442\u043e\u043b\u0431\u044b \u043a\u0430\u043a\u0438\u0435 \u0442\u043e\u043b\u044c\u043a\u043e \u0431\u044b\u043b\u0438 \u043d\u0430&nbsp;\u044d\u0442\u043e\u043c \u043f\u0443\u0442\u0438. \u041d\u0430\u0434\u0435\u044e\u0441\u044c, \u044d\u0442\u043e\u0442 \u0442\u0443\u0442\u043e\u0440\u0438\u0430\u043b \u043f\u043e\u043c\u043e\u0436\u0435\u0442 \u0432\u0430\u043c \u0434\u043e\u0441\u0442\u0438\u0447\u044c \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u0430, \u0438\u0441\u043f\u044b\u0442\u0430\u0432 \u0432&nbsp;\u0440\u0430\u0437\u044b \u043c\u0435\u043d\u044c\u0448\u0435 \u0441\u0442\u0440\u0430\u0434\u0430\u043d\u0438\u0439 \u0438&nbsp;\u0431\u043e\u043b\u0438, \u0447\u0435\u043c \u0434\u043e\u0432\u0435\u043b\u043e\u0441\u044c \u043c\u043d\u0435. &nbsp;<\/p>\n<p>\u0415\u0441\u043b\u0438 \u0432\u044b&nbsp;\u0443\u0441\u0442\u0430\u043b\u0438 \u0443\u0436\u0435 \u043e\u0442&nbsp;\u0432\u0441\u0442\u0443\u043f\u043b\u0435\u043d\u0438\u0439 \u0438&nbsp;\u0440\u0432\u0435\u0442\u0435\u0441\u044c \u0432&nbsp;\u0431\u043e\u0439, \u0441\u043c\u0435\u043b\u043e \u043f\u0435\u0440\u0435\u0445\u043e\u0434\u0438\u0442\u0435 \u043a&nbsp;\u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u0439 \u0433\u043b\u0430\u0432\u0435.<\/p>\n<p>\u0415\u0441\u043b\u0438 \u043d\u0435\u0442, \u0442\u043e&nbsp;\u043f\u0440\u0435\u0434\u043b\u0430\u0433\u0430\u044e \u043f\u043e\u0434 \u0441\u043f\u043e\u0439\u043b\u0435\u0440\u043e\u043c \u043f\u0440\u043e\u0447\u0435\u0441\u0442\u044c \u043a\u043e\u0440\u043e\u0442\u043a\u0438\u0435 \u0437\u0430\u043c\u0435\u0442\u043a\u0438 \u043f\u043e&nbsp;\u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u0438 \u043a\u043b\u0430\u0441\u0442\u0435\u0440\u0430, \u043a\u043e\u0442\u043e\u0440\u0443\u044e \u044f&nbsp;\u0432\u044b\u0431\u0440\u0430\u043b \u0434\u043b\u044f \u0434\u0435\u043f\u043b\u043e\u044f. <\/p>\n<details class=\"spoiler\">\n<summary>\u0427\u0442\u043e, \u0435\u0449\u0451 \u043e\u0434\u0438\u043d \u0442\u0443\u0442\u043e\u0440\u0438\u0430\u043b \u043e Patroni?<\/summary>\n<div class=\"spoiler__content\">\n<h4>\u0417\u0430\u0447\u0435\u043c \u0447\u0438\u0442\u0430\u0442\u044c \u0438\u043c\u0435\u043d\u043d\u043e \u044d\u0442\u043e\u0442 \u0442\u0443\u0442\u043e\u0440\u0438\u0430\u043b? <\/h4>\n<p>\u0415\u0441\u0442\u044c \u0443\u0436\u0435 \u043d\u0435\u043c\u0430\u043b\u043e \u0442\u0443\u0442\u043e\u0440\u0438\u0430\u043b\u043e\u0432, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0440\u0430\u0441\u0441\u043a\u0430\u0437\u044b\u0432\u0430\u044e\u0442, \u043a\u0430\u043a \u043f\u043e\u0434\u043d\u044f\u0442\u044c \u043a\u043b\u0430\u0441\u0442\u0435\u0440 Patroni. \u042d\u0442\u043e\u0442 \u0437\u0430\u0442\u0440\u0430\u0433\u0438\u0432\u0430\u0435\u0442 \u0432\u043e\u043f\u0440\u043e\u0441\u044b \u0434\u0435\u043f\u043b\u043e\u044f \u0432 \u0441\u0440\u0435\u0434\u0435 docker swarm \u0438 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044f Zookeeper \u0432 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 DCS. <\/p>\n<h4>\u041f\u043e\u0447\u0435\u043c\u0443 Zookeeper?<\/h4>\n<p>\u042f&nbsp;\u0441\u0447\u0438\u0442\u0430\u044e, \u044d\u0442\u043e \u043e\u0434\u0438\u043d \u0438\u0437&nbsp;\u043c\u043e\u043c\u0435\u043d\u0442\u043e\u0432, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0441\u0442\u043e\u0438\u0442 \u0440\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0435\u0442\u044c \u0432\u0441\u0435\u0440\u044c\u0435\u0437, \u043f\u0440\u0435\u0436\u0434\u0435 \u0447\u0435\u043c \u0432\u044b\u0431\u0440\u0430\u0442\u044c \u043a\u043e\u043d\u0435\u0447\u043d\u044b\u0439 \u0441\u0435\u0442\u0430\u043f \u0434\u043b\u044f \u043f\u0440\u043e\u0434\u0430\u043a\u0448\u0435\u043d\u0430. \u0414\u0435\u043b\u043e \u0432&nbsp;\u0442\u043e\u043c, \u0447\u0442\u043e Patroni \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442 \u0441\u0442\u043e\u0440\u043e\u043d\u043d\u0438\u0435 \u0441\u0435\u0440\u0432\u0438\u0441\u044b \u0447\u0442\u043e\u0431\u044b \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442\u044c \u0438&nbsp;\u043e\u0431\u0441\u043b\u0443\u0436\u0438\u0432\u0430\u0442\u044c \u043a\u043e\u043c\u043c\u0443\u043d\u0438\u043a\u0430\u0446\u0438\u044e \u043c\u0435\u0436\u0434\u0443 \u0441\u0432\u043e\u0438\u043c\u0438 \u043d\u043e\u0434\u0430\u043c\u0438. \u0418\u0445&nbsp;\u043e\u0431\u0449\u0435\u0435 \u043d\u0430\u0437\u0432\u0430\u043d\u0438\u0435&nbsp;\u2014 DCS (Dynamic Configuration Storage).<\/p>\n<p>\u0415\u0441\u043b\u0438 \u0432\u044b&nbsp;\u0443\u0436\u0435 \u0441\u043c\u043e\u0442\u0440\u0435\u043b\u0438 \u043a\u0430\u043a\u0438\u0435-\u0442\u043e \u0438\u0437&nbsp;\u0442\u0443\u0442\u043e\u0440\u0438\u0430\u043b\u043e\u0432 \u043e&nbsp;Patroni, \u0442\u043e, \u0434\u043e\u043b\u0436\u043d\u043e \u0431\u044b\u0442\u044c, \u0437\u0430\u043c\u0435\u0442\u0438\u043b\u0438, \u0447\u0442\u043e \u0441\u0430\u043c\u044b\u0439 \u0447\u0430\u0441\u0442\u044b\u0439 \u043a\u0435\u0439\u0441&nbsp;\u2014 \u044d\u0442\u043e \u043a\u043e\u0433\u0434\u0430 \u0432&nbsp;\u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 DCS \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044e\u0442 Etcd \u043a\u043b\u0430\u0441\u0442\u0435\u0440.<\/p>\n<p>\u0418\u043d\u0442\u0435\u0440\u0435\u0441\u043d\u044b\u0439 \u043c\u043e\u043c\u0435\u043d\u0442 \u0432&nbsp;\u0440\u0430\u0431\u043e\u0442\u0435 Etcd \u043a\u043b\u0430\u0441\u0442\u0435\u0440\u0430 \u0437\u0430\u043a\u043b\u044e\u0447\u0430\u0435\u0442\u0441\u044f \u0432&nbsp;\u0442\u043e\u043c, \u0447\u0442\u043e:<\/p>\n<blockquote>\n<p>Since etcd writes data to disk, its performance strongly depends on disk performance. For this reason, SSD is highly recommended. <\/p>\n<p>(\u0438\u0437 \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u0438 Etcd)<\/p>\n<\/p>\n<\/blockquote>\n<p>\u0421\u043b\u043e\u0432\u043e\u043c, \u0435\u0441\u043b\u0438 \u0443&nbsp;\u0432\u0430\u0441 \u043d\u0435\u0442 \u043f\u043e&nbsp;SSD \u0434\u0438\u0441\u043a\u0443 \u043d\u0430&nbsp;\u043a\u0430\u0436\u0434\u043e\u0439 \u043c\u0430\u0448\u0438\u043d\u0435, \u0433\u0434\u0435 \u0431\u0443\u0434\u0443\u0442 \u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c \u043d\u043e\u0434\u044b Etcd, \u0442\u043e&nbsp;\u0432\u044b&nbsp;\u0432&nbsp;\u0437\u043e\u043d\u0435 \u043e\u043f\u0430\u0441\u043d\u043e\u0441\u0442\u0438. \u041a\u043e\u043d\u0435\u0447\u043d\u043e, \u043f\u043e\u043a\u0430 \u043d\u0430\u0433\u0440\u0443\u0437\u043a\u0430 \u043d\u0435\u0431\u043e\u043b\u044c\u0448\u0430\u044f, \u0442\u043e&nbsp;\u043d\u0438\u0447\u0435\u0433\u043e \u043a\u0440\u0438\u0442\u0438\u0447\u043d\u043e\u0433\u043e \u043f\u0440\u043e\u0438\u0441\u0445\u043e\u0434\u0438\u0442\u044c \u043d\u0435&nbsp;\u0431\u0443\u0434\u0435\u0442, \u043d\u043e&nbsp;\u0435\u0441\u043b\u0438 \u044d\u0442\u043e \u0440\u0430\u0431\u043e\u0447\u0438\u0439, \u043d\u0430\u0433\u0440\u0443\u0436\u0435\u043d\u043d\u044b\u0439 \u043f\u0440\u043e\u0434, \u0442\u043e&nbsp;\u043e\u0447\u0435\u043d\u044c \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e (\u0438&nbsp;\u0434\u0430\u0436\u0435 \u0432\u0435\u0440\u043e\u044f\u0442\u043d\u043e), \u0447\u0442\u043e \u0432\u044b&nbsp;\u043f\u0440\u043e\u0441\u0442\u043e \u043f\u0435\u0440\u0435\u0433\u0440\u0443\u0437\u0438\u0442\u0435 Etcd \u043a\u043b\u0430\u0441\u0442\u0435\u0440. \u0410&nbsp;\u044d\u0442\u043e \u043f\u0440\u0438\u0432\u0435\u0434\u0435\u0442 \u043a&nbsp;IO \u043e\u0448\u0438\u0431\u043a\u0430\u043c \u043f\u0440\u0438 \u0434\u043e\u0441\u0442\u0443\u043f\u0435 \u043a&nbsp;\u0431\u0430\u0437\u0435. \u0417\u0432\u0443\u0447\u0438\u0442 \u0441\u043a\u0432\u0435\u0440\u043d\u043e? \u041d\u0430&nbsp;\u0441\u0430\u043c\u043e\u043c \u0434\u0435\u043b\u0435 \u0442\u0430\u043a \u0438&nbsp;\u0435\u0441\u0442\u044c. \u041b\u043e\u0432\u0438\u0442\u044c \u0442\u0430\u043a\u0438\u0435 \u043e\u0448\u0438\u0431\u043a\u0438 \u043d\u0430&nbsp;\u043f\u0440\u043e\u0434\u0435 \u043e\u0447\u0435\u043d\u044c \u043d\u0435\u043f\u0440\u0438\u044f\u0442\u043d\u043e.<\/p>\n<p>\u0417\u0434\u0435\u0441\u044c \u043d\u0430\u043c \u043d\u0430&nbsp;\u043f\u043e\u043c\u043e\u0449\u044c \u0438&nbsp;\u043c\u043e\u0436\u0435\u0442 \u043f\u0440\u0438\u0439\u0442\u0438 Zookeeper, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043d\u0438\u0447\u0435\u0433\u043e \u043d\u0435&nbsp;\u043f\u0438\u0448\u0435\u0442 \u043d\u0430&nbsp;\u0434\u0438\u0441\u043a \u0438&nbsp;\u0445\u0440\u0430\u043d\u0438\u0442 \u0432\u0441\u0435 \u0434\u0430\u043d\u043d\u044b\u0435 \u0432&nbsp;\u043f\u0430\u043c\u044f\u0442\u0438. \u0422\u0430\u043a\u043e\u0439 \u0432\u0430\u0440\u0438\u0430\u043d\u0442 \u043e\u043f\u0442\u0438\u043c\u0430\u043b\u0435\u043d \u0432&nbsp;\u0441\u0438\u0442\u0443\u0430\u0446\u0438\u0438, \u043a\u043e\u0433\u0434\u0430 \u043d\u0435&nbsp;\u043d\u0430&nbsp;\u0432\u0441\u0435\u0445 \u0441\u0435\u0440\u0432\u0435\u0440\u0430\u0445 \u0435\u0441\u0442\u044c SSD, \u0437\u0430\u0442\u043e RAM \u0445\u0432\u0430\u0442\u0430\u0435\u0442.<\/p>\n<h4>\u041f\u043e\u0447\u0435\u043c\u0443 Docker Swarm?<\/h4>\n<p>\u0423&nbsp;\u043c\u0435\u043d\u044f \u043d\u0435&nbsp;\u0431\u044b\u043b\u043e \u0432\u044b\u0431\u043e\u0440\u0430, \u0442\u0430\u043a \u043a\u0430\u043a \u043e\u0434\u043d\u0438\u043c \u0438\u0437&nbsp;\u043a\u043b\u044e\u0447\u0435\u0432\u044b\u0445 \u0442\u0440\u0435\u0431\u043e\u0432\u0430\u043d\u0438\u0439 \u0431\u044b\u043b\u043e, \u0447\u0442\u043e\u0431\u044b \u043a\u043b\u0430\u0441\u0442\u0435\u0440 \u0431\u044b\u043b \u0440\u0430\u0437\u0432\u0435\u0440\u043d\u0443\u0442 \u0432&nbsp;Swarm\u2019\u0435. \u0422\u0430\u043a \u0447\u0442\u043e, \u0435\u0441\u043b\u0438 \u044d\u0442\u043e \u0438&nbsp;\u0432\u0430\u0448 \u043a\u0435\u0439\u0441 \u0442\u043e\u0436\u0435, \u0442\u043e&nbsp;\u0432\u044b&nbsp;\u0432&nbsp;\u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u043e\u043c \u043c\u0435\u0441\u0442\u0435! <\/p>\n<p>\u0414\u043b\u044f \u0442\u0435\u0445&nbsp;\u0436\u0435, \u043a\u0442\u043e \u043e\u0442\u043a\u0440\u044b\u043b \u043f\u043e\u0441\u0442 \u0441&nbsp;\u0436\u0435\u043b\u0430\u043d\u0438\u0435\u043c \u043f\u043e\u0442\u0435\u0441\u0442\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0442\u0435\u0445\u043d\u043e\u043b\u043e\u0433\u0438\u044e, \u0432\u044b\u0431\u043e\u0440 Docker Swarm\u2019\u0430 \u0442\u043e\u0436\u0435 \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u0432\u043f\u043e\u043b\u043d\u0435 \u043e\u0440\u0433\u0430\u043d\u0438\u0447\u043d\u044b\u043c. \u0425\u043e\u0442\u044f&nbsp;\u0431\u044b \u043f\u043e&nbsp;\u0442\u043e\u0439 \u043f\u0440\u0438\u0447\u0438\u043d\u0435, \u0447\u0442\u043e \u0432\u0430\u043c \u043d\u0435&nbsp;\u043f\u0440\u0438\u0434\u0435\u0442\u0441\u044f \u0443\u0441\u0442\u0430\u043d\u0430\u0432\u043b\u0438\u0432\u0430\u0442\u044c \u0438&nbsp;\u043d\u0430\u0441\u0442\u0440\u0430\u0438\u0432\u0430\u0442\u044c \u043d\u0438\u043a\u0430\u043a\u0438\u0445 \u0441\u0442\u043e\u0440\u043e\u043d\u043d\u0438\u0445 \u0441\u0435\u0440\u0432\u0438\u0441\u043e\u0432 (\u043d\u0443&nbsp;\u0437\u0430&nbsp;\u0438\u0441\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435\u043c \u0441\u0430\u043c\u043e\u0433\u043e Docker\u2019\u0430, \u0440\u0430\u0437\u0443\u043c\u0435\u0435\u0442\u0441\u044f) \u0438\u043b\u0438 \u0442\u044f\u043d\u0443\u0442\u044c \u043d\u0430&nbsp;\u043b\u043e\u043a\u0430\u043b\u044c\u043d\u0443\u044e \u043c\u0430\u0448\u0438\u043d\u0443 \u0432\u043e\u0440\u043e\u0445 \u043d\u0435\u043f\u043e\u043d\u044f\u0442\u043d\u044b\u0445 \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u0435\u0439. \u041f\u043e\u043b\u0430\u0433\u0430\u044e, \u043d\u0435\u0434\u0430\u043b\u0435\u043a\u043e \u043e\u0442&nbsp;\u0438\u0441\u0442\u0438\u043d\u044b \u0443\u0442\u0432\u0435\u0440\u0436\u0434\u0435\u043d\u0438\u0435, \u0447\u0442\u043e Docker \u0443&nbsp;\u043d\u0430\u0441 \u0443&nbsp;\u0432\u0441\u0435\u0445 \u0438&nbsp;\u0442\u0430\u043a \u0443\u0436\u0435 \u043d\u0430\u0441\u0442\u0440\u043e\u0435\u043d \u0432\u0435\u0437\u0434\u0435 \u0433\u0434\u0435 \u0442\u043e\u043b\u044c\u043a\u043e \u043c\u043e\u0436\u043d\u043e, \u043c\u044b&nbsp;\u0432\u0441\u0435 \u0437\u043d\u0430\u0435\u043c, \u043a\u0430\u043a \u043e\u043d&nbsp;\u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442, \u0442\u0430\u043a \u0447\u0442\u043e \u043f\u043e\u0447\u0435\u043c\u0443&nbsp;\u0431\u044b \u043d\u0435&nbsp;\u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0435\u0433\u043e.<\/p>\n<p>\u041f\u043e\u0442\u0440\u0435\u0431\u0443\u0435\u0442\u0441\u044f \u043b\u0438\u0448\u044c \u043e\u0434\u043d\u0430 \u043a\u043e\u043c\u0430\u043d\u0434\u0430, \u0447\u0442\u043e\u0431\u044b \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u0442\u044e\u043d\u0438\u043d\u0433 Docker\u2019\u0430, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043f\u043e\u0437\u0432\u043e\u043b\u0438\u0442 \u0440\u0430\u0437\u0432\u0435\u0440\u043d\u0443\u0442\u044c \u043d\u0430&nbsp;\u043b\u043e\u043a\u0430\u043b\u044c\u043d\u043e\u0439 \u043c\u0430\u0448\u0438\u043d\u0435 \u043a\u043b\u0430\u0441\u0442\u0435\u0440 Patroni \u043d\u0430&nbsp;3&nbsp;\u043d\u043e\u0434\u044b \u0431\u0435\u0437 \u0432\u0438\u0440\u0442\u0443\u0430\u043b\u044c\u043d\u044b\u0445 \u043c\u0430\u0448\u0438\u043d, Kubernetes \u0438\u043b\u0438 \u043f\u043e\u0434\u043e\u0431\u043d\u044b\u0445 \u0432\u0435\u0449\u0435\u0439. <\/p>\n<p>\u0415\u0441\u043b\u0438 \u0432\u044b&nbsp;\u043d\u0435&nbsp;\u0445\u043e\u0442\u0438\u0442\u0435 \u043a\u043e\u043f\u0430\u0442\u044c \u0432&nbsp;\u0441\u0442\u043e\u0440\u043e\u043d\u0443 \u043a\u0430\u043a\u0438\u0445-\u0442\u043e \u0435\u0449\u0435 \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442\u043e\u0432 \u0437\u0430&nbsp;\u043f\u0440\u0435\u0434\u0435\u043b\u0430\u043c\u0438 Docker\u2019\u0430 \u0438&nbsp;\u0445\u043e\u0442\u0438\u0442\u0435 \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u0432\u0441\u0435 \u0447\u0438\u0441\u0442\u043e \u0438&nbsp;\u0430\u043a\u043a\u0443\u0440\u0430\u0442\u043d\u043e, \u0442\u043e&nbsp;\u0434\u0430\u043d\u043d\u044b\u0439 \u0442\u0443\u0442\u043e\u0440\u0438\u0430\u043b \u0432\u0430\u043c \u0431\u043e\u043b\u0435\u0435 \u0447\u0435\u043c \u043f\u043e\u0434\u043e\u0439\u0434\u0435\u0442. <\/p>\n<h4>\u0410 \u0432 \u043a\u043e\u043d\u0446\u0435 \u0431\u0443\u0434\u0435\u0442 \u043d\u0435\u0431\u043e\u043b\u044c\u0448\u043e\u0439 \u0431\u043e\u043d\u0443\u0441 <\/h4>\n<p>\u0412\u043e&nbsp;\u0432\u0442\u043e\u0440\u043e\u0439 \u0447\u0430\u0441\u0442\u0438 \u0442\u0443\u0442\u043e\u0440\u0438\u0430\u043b\u0430 \u044f&nbsp;\u043f\u043e\u043a\u0430\u0436\u0443 \u0440\u0430\u0437\u043b\u0438\u0447\u043d\u044b\u0435 \u0432\u0430\u0440\u0438\u0430\u043d\u0442\u044b \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0438 \u0441\u0442\u0430\u0442\u0443\u0441\u0430 \u043a\u043b\u0430\u0441\u0442\u0435\u0440\u0430 (\u0446\u0435\u043b\u044b\u0445&nbsp;3), \u0438&nbsp;\u0432&nbsp;\u043a\u043e\u043d\u0446\u0435 \u0434\u0430\u043c \u043f\u0440\u043e\u0441\u0442\u043e\u0439 \u0441\u043a\u0440\u0438\u043f\u0442 \u0441&nbsp;\u0438\u043d\u0441\u0442\u0440\u0443\u043a\u0446\u0438\u044f\u043c\u0438 \u0434\u043b\u044f \u0431\u044b\u0441\u0442\u0440\u043e\u0433\u043e \u0442\u0435\u0441\u0442\u0430 \u043a\u043b\u0430\u0441\u0442\u0435\u0440\u0430.<\/p>\n<p>\u041e\u043a\u0435\u0439, \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u0440\u0430\u0437\u0433\u043e\u0432\u043e\u0440\u043e\u0432. \u0414\u0430\u0432\u0430\u0439\u0442\u0435 \u043f\u0435\u0440\u0435\u0439\u0434\u0435\u043c \u043a&nbsp;\u043f\u0440\u0430\u043a\u0442\u0438\u043a\u0435.<\/p>\n<\/div>\n<\/details>\n<h2>Docker Swarm<\/h2>\n<p>\u0414\u043b\u044f \u0431\u044b\u0441\u0442\u0440\u043e\u0433\u043e \u0438&nbsp;\u043f\u0440\u0438\u0431\u043b\u0438\u0436\u0435\u043d\u043d\u043e\u0433\u043e \u043a&nbsp;\u0440\u0435\u0430\u043b\u044c\u043d\u043e\u0441\u0442\u0438 \u0442\u0435\u0441\u0442\u0430, \u043d\u0430\u043c, \u043d\u0430&nbsp;\u0441\u0430\u043c\u043e\u043c \u0434\u0435\u043b\u0435, \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u043e\u0434\u043d\u043e\u0439 \u043d\u043e\u0434\u044b \u0432&nbsp;Swarm \u043a\u043b\u0430\u0441\u0442\u0435\u0440\u0435. \u041f\u043e\u0441\u043a\u043e\u043b\u044c\u043a\u0443 \u043c\u044b&nbsp;\u043c\u043e\u0436\u0435\u043c \u043e\u0447\u0435\u043d\u044c \u043b\u0435\u0433\u043a\u043e \u043f\u043e\u0434\u043d\u0438\u043c\u0430\u0442\u044c \u0438&nbsp;\u0440\u043e\u043d\u044f\u0442\u044c \u0441\u0435\u0440\u0432\u0438\u0441\u044b, \u0437\u0430\u043f\u0443\u0449\u0435\u043d\u043d\u044b\u0435 \u0432&nbsp;Swarm\u2019\u0435, \u043c\u044b&nbsp;\u0441\u043c\u043e\u0436\u0435\u043c \u0438\u043c\u0438\u0442\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u043f\u0430\u0434\u0435\u043d\u0438\u0435 \u0441\u0435\u0440\u0432\u0435\u0440\u0430 \u0441&nbsp;\u043d\u043e\u0434\u043e\u0439, \u0438\u043c\u0435\u044f \u0432&nbsp;\u0440\u0430\u0441\u043f\u043e\u0440\u044f\u0436\u0435\u043d\u0438\u0438 \u0442\u043e\u043b\u044c\u043a\u043e \u043e\u0434\u043d\u0443 \u043b\u043e\u043a\u0430\u043b\u044c\u043d\u0443\u044e \u043c\u0430\u0448\u0438\u043d\u0443. <\/p>\n<p>\u042f&nbsp;\u0438\u0441\u0445\u043e\u0436\u0443 \u0438\u0437&nbsp;\u043f\u0440\u0435\u0434\u043f\u043e\u043b\u043e\u0436\u0435\u043d\u0438\u044f, \u0447\u0442\u043e \u0443&nbsp;\u0432\u0430\u0441 \u0443\u0436\u0435 \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043b\u0435\u043d \u0438&nbsp;\u043d\u0430\u0441\u0442\u0440\u043e\u0435\u043d Docker Engine. \u0412&nbsp;\u0442\u0430\u043a\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435, \u043d\u0443\u0436\u043d\u043e \u0442\u043e\u043b\u044c\u043a\u043e \u0432\u044b\u043f\u043e\u043b\u043d\u0438\u0442\u044c \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0443\u044e \u043a\u043e\u043c\u0430\u043d\u0434\u0443:<\/p>\n<pre><code>docker swarm init \/\/now check your single-node cluster docker node ls ID                            HOSTNAME       STATUS       AVAILABILITY           a9ej2flnv11ka1hencoc1mer2 *   floitet        Ready          Active       <\/code><\/pre>\n<p>\u041e\u0434\u043d\u0430 \u0438\u0437&nbsp;\u0432\u0430\u0436\u043d\u044b\u0445 \u0444\u0438\u0447 Swarm\u2019\u0430 \u0437\u0430\u043a\u043b\u044e\u0447\u0430\u0435\u0442\u0441\u044f \u0432&nbsp;\u0442\u043e\u043c, \u0447\u0442\u043e \u0442\u0435\u043f\u0435\u0440\u044c \u043c\u044b&nbsp;\u043c\u043e\u0436\u0435\u043c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u043d\u0435&nbsp;\u0442\u043e\u043b\u044c\u043a\u043e \u043e\u0431\u044b\u0447\u043d\u044b\u0435 Docker \u043a\u043e\u043d\u0442\u0435\u0439\u043d\u0435\u0440\u044b, \u043d\u043e&nbsp;\u0438&nbsp;\u0442\u0430\u043a \u043d\u0430\u0437\u044b\u0432\u0430\u0435\u043c\u044b\u0435 \u0441\u0435\u0440\u0432\u0438\u0441\u044b. \u0421\u0435\u0440\u0432\u0438\u0441\u044b&nbsp;\u2014 \u044d\u0442\u043e \u043f\u043e&nbsp;\u0441\u0443\u0442\u0438 \u0434\u0435\u043b\u0430 \u0430\u0431\u0441\u0442\u0440\u0430\u043a\u0446\u0438\u044f \u043d\u0430\u0434 \u043a\u043e\u043d\u0442\u0435\u0439\u043d\u0435\u0440\u0430\u043c\u0438. \u0415\u0441\u043b\u0438 \u043e\u0442\u0442\u0430\u043b\u043a\u0438\u0432\u0430\u0442\u044c\u0441\u044f \u043e\u0442&nbsp;\u0430\u043d\u0430\u043b\u043e\u0433\u0438\u0438 \u0441&nbsp;\u041e\u041e\u041f, \u0442\u043e&nbsp;\u0441\u0435\u0440\u0432\u0438\u0441&nbsp;\u2014 \u044d\u0442\u043e \u043a\u043b\u0430\u0441\u0441, \u0430&nbsp;\u043a\u043e\u043d\u0442\u0435\u0439\u043d\u0435\u0440 \u043a\u043e\u043d\u043a\u0440\u0435\u0442\u043d\u044b\u0439 \u043e\u0431\u044a\u0435\u043a\u0442 \u043a\u043b\u0430\u0441\u0441\u0430. \u041f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u044b \u0438&nbsp;\u043f\u0440\u0430\u0432\u0438\u043b\u0430 \u0441\u0435\u0440\u0432\u0438\u0441\u0430 \u0437\u0430\u0434\u0430\u044e\u0442\u0441\u044f \u043f\u0440\u0438 \u0434\u0435\u043f\u043b\u043e\u0435 \u0438\u0437&nbsp;yml-\u0444\u0430\u0439\u043b\u0430.<\/p>\n<p>\u0420\u0435\u043a\u043e\u043c\u0435\u043d\u0434\u0443\u044e \u0437\u0430\u043f\u043e\u043c\u043d\u0438\u0442\u044c hostname \u043d\u043e\u0434\u044b&nbsp;\u2014 \u043f\u043e\u0442\u043e\u043c \u043c\u044b&nbsp;\u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c \u0435\u0433\u043e \u0434\u043b\u044f \u0443\u043a\u0430\u0437\u0430\u043d\u0438\u044f \u2018constraint\u2019 \u0432&nbsp;\u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u043e\u043d\u043d\u043e\u043c \u0444\u0430\u0439\u043b\u0435. <\/p>\n<p>\u0412&nbsp;\u0446\u0435\u043b\u043e\u043c, \u044d\u0442\u043e \u0432\u0441\u0435 \u043f\u0440\u0438\u0433\u043e\u0442\u043e\u0432\u043b\u0435\u043d\u0438\u044f \u0432&nbsp;\u0447\u0430\u0441\u0442\u0438 Docker Swarm\u2019\u0430, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043d\u0443\u0436\u043d\u043e \u0441\u0434\u0435\u043b\u0430\u0442\u044c. \u0417\u0434\u0435\u0441\u044c \u043d\u0438\u043a\u0430\u043a\u0438\u0445 \u043f\u0440\u043e\u0431\u043b\u0435\u043c \u0431\u044b\u0442\u044c \u043d\u0435&nbsp;\u0434\u043e\u043b\u0436\u043d\u043e. \u0422\u0430\u043a \u0447\u0442\u043e \u0434\u0432\u0438\u043d\u0435\u043c\u0441\u044f \u0434\u0430\u043b\u044c\u0448\u0435.<\/p>\n<h2> Zookeeper<\/h2>\n<p>\u041f\u0440\u0435\u0436\u0434\u0435 \u0447\u0435\u043c \u043c\u044b&nbsp;\u043d\u0430\u0447\u043d\u0435\u043c \u0434\u0435\u043f\u043b\u043e\u0439 \u0441\u0430\u043c\u043e\u0433\u043e Patroni, \u043d\u0430\u043c \u043d\u0443\u0436\u043d\u043e \u0441\u043d\u0430\u0447\u0430\u043b\u0430 \u0440\u0430\u0437\u0432\u0435\u0440\u043d\u0443\u0442\u044c \u043a\u043b\u0430\u0441\u0442\u0435\u0440 \u0441&nbsp;DCS (\u0432&nbsp;\u043d\u0430\u0448\u0435\u043c \u0441\u043b\u0443\u0447\u0430\u0435, \u043a\u0430\u043a \u043c\u044b&nbsp;\u043f\u043e\u043c\u043d\u0438\u043c, \u044d\u0442\u043e Zookeeper). \u042f&nbsp;\u0432\u0437\u044f\u043b \u0432\u0435\u0440\u0441\u0438\u044e 3.4, \u0438&nbsp;\u043e\u043d\u0430 \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u0432\u043f\u043e\u043b\u043d\u0435 \u0441\u0442\u0430\u0431\u0438\u043b\u044c\u043d\u043e. \u0414\u0430\u043b\u0435\u0435 \u0438\u0434\u0435\u0442 docker-compose \u043a\u043e\u043d\u0444\u0438\u0433 \u0438&nbsp;\u043d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043a\u043e\u043c\u043c\u0435\u043d\u0442\u0430\u0440\u0438\u0438 \u043f\u043e&nbsp;\u043c\u043e\u043c\u0435\u043d\u0442\u0430\u043c, \u043a\u043e\u0442\u043e\u0440\u044b\u0435, \u043a\u0430\u043a \u043c\u043d\u0435 \u043a\u0430\u0436\u0435\u0442\u0441\u044f, \u0438\u043c\u0435\u0435\u0442 \u0441\u043c\u044b\u0441\u043b \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u043e \u0443\u043f\u043e\u043c\u044f\u043d\u0443\u0442\u044c.<\/p>\n<ul>\n<li>\n<p><strong>docker-compose-zookeeper.yml<\/strong><\/p>\n<\/li>\n<\/ul>\n<details class=\"spoiler\">\n<summary>docker-compose-zookeeper.yml<\/summary>\n<div class=\"spoiler__content\">\n<pre><code>version: '3.7'  services:   zoo1:     image: zookeeper:3.4     hostname: zoo1     ports:       - 2191:2181     networks:       - patroni     environment:       ZOO_MY_ID: 1       ZOO_SERVERS: server.1=0.0.0.0:2888:3888 server.2=zoo2:2888:3888 server.3=zoo3:2888:3888     deploy:       replicas: 1       placement:         constraints:           - node.hostname == floitet       restart_policy:         condition: any    zoo2:     image: zookeeper:3.4     hostname: zoo2     networks:       - patroni     ports:       - 2192:2181     environment:       ZOO_MY_ID: 2       ZOO_SERVERS: server.1=zoo1:2888:3888 server.2=0.0.0.0:2888:3888 server.3=zoo3:2888:3888     deploy:       replicas: 1       placement:         constraints:           - node.hostname == floitet       restart_policy:         condition: any    zoo3:     image: zookeeper:3.4     hostname: zoo3     networks:       - patroni     ports:       - 2193:2181     environment:       ZOO_MY_ID: 3       ZOO_SERVERS: server.1=zoo1:2888:3888 server.2=zoo2:2888:3888 server.3=0.0.0.0:2888:3888     deploy:       replicas: 1       placement:         constraints:           - node.hostname == floitet       restart_policy:         condition: any  networks:   patroni:     driver: overlay     attachable: true <\/code><\/pre>\n<\/p>\n<\/div>\n<\/details>\n<details class=\"spoiler\">\n<summary>Details<\/summary>\n<div class=\"spoiler__content\">\n<p>\u041a\u043e\u043d\u0435\u0447\u043d\u043e&nbsp;\u0436\u0435, \u0432\u0430\u0436\u043d\u043e \u0434\u0430\u0442\u044c \u043a\u0430\u0436\u0434\u043e\u0439 \u043d\u043e\u0434\u0435 \u0443\u043d\u0438\u043a\u0430\u043b\u044c\u043d\u043e\u0435 \u0438\u043c\u044f \u0438&nbsp;\u0432\u043d\u0435\u0448\u043d\u0438\u0439 \u043f\u043e\u0440\u0442. Hostname \u043b\u0443\u0447\u0448\u0435 \u0441\u0442\u0430\u0432\u0438\u0442\u044c \u043e\u0434\u0438\u043d\u0430\u043a\u043e\u0432\u043e\u0435 \u0441&nbsp;\u0438\u043c\u0435\u043d\u0435\u043c \u0441\u0435\u0440\u0432\u0438\u0441\u0430. <\/p>\n<pre><code>zoo1:     image: zookeeper:3.4     hostname: zoo1     ports:       - 2191:2181 <\/code><\/pre>\n<p>\u0421\u0442\u043e\u0438\u0442 \u043e\u0442\u043c\u0435\u0442\u0438\u0442\u044c \u0438&nbsp;\u0442\u043e, \u043a\u0430\u043a \u043c\u044b&nbsp;\u043f\u0435\u0440\u0435\u0447\u0438\u0441\u043b\u044f\u0435\u043c host\u2019\u044b \u0432&nbsp;\u0441\u0442\u0440\u043e\u043a\u0435 \u043d\u0438\u0436\u0435: \u0434\u043b\u044f \u043f\u0435\u0440\u0432\u043e\u0433\u043e \u0441\u0435\u0440\u0432\u0438\u0441\u0430 server.1 \u0431\u0443\u0434\u0435\u0442 \u043f\u0440\u0438\u0432\u044f\u0437\u0430\u043d \u043a&nbsp;0.0.0.0, \u0430, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0434\u043b\u044f zoo2 \u044d\u0442\u043e \u0443\u0436\u0435 \u0431\u0443\u0434\u0435\u0442 server.2 \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0435\u043d\u043d\u043e \u0438&nbsp;\u0442.\u0434.<\/p>\n<pre><code>ZOO_SERVERS: server.1=0.0.0.0:2888:3888 server.2=zoo2:2888:3888 server.3=zoo3:2888:3888<\/code><\/pre>\n<p>\u0410&nbsp;\u0442\u0430\u043a\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c \u043c\u044b&nbsp;\u043a\u043e\u043d\u0442\u0440\u043e\u043b\u0438\u0440\u0443\u0435\u043c \u0440\u0430\u0441\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u0435 \u0441\u0435\u0440\u0432\u0438\u0441\u043e\u0432 \u043f\u043e&nbsp;\u043d\u043e\u0434\u0430\u043c. \u041f\u043e\u0441\u043a\u043e\u043b\u044c\u043a\u0443 \u043d\u043e\u0434\u0430 \u0443&nbsp;\u043d\u0430\u0441 \u0441\u0435\u0439\u0447\u0430\u0441 \u0442\u043e\u043b\u044c\u043a\u043e \u043e\u0434\u043d\u0430, \u043c\u044b&nbsp;\u0441\u043f\u043e\u043a\u043e\u0439\u043d\u043e \u043c\u043e\u0433\u043b\u0438&nbsp;\u0431\u044b \u0443\u0431\u0440\u0430\u0442\u044c \u044d\u0442\u0438 \u0441\u0442\u0440\u043e\u0447\u043a\u0438 \u0438\u0437&nbsp;\u043a\u043e\u043d\u0444\u0438\u0433\u0430, \u043d\u043e&nbsp;\u043a\u043e\u0433\u0434\u0430 \u0441\u0435\u0440\u0432\u0435\u0440\u043e\u0432 \u0431\u0443\u0434\u0435\u0442 \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e, \u043c\u043e\u0436\u043d\u043e \u0431\u0443\u0434\u0435\u0442 \u043c\u0435\u043d\u044f\u0442\u044c node.hostname \u0438&nbsp;\u0442\u0435\u043c \u0441\u0430\u043c\u044b\u043c \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u0442\u044c \u043d\u0430&nbsp;\u043a\u0430\u043a\u0443\u044e \u043d\u043e\u0434\u0443 \u043f\u043e\u0439\u0434\u0435\u0442 \u0441\u0435\u0440\u0432\u0438\u0441.<\/p>\n<pre><code>     placement:         constraints:           - node.hostname == floitet <\/code><\/pre>\n<p>\u0418&nbsp;\u043f\u043e\u0441\u043b\u0435\u0434\u043d\u0438\u0439 \u043c\u043e\u043c\u0435\u043d\u0442, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043c\u044b&nbsp;\u0437\u0434\u0435\u0441\u044c \u043e\u0431\u0441\u0443\u0434\u0438\u043c, \u044d\u0442\u043e network. \u042f&nbsp;\u043d\u0430\u043c\u0435\u0440\u0435\u043d \u0434\u0435\u043f\u043b\u043e\u0438\u0442\u044c \u0432\u0441\u0435 \u0441\u0435\u0440\u0432\u0438\u0441\u044b Zookeeper\u2019\u0430 \u0438&nbsp;\u0432\u0441\u0435 \u0441\u0435\u0440\u0432\u0438\u0441\u044b Patroni \u0432&nbsp;\u043e\u0434\u043d\u0443 \u0441\u0435\u0442\u044c \u0441&nbsp;\u0434\u0440\u0430\u0439\u0432\u0435\u0440\u043e\u043c overlay, \u0447\u0442\u043e\u0431\u044b \u043e\u043d\u0438 \u0431\u044b\u043b\u0438 \u0438\u0437\u043e\u043b\u0438\u0440\u043e\u0432\u0430\u043d\u044b \u043e\u0442&nbsp;\u0434\u0440\u0443\u0433\u0438\u0445 \u0441\u0435\u0440\u0432\u0438\u0441\u043e\u0432 \u0438&nbsp;\u043c\u043e\u0433\u043b\u0438 \u043e\u0431\u0449\u0430\u0442\u044c\u0441\u044f \u043c\u0435\u0436\u0434\u0443 \u0441\u043e\u0431\u043e\u0439 \u043f\u043e&nbsp;\u0438\u043c\u0435\u043d\u0430\u043c, \u0430&nbsp;\u043d\u0435&nbsp;\u043f\u043e&nbsp;IP (\u043a\u0430\u043a \u044d\u0442\u043e \u0432\u044b\u0433\u043b\u044f\u0434\u0438\u0442, \u0431\u0443\u0434\u0435\u0442 \u0432\u0438\u0434\u043d\u043e \u0434\u0430\u043b\u044c\u0448\u0435). <\/p>\n<pre><code>networks:   patroni:     driver: overlay \/\/ \u043c\u044b \u0434\u043e\u043b\u0436\u043d\u044b \u043e\u0442\u043c\u0435\u0442\u0438\u0442\u044c \u0441\u0435\u0442\u044c \u043a\u0430\u043a attachable   \/\/ \u0447\u0442\u043e\u0431\u044b \u043f\u043e\u0442\u043e\u043c \u043c\u043e\u0436\u043d\u043e \u0431\u044b\u043b\u043e \u043f\u0440\u0438\u0441\u043e\u0435\u0434\u0438\u043d\u044f\u0442\u044c \u043a \u043d\u0435\u0439 \u043e\u0441\u0442\u0430\u043b\u044c\u043d\u044b\u0435 \u0441\u0435\u0440\u0432\u0438\u0441\u044b     attachable: true <\/code><\/pre>\n<\/p>\n<\/div>\n<\/details>\n<p>\u0418\u0442\u0430\u043a, \u043c\u043e\u0436\u043d\u043e \u0437\u0430\u0434\u0435\u043f\u043b\u043e\u0438\u0442\u044c Zookeeper:<\/p>\n<pre><code>sudo docker stack deploy --compose-file docker-compose-zookeeper.yml patroni<\/code><\/pre>\n<p>\u0422\u0435\u043f\u0435\u0440\u044c \u043d\u0443\u0436\u043d\u043e \u043f\u0440\u043e\u0432\u0435\u0440\u0438\u0442\u044c, \u0447\u0442\u043e \u0432\u0441\u0435 \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442. \u041f\u0435\u0440\u0432\u043e\u0435 \u0447\u0442\u043e \u043c\u043e\u0436\u043d\u043e \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u044d\u0442\u043e \u043f\u0440\u043e\u0441\u0442\u043e \u043f\u043e\u0441\u043c\u043e\u0442\u0440\u0435\u0442\u044c \u0441\u043f\u0438\u0441\u043e\u043a \u0441\u0435\u0440\u0432\u0438\u0441\u043e\u0432:<\/p>\n<pre><code>sudo docker service ls gxfj9rs3po7z        patroni_zoo1        replicated          1\/1                 zookeeper:3.4         *:2191-&gt;2181\/tcp ibp0mevmiflw        patroni_zoo2        replicated          1\/1                 zookeeper:3.4         *:2192-&gt;2181\/tcp srucfm8jrt57        patroni_zoo3        replicated          1\/1                 zookeeper:3.4         *:2193-&gt;2181\/tcp <\/code><\/pre>\n<p>\u0418&nbsp;\u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u043c \u0448\u0430\u0433\u043e\u043c \u043c\u043e\u0436\u043d\u043e \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u043f\u0438\u043d\u0433 \u0441\u0435\u0440\u0432\u0438\u0441\u043e\u0432 \u0441&nbsp;\u043f\u043e\u043c\u043e\u0449\u044c\u044e \u0441\u043f\u0435\u0446\u0438\u0430\u043b\u044c\u043d\u043e\u0439 \u043a\u043e\u043c\u0430\u043d\u0434\u044b mntr:<\/p>\n<pre><code>echo mntr | nc localhost 2191 \/\/ with the output being smth like this zk_version\t3.4.14-4c25d480e66aadd371de8bd2fd8da255ac140bcf, built on 03\/06\/2019 16:18 GMT zk_avg_latency\t6 zk_max_latency\t205 zk_min_latency\t0 zk_packets_received\t1745 zk_packets_sent\t1755 zk_num_alive_connections\t3 zk_outstanding_requests\t0 zk_server_state\tfollower zk_znode_count\t16 zk_watch_count\t9 zk_ephemerals_count\t4 zk_approximate_data_size\t1370 zk_open_file_descriptor_count\t34 zk_max_file_descriptor_count\t1048576 zk_fsync_threshold_exceed_count\t0 <\/code><\/pre>\n<p>\u0422\u0430\u043a\u0436\u0435 \u043c\u043e\u0436\u043d\u043e \u043f\u0440\u043e\u0432\u0435\u0440\u0438\u0442\u044c \u043b\u043e\u0433\u0438 \u0441\u0435\u0440\u0432\u0438\u0441\u0430, \u0435\u0441\u043b\u0438 \u0435\u0441\u0442\u044c \u0436\u0435\u043b\u0430\u043d\u0438\u0435: <\/p>\n<pre><code>docker service logs $zookeeper-service-id  \/\/ service-id comes from 'docker service ls' command.  \/\/ in my case it could be  docker service logs gxfj9rs3po7z<\/code><\/pre>\n<p>\u041e\u0442\u043b\u0438\u0447\u043d\u043e, \u0432\u043e\u0442 \u043c\u044b&nbsp;\u0438&nbsp;\u0440\u0430\u0437\u043e\u0431\u0440\u0430\u043b\u0438\u0441\u044c \u0441&nbsp;Zookeeper\u2019\u043e\u043c. \u0422\u0435\u043f\u0435\u0440\u044c \u043c\u043e\u0436\u043d\u043e \u043f\u0435\u0440\u0435\u0445\u043e\u0434\u0438\u0442\u044c \u043a&nbsp;\u0441\u0430\u043c\u043e\u043c\u0443 Patroni.<\/p>\n<h2>Patroni<\/h2>\n<p>\u041c\u044b&nbsp;\u043d\u0430\u043a\u043e\u043d\u0435\u0446 \u0434\u043e\u0431\u0440\u0430\u043b\u0438\u0441\u044c \u0434\u043e&nbsp;\u043e\u0441\u043d\u043e\u0432\u043d\u043e\u0439 \u0447\u0430\u0441\u0442\u0438 \u0442\u0443\u0442\u043e\u0440\u0438\u0430\u043b\u0430, \u0433\u0434\u0435 \u043d\u0430\u043c \u043f\u0440\u0435\u0434\u0441\u0442\u043e\u0438\u0442 \u043f\u043e\u0434\u043d\u0438\u043c\u0430\u0442\u044c \u043a\u043b\u0430\u0441\u0442\u0435\u0440 Patroni. \u041f\u0435\u0440\u0432\u043e\u0435 \u0447\u0442\u043e \u043d\u0443\u0436\u043d\u043e \u0441\u0434\u0435\u043b\u0430\u0442\u044c&nbsp;\u2014 \u044d\u0442\u043e \u0431\u0438\u043b\u0434 \u043a\u0430\u0441\u0442\u043e\u043c\u043d\u043e\u0433\u043e \u0438\u043c\u0435\u0439\u0434\u0436\u0430 Patroni, \u0447\u0442\u043e\u0431\u044b \u043d\u0430\u043c \u0431\u044b\u043b\u043e \u0447\u0442\u043e \u0434\u0435\u043f\u043b\u043e\u0438\u0442\u044c. \u041c\u044b&nbsp;\u0432\u043a\u043b\u044e\u0447\u0438\u043c \u0432&nbsp;\u0441\u0431\u043e\u0440\u043a\u0443 \u0442\u043e\u043b\u044c\u043a\u043e \u0441\u0430\u043c\u044b\u0435 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u044b\u0435 \u0432\u0435\u0449\u0438, \u0438&nbsp;\u044f&nbsp;\u043f\u043e\u0441\u0442\u0430\u0440\u0430\u044e\u0441\u044c \u043e\u0431\u044a\u044f\u0441\u043d\u0438\u0442\u044c \u0432\u0441\u0435 \u0448\u0430\u0433\u0438 \u043a\u0430\u043a \u043c\u043e\u0436\u043d\u043e \u0431\u043e\u043b\u0435\u0435 \u043f\u043e\u0434\u0440\u043e\u0431\u043d\u043e, \u0447\u0442\u043e\u0431\u044b \u0432&nbsp;\u0434\u0430\u043b\u044c\u043d\u0435\u0439\u0448\u0435\u043c \u0432\u0430\u043c \u043b\u0435\u0433\u043a\u043e \u0431\u044b\u043b\u043e \u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c \u0441&nbsp;\u044d\u0442\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c \u0438&nbsp;\u0430\u043f\u0433\u0440\u0435\u0439\u0434\u0438\u0442\u044c \u0435\u0433\u043e \u043f\u043e&nbsp;\u0441\u0432\u043e\u0435\u043c\u0443 \u0436\u0435\u043b\u0430\u043d\u0438\u044e. <\/p>\n<p>\u0421\u043d\u0430\u0447\u0430\u043b\u0430 \u0441\u043e\u0437\u0434\u0430\u0434\u0438\u043c \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u0443\u044e \u0434\u0438\u0440\u0435\u043a\u0442\u043e\u0440\u0438\u044e \u2019patroni-test\u2019 \u0438&nbsp;\u043f\u0435\u0440\u0435\u0439\u0434\u0435\u043c \u0432&nbsp;\u043d\u0435\u0451. \u0414\u043b\u044f \u0442\u043e\u0433\u043e \u0447\u0442\u043e\u0431\u044b \u0443\u0441\u043f\u0435\u0448\u043d\u043e \u0441\u0431\u0438\u043b\u0434\u0438\u0442\u044c \u0440\u0430\u0431\u043e\u0447\u0438\u0439 \u0438\u043c\u0435\u0439\u0434\u0436 \u043d\u0430\u043c \u043f\u043e\u043d\u0430\u0434\u043e\u0431\u0438\u0442\u0441\u044f \u043f\u0430\u0440\u0430 \u0434\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u0445 \u0444\u0430\u0439\u043b\u043e\u0432, \u0441&nbsp;\u043d\u0438\u0445 \u0438&nbsp;\u043d\u0430\u0447\u043d\u0435\u043c.<\/p>\n<ul>\n<li>\n<p><strong>patroni.yml<\/strong><\/p>\n<\/li>\n<\/ul>\n<p>\u042d\u0442\u043e \u043e\u0441\u043d\u043e\u0432\u043d\u043e\u0439 \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u043e\u043d\u043d\u044b\u0439 \u0444\u0430\u0439\u043b. \u041e\u0434\u043d\u0430 \u0438\u0437&nbsp;\u043e\u0441\u043e\u0431\u0435\u043d\u043d\u043e\u0441\u0442\u0435\u0439 Patroni, \u0447\u0442\u043e \u043c\u044b&nbsp;\u043c\u043e\u0436\u0435\u043c \u0437\u0430\u0434\u0430\u0432\u0430\u0442\u044c \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u044b \u0434\u043b\u044f \u043a\u043b\u0430\u0441\u0442\u0435\u0440\u0430 \u0438\u0437&nbsp;\u0440\u0430\u0437\u043d\u044b\u0445 \u043c\u0435\u0441\u0442 \u0438&nbsp;patroni.yml&nbsp;\u2014 \u043e\u0434\u043d\u043e \u0438\u0437&nbsp;\u043d\u0438\u0445. \u042d\u0442\u043e\u0442 \u0444\u0430\u0439\u043b \u043c\u044b&nbsp;\u0431\u0443\u0434\u0435\u043c \u043a\u043e\u043f\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0432&nbsp;\u043a\u0430\u0441\u0442\u043e\u043c\u043d\u044b\u0439 \u0438\u043c\u0435\u0439\u0434\u0436, \u0442\u0430\u043a \u0447\u0442\u043e \u043b\u044e\u0431\u044b\u0435 \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u044f, \u0432\u043d\u0435\u0441\u0435\u043d\u043d\u044b\u0435 \u0432&nbsp;\u043d\u0435\u0433\u043e, \u0442\u0440\u0435\u0431\u0443\u044e\u0442 \u0440\u0435\u0431\u0438\u043b\u0434\u0430 \u043e\u0431\u0440\u0430\u0437\u0430. <\/p>\n<p>\u042f&nbsp;\u0432&nbsp;\u0438\u0442\u043e\u0433\u0435 \u043f\u0440\u0438\u0448\u0435\u043b \u043a&nbsp;\u0438\u0434\u0435\u0435, \u0447\u0442\u043e \u0431\u0443\u0434\u0443 \u0445\u0440\u0430\u043d\u0438\u0442\u044c \u0437\u0434\u0435\u0441\u044c \u0442\u043e\u043b\u044c\u043a\u043e \u0442\u0435&nbsp;\u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u044b, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043d\u0430\u0432\u0435\u0440\u043d\u044f\u043a\u0430 \u043f\u043e\u0447\u0442\u0438 \u043d\u0438\u043a\u043e\u0433\u0434\u0430 \u043d\u0435&nbsp;\u0431\u0443\u0434\u0443 \u0442\u0440\u043e\u0433\u0430\u0442\u044c, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u0441\u043a\u043b\u0430\u0434\u044b\u0432\u0430\u044e \u0437\u0434\u0435\u0441\u044c \u0442\u043e\u043b\u044c\u043a\u043e \u0441\u0430\u043c\u044b\u0435 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u044b\u0435 \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0438. \u041d\u0438\u0436\u0435 \u044f&nbsp;\u043f\u0440\u0438\u0432\u043e\u0436\u0443 \u0431\u0430\u0437\u043e\u0432\u044b\u0439 \u043a\u043e\u043d\u0444\u0438\u0433. \u0415\u0441\u043b\u0438 \u0437\u0430\u0445\u043e\u0447\u0435\u0442\u0441\u044f, \u0442\u043e&nbsp;\u043c\u043e\u0436\u043d\u043e \u0434\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u0432&nbsp;\u043d\u0435\u0433\u043e \u043a\u0430\u043a\u0438\u0445-\u0442\u043e \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u043e\u0432, \u0434\u043e\u043f\u0443\u0441\u0442\u0438\u043c, \u0434\u043b\u044f \u0434\u0432\u0438\u0436\u043a\u0430 Posgtres\u2019\u0430 (\u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, max_connections \u0438&nbsp;\u0442.\u043f.). \u041d\u043e&nbsp;\u0434\u043b\u044f \u0442\u0435\u0441\u0442\u043e\u0432\u043e\u0433\u043e \u0441\u0442\u0435\u043d\u0434\u0430 \u044d\u0442\u043e\u0433\u043e \u0432\u043f\u043e\u043b\u043d\u0435 \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e.<\/p>\n<details class=\"spoiler\">\n<summary>patroni.yml<\/summary>\n<div class=\"spoiler__content\">\n<pre><code>scope: patroni namespace: \/service\/  bootstrap:     dcs:         ttl: 30         loop_wait: 10         retry_timeout: 10         maximum_lag_on_failover: 1048576         postgresql:             use_pg_rewind: true      postgresql:       use_pg_rewind: true      initdb:     - encoding: UTF8     - data-checksums      pg_hba:     - host replication all all md5     - host all all all md5  zookeeper:   hosts:        - zoo1:2181       - zoo2:2181       - zoo3:2181  postgresql:     data_dir: \/data\/patroni     bin_dir: \/usr\/lib\/postgresql\/11\/bin     pgpass: \/tmp\/pgpass     parameters:         unix_socket_directories: '.'  tags:     nofailover: false     noloadbalance: false     clonefrom: false     nosync: false <\/code><\/pre>\n<\/p>\n<\/div>\n<\/details>\n<details class=\"spoiler\">\n<summary>Details<\/summary>\n<div class=\"spoiler__content\">\n<p>\u0412\u0430\u0436\u043d\u043e \u0443\u043a\u0430\u0437\u0430\u0442\u044c Patroni \u043f\u0443\u0442\u044c \u043a&nbsp;\u0431\u0438\u043d\u0430\u0440\u043d\u044b\u043c \u0444\u0430\u0439\u043b\u0430\u043c Postgres\u2019\u0430. \u0412&nbsp;\u043c\u043e\u0435\u043c \u0441\u043b\u0443\u0447\u0430\u0435, \u0442\u0430\u043a \u043a\u0430\u043a \u044f&nbsp;\u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044e Postgres&nbsp;11, \u0434\u0438\u0440\u0435\u043a\u0442\u043e\u0440\u0438\u044f \u0432\u044b\u0433\u043b\u044f\u0434\u0438\u0442 \u0442\u0430\u043a: \u2019\/usr\/lib\/postgresql\/11\/bin\u2019. <\/p>\n<p>\u0412&nbsp;\u0434\u0438\u0440\u0435\u043a\u0442\u043e\u0440\u0438\u0438, \u0432\u043d\u0443\u0442\u0440\u0438 \u0443\u0436\u0435 \u0441\u043e\u0437\u0434\u0430\u043d\u043d\u043e\u0433\u043e \u043a\u043e\u043d\u0442\u0435\u0439\u043d\u0435\u0440\u0430, Patroni \u0431\u0443\u0434\u0435\u0442 \u0438\u0441\u043a\u0430\u0442\u044c \u0444\u0430\u0439\u043b\u044b Postgres\u2019\u0430. \u0411\u0435\u0437 \u044d\u0442\u043e\u0439 \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0438 \u0441\u043a\u043e\u0440\u0435\u0435 \u0432\u0441\u0435\u0433\u043e \u043d\u0438\u0447\u0435\u0433\u043e \u043d\u0435&nbsp;\u0432\u0437\u043b\u0435\u0442\u0438\u0442 (\u043f\u043e&nbsp;\u043a\u0440\u0430\u0439\u043d\u0435\u0439 \u043c\u0435\u0440\u0435 \u0443&nbsp;\u043c\u0435\u043d\u044f \u043d\u0435&nbsp;\u0432\u0437\u043b\u0435\u0442\u0435\u043b\u043e). \u0418&nbsp;\u0442\u0430\u043a\u0436\u0435 \u0435\u0449\u0435 \u0435\u0441\u0442\u044c \u2019data_dir\u2019 \u2014 \u044d\u0442\u043e \u043c\u0435\u0441\u0442\u043e \u0432&nbsp;\u043a\u043e\u043d\u0442\u0435\u0439\u043d\u0435\u0440\u0435, \u0433\u0434\u0435 \u0431\u0443\u0434\u0443\u0442 \u0445\u0440\u0430\u043d\u0438\u0442\u044c\u0441\u044f \u0434\u0430\u043d\u043d\u044b\u0435. \u041f\u043e\u0437\u0436\u0435 \u043c\u044b&nbsp;\u0441\u0434\u0435\u043b\u0430\u0435\u043c mount \u044d\u0442\u043e\u0439 \u0434\u0438\u0440\u0435\u043a\u0442\u043e\u0440\u0438\u0438 \u043a&nbsp;\u043c\u0435\u0441\u0442\u0443 \u043d\u0430&nbsp;\u043b\u043e\u043a\u0430\u043b\u044c\u043d\u043e\u043c \u0436\u0435\u0441\u0442\u043a\u043e\u043c \u0434\u0438\u0441\u043a\u0435, \u0447\u0442\u043e\u0431\u044b \u043d\u0435&nbsp;\u043f\u043e\u0442\u0435\u0440\u044f\u0442\u044c \u0432\u0441\u0435 \u043f\u043e\u043b\u0438\u043c\u0435\u0440\u044b, \u0435\u0441\u043b\u0438 \u043a\u043b\u0430\u0441\u0442\u0435\u0440 \u0432\u0441\u0435&nbsp;\u0436\u0435 \u0443\u043f\u0430\u0434\u0435\u0442 \u0431\u0435\u0437\u043d\u0430\u0434\u0435\u0436\u043d\u043e. \u042d\u0442\u043e \u0434\u043e\u0431\u0430\u0432\u0438\u0442 \u043d\u0430\u043c \u0440\u0430\u0431\u043e\u0442\u044b \u043f\u043e&nbsp;\u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044e \u044d\u0442\u0438\u0445 \u043f\u0430\u043f\u043e\u043a \u043b\u043e\u043a\u0430\u043b\u044c\u043d\u043e, \u043d\u043e, \u043f\u043e-\u043c\u043e\u0435\u043c\u0443, \u043e\u043d\u043e \u0442\u043e\u0433\u043e \u0441\u0442\u043e\u0438\u0442.<\/p>\n<pre><code>postgresql:     data_dir: \/data\/patroni     bin_dir: \/usr\/lib\/postgresql\/11\/bin <\/code><\/pre>\n<p>\u0422\u0430\u043a\u0436\u0435 \u044f&nbsp;\u043f\u0435\u0440\u0435\u0447\u0438\u0441\u043b\u044f\u044e \u0432\u0441\u0435 \u0441\u0435\u0440\u0432\u0435\u0440\u0430 Zookeeper\u2019\u0430 \u0432&nbsp;\u044d\u0442\u043e\u043c \u043a\u043e\u043d\u0444\u0438\u0433 \u0444\u0430\u0439\u043b\u0435, \u0447\u0442\u043e\u0431\u044b \u043f\u043e\u0442\u043e\u043c \u043f\u0435\u0440\u0435\u0434\u0430\u0442\u044c \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u044e \u043e&nbsp;\u043d\u0438\u0445 \u0443\u0442\u0438\u043b\u0438\u0442\u0435 patronictl. \u0421\u0442\u043e\u0438\u0442 \u043e\u0442\u043c\u0435\u0442\u0438\u0442\u044c, \u0447\u0442\u043e \u0435\u0441\u043b\u0438 \u043d\u0435&nbsp;\u0443\u043a\u0430\u0437\u0430\u0442\u044c \u0438\u0445&nbsp;\u0432&nbsp;patroni.yml, \u0442\u043e&nbsp;\u043c\u044b&nbsp;\u043e\u0441\u0442\u0430\u043d\u0435\u043c\u0441\u044f \u0432&nbsp;\u0438\u0442\u043e\u0433\u0435 \u0441&nbsp;\u043d\u0435\u0440\u0430\u0431\u043e\u0447\u0438\u043c patronictl. \u041a\u0430\u043a \u0432\u044b&nbsp;\u0432\u0438\u0434\u0438\u0442\u0435, \u043f\u0435\u0440\u0435\u0447\u0438\u0441\u043b\u044f\u044f \u0441\u0435\u0440\u0432\u0435\u0440\u0430, \u044f&nbsp;\u043d\u0435&nbsp;\u043f\u0438\u0448\u0443 \u043d\u0438\u043a\u0430\u043a\u0438\u0435&nbsp;IP, \u0430&nbsp;\u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044e \u0438\u0445&nbsp;\u0438\u043c\u0435\u043d\u0430. \u042d\u0442\u043e \u0442\u0430&nbsp;\u0441\u0430\u043c\u0430\u044f \u0444\u0438\u0447\u0430 Docker Swarm\u2019\u0430 \u043e&nbsp;\u043a\u043e\u0442\u043e\u0440\u043e\u0439 \u044f&nbsp;\u0440\u0430\u0441\u0441\u043a\u0430\u0437\u044b\u0432\u0430\u043b \u0432\u044b\u0448\u0435. &nbsp;<\/p>\n<pre><code>zookeeper:   hosts:        - zoo1:2181       - zoo2:2181       - zoo3:2181 <\/code><\/pre>\n<\/p>\n<\/div>\n<\/details>\n<ul>\n<li>\n<p><strong>patroni-entrypoint.sh<\/strong><\/p>\n<\/li>\n<\/ul>\n<p>\u0418\u0437&nbsp;\u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u0433\u043e \u0444\u0430\u0439\u043b\u0430 \u043f\u043e\u0434\u0442\u044f\u0433\u0438\u0432\u0430\u0435\u0442\u0441\u044f \u0431\u043e\u043b\u044c\u0448\u0430\u044f \u0447\u0430\u0441\u0442\u044c \u043d\u0430\u0441\u0442\u0440\u043e\u0435\u043a \u0432&nbsp;\u043c\u043e\u0435\u0439 \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u0438. \u042d\u0442\u043e \u043d\u0435\u0431\u043e\u043b\u044c\u0448\u043e\u0439 \u0441\u043a\u0440\u0438\u043f\u0442, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0431\u0443\u0434\u0435\u0442 \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d, \u043a\u043e\u0433\u0434\u0430 \u043a\u043e\u043d\u0442\u0435\u0439\u043d\u0435\u0440 \u0441\u0435\u0440\u0432\u0438\u0441\u0430 \u043e\u043a\u0430\u0436\u0435\u0442\u0441\u044f \u0441\u043e\u0437\u0434\u0430\u043d.<\/p>\n<details class=\"spoiler\">\n<summary>patroni-entrypoint.sh<\/summary>\n<div class=\"spoiler__content\">\n<pre><code>#!\/bin\/sh  readonly CONTAINER_IP=$(hostname --ip-address) readonly CONTAINER_API_ADDR=\"${CONTAINER_IP}:${PATRONI_API_CONNECT_PORT}\" readonly CONTAINER_POSTGRE_ADDR=\"${CONTAINER_IP}:5432\"  export PATRONI_NAME=\"${PATRONI_NAME:-$(hostname)}\" export PATRONI_RESTAPI_CONNECT_ADDRESS=\"$CONTAINER_API_ADDR\" export PATRONI_RESTAPI_LISTEN=\"$CONTAINER_API_ADDR\" export PATRONI_POSTGRESQL_CONNECT_ADDRESS=\"$CONTAINER_POSTGRE_ADDR\" export PATRONI_POSTGRESQL_LISTEN=\"$CONTAINER_POSTGRE_ADDR\" export PATRONI_REPLICATION_USERNAME=\"$REPLICATION_NAME\" export PATRONI_REPLICATION_PASSWORD=\"$REPLICATION_PASS\" export PATRONI_SUPERUSER_USERNAME=\"$SU_NAME\" export PATRONI_SUPERUSER_PASSWORD=\"$SU_PASS\" export PATRONI_approle_PASSWORD=\"$POSTGRES_APP_ROLE_PASS\" export PATRONI_approle_OPTIONS=\"${PATRONI_admin_OPTIONS:-createdb, createrole}\"  exec \/usr\/local\/bin\/patroni \/etc\/patroni.yml <\/code><\/pre>\n<\/p>\n<\/div>\n<\/details>\n<details class=\"spoiler\">\n<summary>Details. \u0412\u0430\u0436\u043d\u043e!<\/summary>\n<div class=\"spoiler__content\">\n<p>\u041d\u0430&nbsp;\u0441\u0430\u043c\u043e\u043c \u0434\u0435\u043b\u0435, \u043e\u0441\u043d\u043e\u0432\u043d\u043e\u0439 \u0441\u043c\u044b\u0441\u043b \u0432\u043e\u043e\u0431\u0449\u0435 \u0434\u0435\u043b\u0430\u0442\u044c \u0442\u0430\u043a\u043e\u0439 \u0441\u043a\u0440\u0438\u043f\u0442 \u0437\u0430\u043a\u043b\u044e\u0447\u0430\u0435\u0442\u0441\u044f \u0432&nbsp;\u0442\u043e\u043c, \u0447\u0442\u043e \u043c\u044b&nbsp;\u043f\u0440\u043e\u0441\u0442\u043e \u043d\u0435&nbsp;\u0441\u043c\u043e\u0436\u0435\u043c \u0441\u0442\u0430\u0440\u0442\u0430\u043d\u0443\u0442\u044c \u0441\u0435\u0440\u0432\u0438\u0441 \u0441&nbsp;Patroni, \u043d\u0435&nbsp;\u0437\u043d\u0430\u044f&nbsp;IP \u0430\u0434\u0440\u0435\u0441 host\u2019\u0430. \u0418&nbsp;\u0432&nbsp;\u0442\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435, \u043a\u043e\u0433\u0434\u0430 host\u2019\u043e\u043c \u043e\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u0442\u0441\u044f Docker-\u043a\u043e\u043d\u0442\u0435\u0439\u043d\u0435\u0440, \u043d\u0430\u043c \u043a\u0430\u043a-\u0442\u043e \u043d\u0443\u0436\u043d\u043e \u0441\u043d\u0430\u0447\u0430\u043b\u0430 \u0443\u0437\u043d\u0430\u0442\u044c \u043a\u0430\u043a\u043e\u0439&nbsp;\u0436\u0435 IP&nbsp;\u044d\u0442\u043e\u0442 \u043a\u043e\u043d\u0442\u0435\u0439\u043d\u0435\u0440 \u043f\u043e\u043b\u0443\u0447\u0438\u043b, \u0438&nbsp;\u0442\u043e\u043b\u044c\u043a\u043e \u043f\u043e\u0442\u043e\u043c \u043c\u044b&nbsp;\u043c\u043e\u0436\u0435\u043c \u0437\u0430\u043f\u0443\u0441\u0442\u0438\u0442\u044c Patroni. \u042d\u0442\u0430 \u043f\u043e\u0442\u0440\u0435\u0431\u043d\u043e\u0441\u0442\u044c \u0437\u0430\u043a\u0440\u044b\u0432\u0430\u0435\u0442\u0441\u044f \u0432\u043e\u0442 \u0437\u0434\u0435\u0441\u044c:<\/p>\n<pre><code>readonly CONTAINER_IP=$(hostname --ip-address) readonly CONTAINER_API_ADDR=\"${CONTAINER_IP}:${PATRONI_API_CONNECT_PORT}\" readonly CONTAINER_POSTGRE_ADDR=\"${CONTAINER_IP}:5432\" ... export PATRONI_RESTAPI_CONNECT_ADDRESS=\"$CONTAINER_API_ADDR\" export PATRONI_RESTAPI_LISTEN=\"$CONTAINER_API_ADDR\" export PATRONI_POSTGRESQL_CONNECT_ADDRESS=\"$CONTAINER_POSTGRE_ADDR\" <\/code><\/pre>\n<p>\u041a\u0430\u043a \u044f&nbsp;\u0443\u0436\u0435 \u0433\u043e\u0432\u043e\u0440\u0438\u043b \u0440\u0430\u043d\u044c\u0448\u0435, \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u044b \u043a\u043e\u043d\u0444\u0438\u0433\u0430 Patroni \u043c\u043e\u0436\u043d\u043e \u043f\u0435\u0440\u0435\u0434\u0430\u0432\u0430\u0442\u044c \u0440\u0430\u0437\u043d\u044b\u043c\u0438 \u0441\u043f\u043e\u0441\u043e\u0431\u0430\u043c\u0438. \u0412&nbsp;\u044d\u0442\u043e\u043c \u0441\u043a\u0440\u0438\u043f\u0442\u0435 \u043c\u044b&nbsp;\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c\u0441\u044f \u0442\u0435\u043c, \u0447\u0442\u043e \u043e\u0434\u0438\u043d \u0438\u0437&nbsp;\u0442\u0430\u043a\u0438\u0445 \u0441\u043f\u043e\u0441\u043e\u0431\u043e\u0432&nbsp;\u2014 \u044d\u0442\u043e \u2019Environment configuration\u2019. \u2019PATRONI<em>RESTAPI<\/em>CONNECTADDRESS\u2019, \u2019PATRONI<em>RESTAPI<\/em>LISTEN\u2019, \u2019PATRONI<em>POSTGRESQLCONNECT<\/em>ADDRESS\u2019 \u2014 \u0441\u043f\u0435\u0446\u0438\u0430\u043b\u044c\u043d\u044b\u0435 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0435 \u0441\u0440\u0435\u0434\u044b, \u043e&nbsp;\u043a\u043e\u0442\u043e\u0440\u044b\u0445 Patroni \u0437\u043d\u0430\u0435\u0442 \u0437\u0430\u0440\u0430\u043d\u0435\u0435 \u0438&nbsp;\u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0431\u0443\u0434\u0443\u0442 \u0441\u0447\u0438\u0442\u0430\u043d\u044b. \u0418&nbsp;\u043a\u0441\u0442\u0430\u0442\u0438, \u043e\u043d\u0438 \u043f\u0435\u0440\u0435\u043f\u0438\u0441\u044b\u0432\u0430\u044e\u0442 \u043b\u043e\u043a\u0430\u043b\u044c\u043d\u044b\u0435 \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0438 \u0438\u0437&nbsp;patroni.yml, \u0442\u0430\u043a \u0447\u0442\u043e be&nbsp;aware! <\/p>\n<p>\u0418&nbsp;\u0435\u0449\u0435 \u043c\u043e\u043c\u0435\u043d\u0442. \u0414\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u044f Patroni \u043d\u0435&nbsp;\u0440\u0435\u043a\u043e\u043c\u0435\u043d\u0434\u0443\u0435\u0442 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c superuser\u2019\u0430 \u0434\u043b\u044f \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u044f \u043a&nbsp;\u0431\u0430\u0437\u0435 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0439. \u0422.\u0435. \u043d\u0443\u0436\u043d\u043e \u0441\u043e\u0437\u0434\u0430\u0442\u044c \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u043e\u0433\u043e \u044e\u0437\u0435\u0440\u0430, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043c\u044b&nbsp;\u0431\u0443\u0434\u0435\u043c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u043d\u0435\u043f\u043e\u0441\u0440\u0435\u0434\u0441\u0442\u0432\u0435\u043d\u043d\u043e \u0434\u043b\u044f \u043a\u043e\u043d\u043d\u0435\u043a\u0442\u0430, \u0430&nbsp;superuser\u2019\u0430 \u0438&nbsp;replicator\u2019\u0430 \u0442\u0440\u043e\u0433\u0430\u0442\u044c \u043d\u0435&nbsp;\u0431\u0443\u0434\u0435\u043c \u0441\u043e\u0432\u0441\u0435\u043c. \u0421\u043e\u0437\u0434\u0430\u0442\u044c \u0442\u0430\u043a\u043e\u0433\u043e \u044e\u0437\u0435\u0440\u0430 \u043c\u043e\u0436\u043d\u043e \u0442\u0430\u043a\u0436\u0435 \u0447\u0435\u0440\u0435\u0437 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u0443\u044e \u0441\u0440\u0435\u0434\u044b. \u0415\u0441\u043b\u0438 \u0445\u043e\u0442\u0438\u0442\u0435, \u0447\u0442\u043e\u0431\u044b \u044e\u0437\u0435\u0440 \u043d\u0430\u0437\u044b\u0432\u0430\u043b\u0441\u044f \u043a\u0430\u043a-\u0442\u043e \u0438\u043d\u0430\u0447\u0435 \u0447\u0435\u043c \u2018approle\u2019, \u043f\u0440\u043e\u0441\u0442\u043e \u0437\u0430\u043c\u0435\u043d\u0438\u0442\u0435 \u0432&nbsp;\u044d\u0442\u043e\u0439 \u0441\u0442\u0440\u043e\u043a\u0435 \u2018approle\u2019 \u043d\u0430&nbsp;\u0447\u0442\u043e-\u0442\u043e \u0434\u0440\u0443\u0433\u043e\u0435. <\/p>\n<pre><code>export PATRONI_approle_PASSWORD=\"$POSTGRES_APP_ROLE_PASS\" export PATRONI_approle_OPTIONS=\"${PATRONI_admin_OPTIONS:-createdb, createrole}\"<\/code><\/pre>\n<p>\u0418&nbsp;\u0432&nbsp;\u043f\u043e\u0441\u043b\u0435\u0434\u043d\u0435\u0439 \u0441\u0442\u0440\u043e\u0447\u043a\u0435, \u043a\u043e\u0433\u0434\u0430 \u0432\u0441\u0451 \u0443\u0436\u0435 \u0433\u043e\u0442\u043e\u0432\u043e \u043a&nbsp;\u0441\u0442\u0430\u0440\u0442\u0443, \u043c\u044b&nbsp;\u0434\u0435\u043b\u0430\u0435\u043c \u0437\u0430\u043f\u0443\u0441\u043a Patroni \u0441\u0435\u0440\u0432\u0438\u0441\u0430 \u0441&nbsp;\u0443\u043a\u0430\u0437\u0430\u043d\u0438\u0435\u043c \u043e\u0442\u043a\u0443\u0434\u0430 \u0431\u0440\u0430\u0442\u044c \u043e\u0441\u043d\u043e\u0432\u043d\u043e\u0439 \u043a\u043e\u043d\u0444\u0438\u0433 \u0444\u0430\u0439\u043b: <\/p>\n<pre><code>exec \/usr\/local\/bin\/patroni \/etc\/patroni.yml<\/code><\/pre>\n<\/p>\n<\/div>\n<\/details>\n<ul>\n<li>\n<p><strong>Dockerfile<\/strong><\/p>\n<\/li>\n<\/ul>\n<p>Dockerfile \u044f&nbsp;\u0440\u0435\u0448\u0438\u043b \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u043d\u0430\u0441\u0442\u043e\u043b\u044c\u043a\u043e \u043f\u0440\u043e\u0441\u0442\u044b\u043c, \u043d\u0430\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u044d\u0442\u043e \u0442\u043e\u043b\u044c\u043a\u043e \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e. \u041d\u043e&nbsp;\u044d\u0442\u043e\u0433\u043e \u0432\u043f\u043e\u043b\u043d\u0435 \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e, \u0447\u0442\u043e\u0431\u044b \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u0431\u0438\u043b\u0434 \u0440\u0430\u0431\u043e\u0447\u0435\u0433\u043e Docker-\u043e\u0431\u0440\u0430\u0437\u0430. \u0414\u0430\u0432\u0430\u0439\u0442\u0435 \u0433\u043b\u044f\u043d\u0435\u043c, \u0447\u0442\u043e \u0432&nbsp;\u043d\u0435\u043c \u0432\u0441\u0435-\u0442\u0430\u043a\u0438 \u043f\u0440\u043e\u0438\u0441\u0445\u043e\u0434\u0438\u0442.<\/p>\n<details class=\"spoiler\">\n<summary>Dockerfile<\/summary>\n<div class=\"spoiler__content\">\n<pre><code>FROM postgres:11   RUN apt-get update -y\\      &amp;&amp; apt-get install python3 python3-pip -y\\     &amp;&amp; pip3 install --upgrade setuptools\\     &amp;&amp; pip3 install psycopg2-binary \\     &amp;&amp; pip3 install patroni[zookeeper] \\     &amp;&amp; mkdir \/data\/patroni -p \\     &amp;&amp; chown postgres:postgres \/data\/patroni \\     &amp;&amp; chmod 700 \/data\/patroni   COPY patroni.yml \/etc\/patroni.yml COPY patroni-entrypoint.sh .\/entrypoint.sh USER postgres  ENTRYPOINT [\"bin\/sh\", \"\/entrypoint.sh\"] <\/code><\/pre>\n<\/p>\n<\/div>\n<\/details>\n<details class=\"spoiler\">\n<summary>Details<\/summary>\n<div class=\"spoiler__content\">\n<p>\u041e\u0434\u043d\u0430 \u0438\u0437&nbsp;\u0433\u043b\u0430\u0432\u043d\u044b\u0445 \u0434\u0435\u0442\u0430\u043b\u0435\u0439 \u0437\u0434\u0435\u0441\u044c \u044d\u0442\u043e \u0434\u0438\u0440\u0435\u043a\u0442\u043e\u0440\u0438\u044f, \u043a\u043e\u0442\u043e\u0440\u0443\u044e \u043c\u044b&nbsp;\u0443\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u043c \u0441\u043e\u0437\u0434\u0430\u0442\u044c \u0432\u043d\u0443\u0442\u0440\u0438 \u043a\u043e\u043d\u0442\u0435\u0439\u043d\u0435\u0440\u0430, \u0430&nbsp;\u0442\u0430\u043a\u0436\u0435 \u0435\u0435&nbsp;\u0432\u043b\u0430\u0434\u0435\u043b\u0435\u0446 \u0438&nbsp;\u0435\u0433\u043e \u043f\u0440\u0430\u0432\u0430. \u041f\u043e\u0437\u0436\u0435, \u043a\u043e\u0433\u0434\u0430 \u0431\u0443\u0434\u0435\u043c \u0434\u0435\u043f\u043b\u043e\u0438\u0442\u044c Patroni, \u043d\u0443\u0436\u043d\u043e \u0431\u0443\u0434\u0435\u0442 \u043f\u043e\u0434\u043e\u0431\u043d\u044b\u043c&nbsp;\u0436\u0435 \u043e\u0431\u0440\u0430\u0437\u043e\u043c \u0441\u043e\u0437\u0434\u0430\u0442\u044c \u043f\u0430\u043f\u043a\u0438 \u043d\u0430&nbsp;\u043b\u043e\u043a\u0430\u043b\u044c\u043d\u043e\u0439 \u043c\u0430\u0448\u0438\u043d\u0435, \u043a\u0443\u0434\u0430 \u043c\u044b&nbsp;\u0441\u043c\u043e\u0436\u0435\u043c \u0441\u0434\u0435\u043b\u0430\u0442\u044c mount \u044d\u0442\u043e\u0439 \u0434\u0438\u0440\u0435\u043a\u0442\u043e\u0440\u0438\u0438 \u0438\u0437&nbsp;\u043a\u043e\u043d\u0442\u0435\u0439\u043d\u0435\u0440\u0430.<\/p>\n<pre><code>\/\/ \u0432\u043b\u0430\u0434\u0435\u043b\u0435\u0446 \u0434\u043e\u043b\u0436\u0435\u043d \u0431\u044b\u0442\u044c 'postgres', \u0430 mode 700      mkdir \/data\/patroni -p \\     chown postgres:postgres \/data\/patroni \\     chmod 700 \/data\/patroni      ... \/\/ \u0443\u0441\u0442\u0430\u043d\u0430\u0432\u043b\u0438\u0432\u0430\u0435\u043c \u0432 \u043a\u0430\u0447-\u0432\u0435 \u0430\u043a\u0442\u0438\u0432\u043d\u043e\u0433\u043e \u044e\u0437\u0435\u0440\u0430 \u0432\u043d\u0443\u0442\u0440\u0438 \u043a\u043e\u043d\u0442\u0435\u0439\u043d\u0435\u0440\u0430  \/\/ \u044e\u0437\u0435\u0440\u0430 postgres          USER postgres <\/code><\/pre>\n<p>\u0424\u0430\u0439\u043b\u044b, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043c\u044b&nbsp;\u0441\u043e\u0437\u0434\u0430\u043b\u0438, \u0440\u0430\u043d\u0435\u0435 \u043a\u043e\u043f\u0438\u0440\u0443\u044e\u0442\u0441\u044f \u0432&nbsp;\u0438\u043c\u0435\u0439\u0434\u0436 \u0432&nbsp;\u044d\u0442\u0438\u0445 \u0441\u0442\u0440\u043e\u0447\u043a\u0430\u0445:<\/p>\n<pre><code>COPY patroni.yml \/etc\/patroni.yml COPY patroni-entrypoint.sh .\/entrypoint.sh<\/code><\/pre>\n<p>\u0418, \u043a\u0430\u043a \u044f&nbsp;\u0443\u0436\u0435 \u0443\u043f\u043e\u043c\u044f\u043d\u0443\u043b \u0440\u0430\u043d\u0435\u0435, \u043c\u044b&nbsp;\u0445\u043e\u0442\u0438\u043c \u0437\u0430\u043f\u0443\u0441\u0442\u0438\u0442\u044c \u044d\u0442\u043e\u0442 \u0441\u043a\u0440\u0438\u043f\u0442 \u0441\u0440\u0430\u0437\u0443 \u043f\u043e\u0441\u043b\u0435 \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f \u043a\u043e\u043d\u0442\u0435\u0439\u043d\u0435\u0440\u0430: <\/p>\n<pre><code>ENTRYPOINT [\"bin\/sh\", \"\/entrypoint.sh\"]<\/code><\/pre>\n<\/p>\n<\/div>\n<\/details>\n<p>\u0412\u043e\u0442, \u043f\u043e\u0436\u0430\u043b\u0443\u0439, \u0438&nbsp;\u0432\u0441\u044f \u043e\u0441\u043d\u043e\u0432\u043d\u0430\u044f \u043f\u043e\u0434\u0433\u043e\u0442\u043e\u0432\u043a\u0430. \u0422\u0435\u043f\u0435\u0440\u044c \u043c\u044b&nbsp;\u0433\u043e\u0442\u043e\u0432\u044b \u0441\u043e\u0437\u0434\u0430\u0442\u044c \u043d\u0430\u0448 \u043a\u0430\u0441\u0442\u043e\u043c\u043d\u044b\u0439 Patroni \u0438\u043c\u0435\u0439\u0434\u0436. <\/p>\n<pre><code>docker build -t patroni-test .<\/code><\/pre>\n<p>\u0421\u0430\u043c\u043e\u0435 \u0432\u0440\u0435\u043c\u044f \u043e\u0431\u0441\u0443\u0434\u0438\u0442\u044c \u043f\u043e\u0441\u043b\u0435\u0434\u043d\u0438\u0439 \u043f\u043e&nbsp;\u0441\u043f\u0438\u0441\u043a\u0443, \u043d\u043e&nbsp;\u043d\u0435&nbsp;\u043f\u043e&nbsp;\u0432\u0430\u0436\u043d\u043e\u0441\u0442\u0438 \u0444\u0430\u0439\u043b \u0434\u043b\u044f Patroni&nbsp;\u2014 compose yml. <\/p>\n<ul>\n<li>\n<p><strong>docker-compose-patroni.yml<\/strong><\/p>\n<\/li>\n<\/ul>\n<p>\u041f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u043e \u043d\u0430\u043f\u0438\u0441\u0430\u043d\u043d\u044b\u0439 compose \u0444\u0430\u0439\u043b&nbsp;\u2014 \u0432\u0430\u0436\u043d\u0430\u044f \u0447\u0430\u0441\u0442\u044c \u043e\u0431\u0449\u0435\u0439 \u043a\u0430\u0440\u0442\u0438\u043d\u044b. \u0420\u0430\u0437\u0431\u0435\u0440\u0435\u043c, \u0447\u0442\u043e \u043d\u0430\u043c \u043d\u0443\u0436\u043d\u043e \u0438\u043c\u0435\u0442\u044c \u0432\u0432\u0438\u0434\u0443, \u043d\u0430\u0441\u0442\u0440\u0430\u0438\u0432\u0430\u044f \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u044e. <\/p>\n<details class=\"spoiler\">\n<summary>docker-compose-patroni.yml<\/summary>\n<div class=\"spoiler__content\">\n<pre><code>version: \"3.4\"  networks:     patroni_patroni:          external: true services:     patroni1:         image: patroni-test         networks: [ patroni_patroni ]         ports:             - 5441:5432             - 8091:8091         hostname: patroni1         volumes:           - \/patroni1:\/data\/patroni         environment:             PATRONI_API_CONNECT_PORT: 8091             REPLICATION_NAME: replicator              REPLICATION_PASS: replpass             SU_NAME: postgres             SU_PASS: supass             POSTGRES_APP_ROLE_PASS: appass         deploy:           replicas: 1           placement:             constraints: [node.hostname == floitet]      patroni2:         image: patroni-test         networks: [ patroni_patroni ]         ports:             - 5442:5432             - 8092:8091         hostname: patroni2         volumes:           - \/patroni2:\/data\/patroni         environment:             PATRONI_API_CONNECT_PORT: 8091             REPLICATION_NAME: replicator              REPLICATION_PASS: replpass             SU_NAME: postgres             SU_PASS: supass             POSTGRES_APP_ROLE_PASS: appass         deploy:           replicas: 1           placement:             constraints: [node.hostname == floitet]       patroni3:         image: patroni-test         networks: [ patroni_patroni ]         ports:             - 5443:5432             - 8093:8091         hostname: patroni3         volumes:           - \/patroni3:\/data\/patroni         environment:             PATRONI_API_CONNECT_PORT: 8091             REPLICATION_NAME: replicator              REPLICATION_PASS: replpass             SU_NAME: postgres             SU_PASS: supass             POSTGRES_APP_ROLE_PASS: appass         deploy:           replicas: 1           placement:             constraints: [node.hostname == floitet] <\/code><\/pre>\n<\/p>\n<\/div>\n<\/details>\n<details class=\"spoiler\">\n<summary>Details<\/summary>\n<div class=\"spoiler__content\">\n<p>\u041f\u0435\u0440\u0432\u043e\u0435, \u043e&nbsp;\u0447\u0435\u043c \u0445\u043e\u0447\u0435\u0442\u0441\u044f \u0441\u043a\u0430\u0437\u0430\u0442\u044c, \u044d\u0442\u043e \u043c\u043e\u043c\u0435\u043d\u0442 \u0441&nbsp;external network, \u043e&nbsp;\u043a\u043e\u0442\u043e\u0440\u043e\u043c \u0433\u043e\u0432\u043e\u0440\u0438\u043b\u043e\u0441\u044c \u0440\u0430\u043d\u0435\u0435. \u041c\u044b&nbsp;\u0445\u043e\u0442\u0438\u043c \u0440\u0430\u0437\u043c\u0435\u0441\u0442\u0438\u0442\u044c Patroni \u0441\u0435\u0440\u0432\u0438\u0441\u044b \u0442\u0430\u043c&nbsp;\u0436\u0435, \u0433\u0434\u0435 \u043c\u044b&nbsp;\u0434\u0435\u0440\u0436\u0438\u043c \u0438&nbsp;\u0441\u0435\u0440\u0432\u0438\u0441\u044b Zookeeper. \u0422\u0430\u043a\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c \u043c\u044b&nbsp;\u0441\u043c\u043e\u0436\u0435\u043c \u043e\u0431\u0440\u0430\u0449\u0430\u0442\u044c\u0441\u044f \u043a&nbsp;\u0441\u0435\u0440\u0432\u0438\u0441\u0430\u043c \u043f\u043e&nbsp;\u0438\u043c\u0435\u043d\u0430\u043c, \u0438&nbsp;\u0432\u0441\u0435 \u0438\u043c\u0435\u043d\u0430: \u2019zoo1\u2032, \u2019zoo2\u2032, \u2019zoo3\u2032, \u2014 \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043c\u044b&nbsp;\u043f\u0435\u0440\u0435\u0447\u0438\u0441\u043b\u0438\u043b\u0438 \u0432&nbsp;patroni.yml, \u0437\u0430\u0434\u0430\u0432\u0430\u044f \u0441\u0435\u0440\u0432\u0435\u0440\u0430 Zookeeper\u2019\u0430, \u0431\u0443\u0434\u0443\u0442 \u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c, \u043a\u0430\u043a \u043d\u0430\u0434\u043e.<\/p>\n<pre><code>networks:     patroni_patroni:          external: true <\/code><\/pre>\n<p>\u041d\u0443\u0436\u043d\u043e \u043e\u0442\u043c\u0435\u0442\u0438\u0442\u044c, \u0447\u0442\u043e \u0443&nbsp;\u043d\u0430\u0441 \u0431\u0443\u0434\u0443\u0442 \u0434\u0432\u0430 end point\u2019\u0430: \u0441\u0430\u043c\u0430 \u0431\u0430\u0437\u0430 \u0434\u0430\u043d\u043d\u044b\u0445 \u0438&nbsp;API. \u0418&nbsp;\u0434\u043b\u044f \u0442\u043e\u0433\u043e \u0438&nbsp;\u0434\u043b\u044f \u0434\u0440\u0443\u0433\u043e\u0433\u043e \u0442\u0440\u0435\u0431\u0443\u0435\u0442\u0441\u044f \u043e\u0442\u043a\u0440\u044b\u0442\u044c \u043f\u043e\u0440\u0442\u044b:<\/p>\n<pre><code>ports:     - 5441:5432     - 8091:8091 ...  environment:     PATRONI_API_CONNECT_PORT: 8091  \/\/ \u0442\u0430\u043a\u0436\u0435 \u043d\u0443\u0436\u043d\u043e \u0443\u0431\u0435\u0434\u0438\u0442\u044c\u0441\u044f, \u0447\u0442\u043e \u0432 PATRONI_API_CONNECT_PORT \u043c\u044b \u043f\u0435\u0440\u0435\u0434\u0430\u0435\u043c \/\/ \u0442\u043e\u0442 \u0436\u0435 \u0441\u0430\u043c\u044b\u0439, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043c\u044b \u043e\u0442\u043a\u0440\u044b\u0432\u0430\u0435\u043c \u0434\u043b\u044f \u0441\u0435\u0440\u0432\u0438\u0441\u0430    <\/code><\/pre>\n<p>\u0422\u0430\u043a\u0436\u0435, \u043d\u0430\u043c, \u043a\u043e\u043d\u0435\u0447\u043d\u043e, \u043d\u0443\u0436\u043d\u043e \u043f\u0435\u0440\u0435\u0434\u0430\u0442\u044c \u0432\u0441\u0435 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0435 \u0441\u0440\u0435\u0434\u044b, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043c\u044b&nbsp;\u0437\u0430\u044f\u0432\u0438\u043b\u0438 \u0432&nbsp;entrypoint \u0441\u043a\u0440\u0438\u043f\u0442\u0435. \u041d\u043e&nbsp;\u0438&nbsp;\u044d\u0442\u043e \u0435\u0449\u0435 \u043d\u0435&nbsp;\u0432\u0441\u0451. \u0415\u0441\u0442\u044c \u0432\u043e\u043f\u0440\u043e\u0441 \u0441&nbsp;\u0434\u0438\u0440\u0435\u043a\u0442\u043e\u0440\u0438\u0435\u0439 \u0434\u043b\u044f mount\u2019\u0430, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043c\u044b&nbsp;\u0442\u043e\u0436\u0435 \u0437\u0434\u0435\u0441\u044c \u0440\u0435\u0448\u0430\u0435\u043c:<\/p>\n<pre><code>volumes:    - \/patroni3:\/data\/patroni <\/code><\/pre>\n<p>\u041a\u0430\u043a \u0432\u0438\u0434\u043d\u043e \u0438\u0437&nbsp;\u044d\u0442\u043e\u0439 \u0441\u0442\u0440\u043e\u043a\u0438, \u0442\u0443&nbsp;\u0434\u0438\u0440\u0435\u043a\u0442\u043e\u0440\u0438\u044e \u2019\/data\/patroni\u2019, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u0431\u044b\u043b\u0430 \u0441\u043e\u0437\u0434\u0430\u043d\u0430 \u0432&nbsp;Dockerfile, \u043c\u044b&nbsp;\u043c\u043e\u043d\u0442\u0438\u0440\u0443\u0435\u043c \u043a&nbsp;\u043b\u043e\u043a\u0430\u043b\u044c\u043d\u043e\u0439 \u0434\u0438\u0440\u0435\u043a\u0442\u043e\u0440\u0438\u0438. \u0422\u0430\u043a \u0432\u043e\u0442 \u044d\u0442\u0443 \u043b\u043e\u043a\u0430\u043b\u044c\u043d\u0443\u044e \u0434\u0438\u0440\u0435\u043a\u0442\u043e\u0440\u0438\u044e \u043d\u0430\u043c \u043d\u0443\u0436\u043d\u043e \u0441\u043e\u0437\u0434\u0430\u0442\u044c. \u0418&nbsp;\u043d\u0435&nbsp;\u0442\u043e\u043b\u044c\u043a\u043e \u0441\u043e\u0437\u0434\u0430\u0442\u044c, \u043d\u043e&nbsp;\u0438&nbsp;\u0432\u044b\u0441\u0442\u0430\u0432\u0438\u0442\u044c \u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u043e\u0433\u043e \u044e\u0437\u0435\u0440\u0430 \u0438&nbsp;\u0440\u0435\u0436\u0438\u043c \u0434\u043e\u0441\u0442\u0443\u043f\u0430, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440 \u0442\u0430\u043a: <\/p>\n<pre><code>sudo mkdir \/patroni3 sudo chown 999:999 \/patroni3 sudo chmod 700 \/patroni3  \/\/ 999 \u044d\u0442\u043e \u0434\u0435\u0444\u043e\u043b\u0442\u043d\u044b\u0439 uid \u0434\u043b\u044f \u044e\u0437\u0435\u0440\u0430 postgres   \/\/ \u044d\u0442\u0438 \u0448\u0430\u0433\u0438 \u043d\u0443\u0436\u043d\u043e \u043f\u043e\u0432\u0442\u043e\u0440\u0438\u0442\u044c \u0434\u043b\u044f \u043a\u0430\u0436\u0434\u043e\u0439 \u043d\u043e\u0434\u044b Patroni <\/code><\/pre>\n<\/p>\n<\/div>\n<\/details>\n<p>\u041c\u044b \u043d\u0430\u043a\u043e\u043d\u0435\u0446 \u0433\u043e\u0442\u043e\u0432\u044b \u0434\u0435\u043f\u043b\u043e\u0438\u0442\u044c Patroni \u043a\u043b\u0430\u0441\u0442\u0435\u0440:<\/p>\n<pre><code>sudo docker stack deploy --compose-file docker-compose-patroni.yml patroni<\/code><\/pre>\n<p>\u041f\u043e\u0441\u043b\u0435 \u0434\u0435\u043f\u043b\u043e\u044f \u0432&nbsp;\u043b\u043e\u0433\u0430\u0445 \u0441\u0435\u0440\u0432\u0438\u0441\u0430 \u043c\u044b&nbsp;\u0434\u043e\u043b\u0436\u043d\u044b \u0443\u0432\u0438\u0434\u0435\u0442\u044c \u0447\u0442\u043e-\u0442\u043e \u0432&nbsp;\u0442\u0430\u043a\u043e\u043c \u043a\u043b\u044e\u0447\u0435:<\/p>\n<pre><code>INFO: Lock owner: patroni3; I am patroni1 INFO: does not have lock INFO: no action.  i am a secondary and i am following a leader<\/code><\/pre>\n<p>\u0411\u044b\u043b\u043e&nbsp;\u0431\u044b \u043f\u0435\u0447\u0430\u043b\u044c\u043d\u043e, \u0435\u0441\u043b\u0438&nbsp;\u0431\u044b \u043c\u044b&nbsp;\u043c\u043e\u0433\u043b\u0438 \u043f\u0440\u043e\u0432\u0435\u0440\u0438\u0442\u044c \u0441\u0442\u0430\u0442\u0443\u0441 \u043a\u043b\u0430\u0441\u0442\u0435\u0440\u0430 \u0438&nbsp;\u043d\u043e\u0434\u044b \u0442\u043e\u043b\u044c\u043a\u043e \u0447\u0438\u0442\u0430\u044f \u043b\u043e\u0433\u0438. \u0422\u0430\u043a \u0447\u0442\u043e \u043f\u0440\u0435\u0434\u043b\u0430\u0433\u0430\u044e \u043a\u043e\u0441\u043d\u0443\u0442\u044c\u0441\u044f \u043d\u0435\u043c\u043d\u043e\u0433\u043e \u0441\u043f\u043e\u0441\u043e\u0431\u043e\u0432 \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0438 \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u044f \u043a\u043b\u0430\u0441\u0442\u0435\u0440\u0430 \u0438&nbsp;\u043d\u0430\u0447\u0430\u0442\u044c \u0441&nbsp;\u0441\u0430\u043c\u043e\u0433\u043e \u043f\u0440\u043e\u0441\u0442\u043e\u0433\u043e&nbsp;\u2014 patronictl. \u0414\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u043d\u0443\u0436\u043d\u043e \u0441\u043d\u0430\u0447\u0430\u043b\u0430 \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c id&nbsp;\u043b\u044e\u0431\u043e\u0433\u043e \u043a\u043e\u043d\u0442\u0435\u0439\u043d\u0435\u0440\u0430 Patroni:<\/p>\n<pre><code>sudo docker ps CONTAINER ID        IMAGE                 COMMAND                  CREATED             STATUS              PORTS                          NAMES a0090ce33a05        patroni-test:latest   \"bin\/sh \/entrypoint.\u2026\"   3 hours ago         Up 3 hours          5432\/tcp                       patroni_patroni1.1.tgjzpjyuip6ge8szz5lsf8kcq ...<\/code><\/pre>\n<p>\u0418&nbsp;\u043f\u043e\u0442\u043e\u043c \u0437\u0430\u0439\u0442\u0438 \u0432&nbsp;\u043a\u043e\u043d\u0442\u0435\u0439\u043d\u0435\u0440 \u0441&nbsp;\u043f\u043e\u043c\u043e\u0449\u044c\u044e exec \u043a\u043e\u043c\u0430\u043d\u0434\u044b: <\/p>\n<pre><code>sudo docker exec -ti a0090ce33a05 \/bin\/bash \/\/ \u043f\u0440\u0438 \u0432\u044b\u0437\u043e\u0432\u0435 \u043a\u043e\u043c\u0430\u043d\u0434\u044b \u043c\u044b \u0434\u043e\u043b\u0436\u043d\u044b \u043f\u0435\u0440\u0435\u0434\u0430\u0442\u044c \u0438\u043c\u044f \u043a\u043b\u0430\u0441\u0442\u0435\u0440\u0430 \/\/ \u044d\u0442\u043e \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440 'scope' \u0432 patroni.yml ('patroni' \u0432 \u043d\u0430\u0448\u0435\u043c \u0441\u043b\u0443\u0447\u0430\u0435) patronictl list patroni \/\/ \u0438 \u0442\u0443\u0442 \u043e\u0448\u0438\u0431\u043a\u0430... Error: 'Can not find suitable configuration of distributed configuration store\\nAvailable implementations: exhibitor, kubernetes, zookeeper' <\/code><\/pre>\n<p>\u041a\u043e\u043c\u0430\u043d\u0434\u0430 patronictl \u043f\u043e\u043b\u0430\u0433\u0430\u0435\u0442\u0441\u044f \u043d\u0430&nbsp;patroni.yml, \u0447\u0442\u043e\u0431\u044b \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u044e \u043e&nbsp;\u0441\u0435\u0440\u0432\u0435\u0440\u0430\u0445 Zookeeper\u2019\u0430. \u041e\u043d&nbsp;\u043d\u0435&nbsp;\u0437\u043d\u0430\u0435\u0442, \u0433\u0434\u0435 \u043c\u044b&nbsp;\u044d\u0442\u043e\u0442 \u0444\u0430\u0439\u043b \u043f\u043e\u043b\u043e\u0436\u0438\u043b\u0438. \u0422\u0430\u043a \u0447\u0442\u043e \u044f\u0432\u043d\u043e \u0443\u043a\u0430\u0436\u0435\u043c \u0435\u043c\u0443 \u043f\u0443\u0442\u044c: <\/p>\n<pre><code>patronictl -c \/etc\/patroni.yml list patroni \/\/ and here is the nice output with the current states + Cluster: patroni (6893104757524385823) --+----+-----------+ | Member   | Host      | Role    | State   | TL | Lag in MB | +----------+-----------+---------+---------+----+-----------+ | patroni1 | 10.0.1.93 | Replica | running |  8 |         0 | | patroni2 | 10.0.1.91 | Replica | running |  8 |         0 | | patroni3 | 10.0.1.92 | Leader  | running |  8 |           | +----------+-----------+---------+---------+----+-----------+ <\/code><\/pre>\n<h2>PostgreSQL Connection<\/h2>\n<p>\u0413\u043e\u0442\u043e\u0432\u043e! \u0422\u0435\u043f\u0435\u0440\u044c \u043c\u044b&nbsp;\u043c\u043e\u0436\u0435\u043c \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0430\u0442\u044c\u0441\u044f \u043a&nbsp;Postgres \u0438&nbsp;\u0447\u0442\u043e-\u0442\u043e \u0442\u0443\u0434\u0430 \u043f\u0438\u0441\u0430\u0442\u044c. \u041d\u043e&nbsp;\u0434\u0435\u043b\u0430\u0442\u044c \u044d\u0442\u043e \u043c\u044b&nbsp;\u0441\u043c\u043e\u0436\u0435\u043c \u0442\u043e\u043b\u044c\u043a\u043e \u0438\u0437&nbsp;\u043d\u0430\u0448\u0435\u0439 \u0441\u0435\u0442\u0438 \u00abpatroni_patroni\u00bb. \u0422\u0430\u043a \u0447\u0442\u043e \u0441\u043d\u0430\u0447\u0430\u043b\u0430 \u0441\u043e\u0437\u0434\u0430\u0435\u043c \u043a\u043e\u043d\u0442\u0435\u0439\u043d\u0435\u0440 \u0441&nbsp;\u043f\u043e\u0434\u0445\u043e\u0434\u044f\u0449\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c, \u0438&nbsp;\u043f\u043e\u0442\u043e\u043c \u0438\u0437&nbsp;\u043d\u0435\u0433\u043e \u0443\u0436\u0435 \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0435\u043c \u043a\u043e\u043c\u0430\u043d\u0434\u044b:<\/p>\n<pre><code>docker run --rm -ti --network=patroni_patroni postgres:11 \/bin\/bash \/\/ \u0434\u043e\u0441\u0442\u0443\u043f \u043a \u043a\u043e\u043d\u043a\u0440\u0435\u0442\u043d\u043e\u0439 \u043d\u043e\u0434\u0435 psql --host patroni3 --port 5432 -U approle -d postgres \/\/ \u0434\u043e\u0441\u0442\u0443\u043f \u043a \u043b\u0438\u0434\u0435\u0440\u0443 \u0447\u0435\u0440\u0435\u0437 haproxy \/\/ \u0442\u0430\u043a \u0447\u0442\u043e \u043d\u0443\u0436\u043d\u043e \u0443\u043a\u0430\u0437\u0430\u0442\u044c \u043a\u0430\u043a\u0443\u044e-\u043b\u0438\u0431\u043e \u0447\u0435\u0440\u0435\u0437 \u0444\u043b\u0430\u0433 '-d' <\/code><\/pre>\n<p>\u0412\u043e\u0442 \u043c\u044b&nbsp;\u0438&nbsp;\u043d\u0430\u0441\u0442\u0440\u043e\u0438\u043b\u0438 \u0441\u0430\u043c \u043a\u043b\u0430\u0441\u0442\u0435\u0440 Patroni. \u041d\u043e&nbsp;\u043d\u0430\u0448 \u0441\u0435\u0442\u0430\u043f \u0431\u044b\u043b&nbsp;\u0431\u044b \u043d\u0435\u043f\u043e\u043b\u043d\u044b\u043c, \u0435\u0441\u043b\u0438&nbsp;\u0431\u044b \u043c\u044b&nbsp;\u043d\u0430&nbsp;\u044d\u0442\u043e\u043c \u0438&nbsp;\u043e\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u043b\u0438\u0441\u044c. \u0415\u0441\u0442\u044c \u0435\u0449\u0451 \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0432\u0430\u0436\u043d\u044b\u0445 \u043c\u043e\u043c\u0435\u043d\u0442\u043e\u0432, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043c\u044b&nbsp;\u0434\u043e\u043b\u0436\u043d\u044b \u0437\u0430\u043a\u0440\u044b\u0442\u044c, \u043d\u043e&nbsp;\u043e\u0431&nbsp;\u044d\u0442\u043e\u043c \u0432\u043e&nbsp;\u0432\u0442\u043e\u0440\u043e\u0439 \u0447\u0430\u0441\u0442\u0438.<\/p>\n<p>\u0412\u0441\u0435 config \u0444\u0430\u0439\u043b\u044b \u0434\u043b\u044f \u043f\u0435\u0440\u0432\u043e\u0439 \u0447\u0430\u0441\u0442\u0438 \u043c\u043e\u0436\u043d\u043e \u0437\u0430\u0431\u0440\u0430\u0442\u044c <a href=\"https:\/\/gist.github.com\/PeterGriffitz\/5347fe26b9839f54e2eed1fe6626e0ef\">\u043e\u0442\u0441\u044e\u0434\u0430<\/a>.<\/p>\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\/company\/vsrobotics\/blog\/534828\/\"> https:\/\/habr.com\/ru\/company\/vsrobotics\/blog\/534828\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"\n<div class=\"post__text post__text_v2\" id=\"post-content-body\">\n<figure class=\"full-width\"><figcaption>\u041a\u0430\u0434\u0440 \u0438\u0437 \u0444\u0438\u043b\u044c\u043c\u0430 \u00ab\u0420\u0435\u043c\u0431\u043e IV\u00bb<\/figcaption><\/figure>\n<h2>\u0412\u0441\u0442\u0443\u043f\u043b\u0435\u043d\u0438\u0435<\/h2>\n<p>\u0415\u0441\u043b\u0438 \u0432\u044b&nbsp;\u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442\u0435 \u0441&nbsp;crucial data, \u0442\u043e&nbsp;\u0440\u0430\u043d\u043e \u0438\u043b\u0438 \u043f\u043e\u0437\u0434\u043d\u043e \u0437\u0430\u0434\u0443\u043c\u0430\u0435\u0442\u0435\u0441\u044c \u043e&nbsp;\u0442\u043e\u043c, \u0447\u0442\u043e \u043d\u0435\u043f\u043b\u043e\u0445\u043e&nbsp;\u0431\u044b \u043f\u043e\u0434\u043d\u044f\u0442\u044c \u043a\u043b\u0430\u0441\u0442\u0435\u0440 \u043e\u0442\u043a\u0430\u0437\u043e\u0443\u0441\u0442\u043e\u0439\u0447\u0438\u0432\u043e\u0441\u0442\u0438. \u0414\u0430\u0436\u0435 \u0435\u0441\u043b\u0438 \u043e\u0441\u043d\u043e\u0432\u043d\u043e\u0439 \u0441\u0435\u0440\u0432\u0435\u0440 \u0441&nbsp;\u0431\u0430\u0437\u043e\u0439 \u0443\u043b\u0435\u0442\u0438\u0442 \u0432&nbsp;\u0433\u043b\u0443\u0445\u043e\u0439 \u043d\u043e\u043a\u0430\u0443\u0442, show must go&nbsp;on, \u043d\u0435&nbsp;\u0442\u0430\u043a&nbsp;\u043b\u0438? \u041f\u0440\u0438 \u044d\u0442\u043e\u043c \u043c\u044b&nbsp;\u043f\u043e\u0434\u0440\u0430\u0437\u0443\u043c\u0435\u0432\u0430\u0435\u043c \u0434\u0432\u0435 \u0432\u0435\u0449\u0438:<\/p>\n<ul>\n<li>\n<p>\u0431\u0430\u0437\u0430 \u0434\u0430\u043d\u043d\u044b\u0445 \u0441\u043e&nbsp;\u0432\u0441\u0435\u0439 \u0435\u0435&nbsp;\u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u043e\u0439 \u043d\u0430\u043c \u043f\u043e-\u043f\u0440\u0435\u0436\u043d\u0435\u043c\u0443 \u0434\u043e\u0441\u0442\u0443\u043f\u043d\u0430; &nbsp;<\/p>\n<\/li>\n<\/ul>\n<ul>\n<li>\n<p>\u0432\u0441\u0435 \u0434\u0430\u043d\u043d\u044b\u0435 \u043d\u0430\u0445\u043e\u0434\u044f\u0442\u0441\u044f \u0432&nbsp;\u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u0438 \u043c\u0430\u043a\u0441\u0438\u043c\u0430\u043b\u044c\u043d\u043e \u0431\u043b\u0438\u0437\u043a\u043e\u043c \u043a&nbsp;\u0442\u043e\u043c\u0443, \u043a\u043e\u0442\u043e\u0440\u043e\u0435 \u0431\u044b\u043b\u043e \u043d\u0430&nbsp;\u0433\u0435\u0440\u043e\u0438\u0447\u0435\u0441\u043a\u0438 \u043f\u0430\u0432\u0448\u0435\u043c \u043b\u0438\u0434\u0435\u0440\u0435.<\/p>\n<\/li>\n<\/ul>\n<p>Patroni \u043b\u0438\u0448\u044c \u043e\u0434\u043d\u043e \u0438\u0437&nbsp;\u0440\u0435\u0448\u0435\u043d\u0438\u0439 \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u044b. \u0414\u043e&nbsp;\u043d\u0435\u0433\u043e \u044f&nbsp;\u043f\u043e\u043f\u0440\u043e\u0431\u043e\u0432\u0430\u043b \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0434\u0440\u0443\u0433\u0438\u0445 \u0441\u0435\u0440\u0432\u0438\u0441\u043e\u0432 \u0438&nbsp;\u043d\u0430&nbsp;Github \u043e\u0434\u043d\u043e\u0433\u043e \u0438\u0437&nbsp;\u043d\u0438\u0445 (\u043d\u0435&nbsp;\u0431\u0443\u0434\u0443 \u043f\u043e\u043a\u0430\u0437\u044b\u0432\u0430\u0442\u044c \u043a\u0443\u0440\u0441\u043e\u0440\u043e\u043c) \u0434\u043e&nbsp;\u0441\u0438\u0445 \u043f\u043e\u0440 \u0432\u0438\u0441\u0438\u0442 \u0431\u0435\u0437 \u043e\u0442\u0432\u0435\u0442\u0430 \u043e\u0442\u043a\u0440\u044b\u0442\u044b\u0439 \u043c\u043d\u043e\u0439 \u0431\u0430\u0433 \u0440\u0435\u043f\u043e\u0440\u0442, \u0445\u043e\u0442\u044f \u043f\u0440\u043e\u0448\u043b\u043e \u0443\u0436\u0435 \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u043c\u0435\u0441\u044f\u0446\u0435\u0432. \u0423&nbsp;\u0434\u0440\u0443\u0433\u043e\u0433\u043e \u0431\u044b\u043b\u0430 \u043d\u0435&nbsp;\u0441\u0430\u043c\u0430\u044f \u043f\u043e\u043b\u043d\u0430\u044f \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u044f. \u041a\u0430\u043a\u0438\u0435-\u0442\u043e \u043c\u043d\u0435 \u043f\u043e\u043a\u0430\u0437\u0430\u043b\u0438\u0441\u044c \u043d\u0435\u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u043d\u0430\u0434\u0435\u0436\u043d\u044b\u043c\u0438.<\/p>\n<p>\u041f\u043e&nbsp;Patroni&nbsp;\u0436\u0435 \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u043c\u043d\u043e\u0433\u043e \u0438\u043d\u0444\u044b, \u0438&nbsp;\u043e\u043d&nbsp;\u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435\u043d\u043d\u043e \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u0435\u0442\u0441\u044f \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u0430\u043c\u0438. \u0422\u0430\u043a\u0436\u0435 \u043e\u043d&nbsp;\u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442 DCS \u0434\u043b\u044f \u0441\u0438\u043d\u0445\u0440\u043e\u043d\u0438\u0437\u0430\u0446\u0438\u0438 \u043d\u043e\u0434, \u0447\u0442\u043e \u0434\u043e\u043b\u0436\u043d\u043e \u043f\u0440\u0435\u0434\u043e\u0442\u0432\u0440\u0430\u0449\u0430\u0442\u044c \u0441\u0438\u0442\u0443\u0430\u0446\u0438\u0438 \u0441\u043e&nbsp;\u00absplit brain\u00bb.<\/p>\n<p>\u0418\u0437&nbsp;\u043c\u0438\u043d\u0443\u0441\u043e\u0432 \u0441\u043e\u0432\u0435\u0440\u0448\u0435\u043d\u043d\u043e \u0442\u043e\u0447\u043d\u043e \u043d\u0443\u0436\u043d\u043e \u043d\u0430\u0437\u0432\u0430\u0442\u044c&nbsp;\u0442\u043e, \u0447\u0442\u043e \u044d\u0442\u043e \u043d\u0435&nbsp;\u00about of&nbsp;the box solution. \u041a\u0430\u043a \u0441\u043a\u0430\u0437\u0430\u043d\u043e \u0432&nbsp;\u0434\u043e\u043a\u0435:&nbsp; <\/p>\n<blockquote>\n<p>\u201cPatroni is a template for you to create your own customized, high-availability solution using Python&#8230;\u201d<\/p>\n<\/p>\n<\/blockquote>\n<p>\u0418&nbsp;\u043a\u043b\u044e\u0447\u0435\u0432\u043e\u0435 \u0437\u0434\u0435\u0441\u044c \u0441\u043b\u043e\u0432\u043e \u00abtemplate\u00bb. \u0422\u043e&nbsp;\u0435\u0441\u0442\u044c \u0432\u0441\u0435 \u043f\u0440\u0438\u0434\u0435\u0442\u0441\u044f \u0441\u043e\u0431\u0438\u0440\u0430\u0442\u044c \u0441\u0430\u043c\u043e\u043c\u0443. \u041d\u043e&nbsp;\u0432&nbsp;\u043a\u0430\u043a\u043e\u043c-\u0442\u043e \u0441\u043c\u044b\u0441\u043b\u0435 \u044d\u0442\u043e \u043f\u043b\u044e\u0441&nbsp;\u2014 \u043f\u043e&nbsp;\u043a\u0440\u0430\u0439\u043d\u0435\u0439 \u043c\u0435\u0440\u0435, \u043c\u044b&nbsp;\u0434\u0435\u0442\u0430\u043b\u044c\u043d\u043e \u0431\u0443\u0434\u0435\u043c \u0437\u043d\u0430\u0442\u044c, \u0447\u0442\u043e \u0438\u043c\u0435\u043d\u043d\u043e \u0438\u0434\u0451\u0442 \u0432&nbsp;\u043f\u0440\u043e\u0434. <\/p>\n<p>\u041f\u043e&nbsp;\u0441\u043f\u0435\u0446\u0438\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438, \u043a\u0441\u0442\u0430\u0442\u0438, \u044f&nbsp;\u043d\u0435&nbsp;DevOps \u0438\u043d\u0436\u0435\u043d\u0435\u0440. \u041a\u043e\u0433\u0434\u0430 \u043f\u043e\u044f\u0432\u0438\u043b\u0430\u0441\u044c \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e\u0441\u0442\u044c \u043f\u043e\u0434\u043d\u044f\u0442\u044c \u043e\u0442\u043a\u0430\u0437\u043e\u0443\u0441\u0442\u043e\u0439\u0447\u0438\u0432\u044b\u0439 \u043a\u043b\u0430\u0441\u0442\u0435\u0440 \u043c\u043d\u0435 \u043f\u0440\u0438\u0448\u043b\u043e\u0441\u044c \u0441\u043e\u0431\u0440\u0430\u0442\u044c \u0432\u0441\u0435 \u044f\u043c\u044b \u0438&nbsp;\u0441\u0442\u043e\u043b\u0431\u044b \u043a\u0430\u043a\u0438\u0435 \u0442\u043e\u043b\u044c\u043a\u043e \u0431\u044b\u043b\u0438 \u043d\u0430&nbsp;\u044d\u0442\u043e\u043c \u043f\u0443\u0442\u0438. \u041d\u0430\u0434\u0435\u044e\u0441\u044c, \u044d\u0442\u043e\u0442 \u0442\u0443\u0442\u043e\u0440\u0438\u0430\u043b \u043f\u043e\u043c\u043e\u0436\u0435\u0442 \u0432\u0430\u043c \u0434\u043e\u0441\u0442\u0438\u0447\u044c \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u0430, \u0438\u0441\u043f\u044b\u0442\u0430\u0432 \u0432&nbsp;\u0440\u0430\u0437\u044b \u043c\u0435\u043d\u044c\u0448\u0435 \u0441\u0442\u0440\u0430\u0434\u0430\u043d\u0438\u0439 \u0438&nbsp;\u0431\u043e\u043b\u0438, \u0447\u0435\u043c \u0434\u043e\u0432\u0435\u043b\u043e\u0441\u044c \u043c\u043d\u0435. &nbsp;<\/p>\n<p>\u0415\u0441\u043b\u0438 \u0432\u044b&nbsp;\u0443\u0441\u0442\u0430\u043b\u0438 \u0443\u0436\u0435 \u043e\u0442&nbsp;\u0432\u0441\u0442\u0443\u043f\u043b\u0435\u043d\u0438\u0439 \u0438&nbsp;\u0440\u0432\u0435\u0442\u0435\u0441\u044c \u0432&nbsp;\u0431\u043e\u0439, \u0441\u043c\u0435\u043b\u043e \u043f\u0435\u0440\u0435\u0445\u043e\u0434\u0438\u0442\u0435 \u043a&nbsp;\u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u0439 \u0433\u043b\u0430\u0432\u0435.<\/p>\n<p>\u0415\u0441\u043b\u0438 \u043d\u0435\u0442, \u0442\u043e&nbsp;\u043f\u0440\u0435\u0434\u043b\u0430\u0433\u0430\u044e \u043f\u043e\u0434 \u0441\u043f\u043e\u0439\u043b\u0435\u0440\u043e\u043c \u043f\u0440\u043e\u0447\u0435\u0441\u0442\u044c \u043a\u043e\u0440\u043e\u0442\u043a\u0438\u0435 \u0437\u0430\u043c\u0435\u0442\u043a\u0438 \u043f\u043e&nbsp;\u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u0438 \u043a\u043b\u0430\u0441\u0442\u0435\u0440\u0430, \u043a\u043e\u0442\u043e\u0440\u0443\u044e \u044f&nbsp;\u0432\u044b\u0431\u0440\u0430\u043b \u0434\u043b\u044f \u0434\u0435\u043f\u043b\u043e\u044f. <\/p>\n<details class=\"spoiler\">\n<summary>\u0427\u0442\u043e, \u0435\u0449\u0451 \u043e\u0434\u0438\u043d \u0442\u0443\u0442\u043e\u0440\u0438\u0430\u043b \u043e Patroni?<\/summary>\n<div class=\"spoiler__content\">\n<h4>\u0417\u0430\u0447\u0435\u043c \u0447\u0438\u0442\u0430\u0442\u044c \u0438\u043c\u0435\u043d\u043d\u043e \u044d\u0442\u043e\u0442 \u0442\u0443\u0442\u043e\u0440\u0438\u0430\u043b? <\/h4>\n<p>\u0415\u0441\u0442\u044c \u0443\u0436\u0435 \u043d\u0435\u043c\u0430\u043b\u043e \u0442\u0443\u0442\u043e\u0440\u0438\u0430\u043b\u043e\u0432, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0440\u0430\u0441\u0441\u043a\u0430\u0437\u044b\u0432\u0430\u044e\u0442, \u043a\u0430\u043a \u043f\u043e\u0434\u043d\u044f\u0442\u044c \u043a\u043b\u0430\u0441\u0442\u0435\u0440 Patroni. \u042d\u0442\u043e\u0442 \u0437\u0430\u0442\u0440\u0430\u0433\u0438\u0432\u0430\u0435\u0442 \u0432\u043e\u043f\u0440\u043e\u0441\u044b \u0434\u0435\u043f\u043b\u043e\u044f \u0432 \u0441\u0440\u0435\u0434\u0435 docker swarm \u0438 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044f Zookeeper \u0432 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 DCS. <\/p>\n<h4>\u041f\u043e\u0447\u0435\u043c\u0443 Zookeeper?<\/h4>\n<p>\u042f&nbsp;\u0441\u0447\u0438\u0442\u0430\u044e, \u044d\u0442\u043e \u043e\u0434\u0438\u043d \u0438\u0437&nbsp;\u043c\u043e\u043c\u0435\u043d\u0442\u043e\u0432, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0441\u0442\u043e\u0438\u0442 \u0440\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0435\u0442\u044c \u0432\u0441\u0435\u0440\u044c\u0435\u0437, \u043f\u0440\u0435\u0436\u0434\u0435 \u0447\u0435\u043c \u0432\u044b\u0431\u0440\u0430\u0442\u044c \u043a\u043e\u043d\u0435\u0447\u043d\u044b\u0439 \u0441\u0435\u0442\u0430\u043f \u0434\u043b\u044f \u043f\u0440\u043e\u0434\u0430\u043a\u0448\u0435\u043d\u0430. \u0414\u0435\u043b\u043e \u0432&nbsp;\u0442\u043e\u043c, \u0447\u0442\u043e Patroni \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442 \u0441\u0442\u043e\u0440\u043e\u043d\u043d\u0438\u0435 \u0441\u0435\u0440\u0432\u0438\u0441\u044b \u0447\u0442\u043e\u0431\u044b \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442\u044c \u0438&nbsp;\u043e\u0431\u0441\u043b\u0443\u0436\u0438\u0432\u0430\u0442\u044c \u043a\u043e\u043c\u043c\u0443\u043d\u0438\u043a\u0430\u0446\u0438\u044e \u043c\u0435\u0436\u0434\u0443 \u0441\u0432\u043e\u0438\u043c\u0438 \u043d\u043e\u0434\u0430\u043c\u0438. \u0418\u0445&nbsp;\u043e\u0431\u0449\u0435\u0435 \u043d\u0430\u0437\u0432\u0430\u043d\u0438\u0435&nbsp;\u2014 DCS (Dynamic Configuration Storage).<\/p>\n<p>\u0415\u0441\u043b\u0438 \u0432\u044b&nbsp;\u0443\u0436\u0435 \u0441\u043c\u043e\u0442\u0440\u0435\u043b\u0438 \u043a\u0430\u043a\u0438\u0435-\u0442\u043e \u0438\u0437&nbsp;\u0442\u0443\u0442\u043e\u0440\u0438\u0430\u043b\u043e\u0432 \u043e&nbsp;Patroni, \u0442\u043e, \u0434\u043e\u043b\u0436\u043d\u043e \u0431\u044b\u0442\u044c, \u0437\u0430\u043c\u0435\u0442\u0438\u043b\u0438, \u0447\u0442\u043e \u0441\u0430\u043c\u044b\u0439 \u0447\u0430\u0441\u0442\u044b\u0439 \u043a\u0435\u0439\u0441&nbsp;\u2014 \u044d\u0442\u043e \u043a\u043e\u0433\u0434\u0430 \u0432&nbsp;\u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 DCS \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044e\u0442 Etcd \u043a\u043b\u0430\u0441\u0442\u0435\u0440.<\/p>\n<p>\u0418\u043d\u0442\u0435\u0440\u0435\u0441\u043d\u044b\u0439 \u043c\u043e\u043c\u0435\u043d\u0442 \u0432&nbsp;\u0440\u0430\u0431\u043e\u0442\u0435 Etcd \u043a\u043b\u0430\u0441\u0442\u0435\u0440\u0430 \u0437\u0430\u043a\u043b\u044e\u0447\u0430\u0435\u0442\u0441\u044f \u0432&nbsp;\u0442\u043e\u043c, \u0447\u0442\u043e:<\/p>\n<blockquote>\n<p>Since etcd writes data to disk, its performance strongly depends on disk performance. For this reason, SSD is highly recommended. <\/p>\n<p>(\u0438\u0437 \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u0438 Etcd)<\/p>\n<\/p>\n<\/blockquote>\n<p>\u0421\u043b\u043e\u0432\u043e\u043c, \u0435\u0441\u043b\u0438 \u0443&nbsp;\u0432\u0430\u0441 \u043d\u0435\u0442 \u043f\u043e&nbsp;SSD \u0434\u0438\u0441\u043a\u0443 \u043d\u0430&nbsp;\u043a\u0430\u0436\u0434\u043e\u0439 \u043c\u0430\u0448\u0438\u043d\u0435, \u0433\u0434\u0435 \u0431\u0443\u0434\u0443\u0442 \u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c \u043d\u043e\u0434\u044b Etcd, \u0442\u043e&nbsp;\u0432\u044b&nbsp;\u0432&nbsp;\u0437\u043e\u043d\u0435 \u043e\u043f\u0430\u0441\u043d\u043e\u0441\u0442\u0438. \u041a\u043e\u043d\u0435\u0447\u043d\u043e, \u043f\u043e\u043a\u0430 \u043d\u0430\u0433\u0440\u0443\u0437\u043a\u0430 \u043d\u0435\u0431\u043e\u043b\u044c\u0448\u0430\u044f, \u0442\u043e&nbsp;\u043d\u0438\u0447\u0435\u0433\u043e \u043a\u0440\u0438\u0442\u0438\u0447\u043d\u043e\u0433\u043e \u043f\u0440\u043e\u0438\u0441\u0445\u043e\u0434\u0438\u0442\u044c \u043d\u0435&nbsp;\u0431\u0443\u0434\u0435\u0442, \u043d\u043e&nbsp;\u0435\u0441\u043b\u0438 \u044d\u0442\u043e \u0440\u0430\u0431\u043e\u0447\u0438\u0439, \u043d\u0430\u0433\u0440\u0443\u0436\u0435\u043d\u043d\u044b\u0439 \u043f\u0440\u043e\u0434, \u0442\u043e&nbsp;\u043e\u0447\u0435\u043d\u044c \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e (\u0438&nbsp;\u0434\u0430\u0436\u0435 \u0432\u0435\u0440\u043e\u044f\u0442\u043d\u043e), \u0447\u0442\u043e \u0432\u044b&nbsp;\u043f\u0440\u043e\u0441\u0442\u043e \u043f\u0435\u0440\u0435\u0433\u0440\u0443\u0437\u0438\u0442\u0435 Etcd \u043a\u043b\u0430\u0441\u0442\u0435\u0440. \u0410&nbsp;\u044d\u0442\u043e \u043f\u0440\u0438\u0432\u0435\u0434\u0435\u0442 \u043a&nbsp;IO \u043e\u0448\u0438\u0431\u043a\u0430\u043c \u043f\u0440\u0438 \u0434\u043e\u0441\u0442\u0443\u043f\u0435 \u043a&nbsp;\u0431\u0430\u0437\u0435. \u0417\u0432\u0443\u0447\u0438\u0442 \u0441\u043a\u0432\u0435\u0440\u043d\u043e? \u041d\u0430&nbsp;\u0441\u0430\u043c\u043e\u043c \u0434\u0435\u043b\u0435 \u0442\u0430\u043a \u0438&nbsp;\u0435\u0441\u0442\u044c. \u041b\u043e\u0432\u0438\u0442\u044c \u0442\u0430\u043a\u0438\u0435 \u043e\u0448\u0438\u0431\u043a\u0438 \u043d\u0430&nbsp;\u043f\u0440\u043e\u0434\u0435 \u043e\u0447\u0435\u043d\u044c \u043d\u0435\u043f\u0440\u0438\u044f\u0442\u043d\u043e.<\/p>\n<p>\u0417\u0434\u0435\u0441\u044c \u043d\u0430\u043c \u043d\u0430&nbsp;\u043f\u043e\u043c\u043e\u0449\u044c \u0438&nbsp;\u043c\u043e\u0436\u0435\u0442 \u043f\u0440\u0438\u0439\u0442\u0438 Zookeeper, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043d\u0438\u0447\u0435\u0433\u043e \u043d\u0435&nbsp;\u043f\u0438\u0448\u0435\u0442 \u043d\u0430&nbsp;\u0434\u0438\u0441\u043a \u0438&nbsp;\u0445\u0440\u0430\u043d\u0438\u0442 \u0432\u0441\u0435 \u0434\u0430\u043d\u043d\u044b\u0435 \u0432&nbsp;\u043f\u0430\u043c\u044f\u0442\u0438. \u0422\u0430\u043a\u043e\u0439 \u0432\u0430\u0440\u0438\u0430\u043d\u0442 \u043e\u043f\u0442\u0438\u043c\u0430\u043b\u0435\u043d \u0432&nbsp;\u0441\u0438\u0442\u0443\u0430\u0446\u0438\u0438, \u043a\u043e\u0433\u0434\u0430 \u043d\u0435&nbsp;\u043d\u0430&nbsp;\u0432\u0441\u0435\u0445 \u0441\u0435\u0440\u0432\u0435\u0440\u0430\u0445 \u0435\u0441\u0442\u044c SSD, \u0437\u0430\u0442\u043e RAM \u0445\u0432\u0430\u0442\u0430\u0435\u0442.<\/p>\n<h4>\u041f\u043e\u0447\u0435\u043c\u0443 Docker Swarm?<\/h4>\n<p>\u0423&nbsp;\u043c\u0435\u043d\u044f \u043d\u0435&nbsp;\u0431\u044b\u043b\u043e \u0432\u044b\u0431\u043e\u0440\u0430, \u0442\u0430\u043a \u043a\u0430\u043a \u043e\u0434\u043d\u0438\u043c \u0438\u0437&nbsp;\u043a\u043b\u044e\u0447\u0435\u0432\u044b\u0445 \u0442\u0440\u0435\u0431\u043e\u0432\u0430\u043d\u0438\u0439 \u0431\u044b\u043b\u043e, \u0447\u0442\u043e\u0431\u044b \u043a\u043b\u0430\u0441\u0442\u0435\u0440 \u0431\u044b\u043b \u0440\u0430\u0437\u0432\u0435\u0440\u043d\u0443\u0442 \u0432&nbsp;Swarm\u2019\u0435. \u0422\u0430\u043a \u0447\u0442\u043e, \u0435\u0441\u043b\u0438 \u044d\u0442\u043e \u0438&nbsp;\u0432\u0430\u0448 \u043a\u0435\u0439\u0441 \u0442\u043e\u0436\u0435, \u0442\u043e&nbsp;\u0432\u044b&nbsp;\u0432&nbsp;\u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u043e\u043c \u043c\u0435\u0441\u0442\u0435! <\/p>\n<p>\u0414\u043b\u044f \u0442\u0435\u0445&nbsp;\u0436\u0435, \u043a\u0442\u043e \u043e\u0442\u043a\u0440\u044b\u043b \u043f\u043e\u0441\u0442 \u0441&nbsp;\u0436\u0435\u043b\u0430\u043d\u0438\u0435\u043c \u043f\u043e\u0442\u0435\u0441\u0442\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0442\u0435\u0445\u043d\u043e\u043b\u043e\u0433\u0438\u044e, \u0432\u044b\u0431\u043e\u0440 Docker Swarm\u2019\u0430 \u0442\u043e\u0436\u0435 \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u0432\u043f\u043e\u043b\u043d\u0435 \u043e\u0440\u0433\u0430\u043d\u0438\u0447\u043d\u044b\u043c. \u0425\u043e\u0442\u044f&nbsp;\u0431\u044b \u043f\u043e&nbsp;\u0442\u043e\u0439 \u043f\u0440\u0438\u0447\u0438\u043d\u0435, \u0447\u0442\u043e \u0432\u0430\u043c \u043d\u0435&nbsp;\u043f\u0440\u0438\u0434\u0435\u0442\u0441\u044f \u0443\u0441\u0442\u0430\u043d\u0430\u0432\u043b\u0438\u0432\u0430\u0442\u044c \u0438&nbsp;\u043d\u0430\u0441\u0442\u0440\u0430\u0438\u0432\u0430\u0442\u044c \u043d\u0438\u043a\u0430\u043a\u0438\u0445 \u0441\u0442\u043e\u0440\u043e\u043d\u043d\u0438\u0445 \u0441\u0435\u0440\u0432\u0438\u0441\u043e\u0432 (\u043d\u0443&nbsp;\u0437\u0430&nbsp;\u0438\u0441\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435\u043c \u0441\u0430\u043c\u043e\u0433\u043e Docker\u2019\u0430, \u0440\u0430\u0437\u0443\u043c\u0435\u0435\u0442\u0441\u044f) \u0438\u043b\u0438 \u0442\u044f\u043d\u0443\u0442\u044c \u043d\u0430&nbsp;\u043b\u043e\u043a\u0430\u043b\u044c\u043d\u0443\u044e \u043c\u0430\u0448\u0438\u043d\u0443 \u0432\u043e\u0440\u043e\u0445 \u043d\u0435\u043f\u043e\u043d\u044f\u0442\u043d\u044b\u0445 \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u0435\u0439. \u041f\u043e\u043b\u0430\u0433\u0430\u044e, \u043d\u0435\u0434\u0430\u043b\u0435\u043a\u043e \u043e\u0442&nbsp;\u0438\u0441\u0442\u0438\u043d\u044b \u0443\u0442\u0432\u0435\u0440\u0436\u0434\u0435\u043d\u0438\u0435, \u0447\u0442\u043e Docker \u0443&nbsp;\u043d\u0430\u0441 \u0443&nbsp;\u0432\u0441\u0435\u0445 \u0438&nbsp;\u0442\u0430\u043a \u0443\u0436\u0435 \u043d\u0430\u0441\u0442\u0440\u043e\u0435\u043d \u0432\u0435\u0437\u0434\u0435 \u0433\u0434\u0435 \u0442\u043e\u043b\u044c\u043a\u043e \u043c\u043e\u0436\u043d\u043e, \u043c\u044b&nbsp;\u0432\u0441\u0435 \u0437\u043d\u0430\u0435\u043c, \u043a\u0430\u043a \u043e\u043d&nbsp;\u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442, \u0442\u0430\u043a \u0447\u0442\u043e \u043f\u043e\u0447\u0435\u043c\u0443&nbsp;\u0431\u044b \u043d\u0435&nbsp;\u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0435\u0433\u043e.<\/p>\n<p>\u041f\u043e\u0442\u0440\u0435\u0431\u0443\u0435\u0442\u0441\u044f \u043b\u0438\u0448\u044c \u043e\u0434\u043d\u0430 \u043a\u043e\u043c\u0430\u043d\u0434\u0430, \u0447\u0442\u043e\u0431\u044b \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u0442\u044e\u043d\u0438\u043d\u0433 Docker\u2019\u0430, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043f\u043e\u0437\u0432\u043e\u043b\u0438\u0442 \u0440\u0430\u0437\u0432\u0435\u0440\u043d\u0443\u0442\u044c \u043d\u0430&nbsp;\u043b\u043e\u043a\u0430\u043b\u044c\u043d\u043e\u0439 \u043c\u0430\u0448\u0438\u043d\u0435 \u043a\u043b\u0430\u0441\u0442\u0435\u0440 Patroni \u043d\u0430&nbsp;3&nbsp;\u043d\u043e\u0434\u044b \u0431\u0435\u0437 \u0432\u0438\u0440\u0442\u0443\u0430\u043b\u044c\u043d\u044b\u0445 \u043c\u0430\u0448\u0438\u043d, Kubernetes \u0438\u043b\u0438 \u043f\u043e\u0434\u043e\u0431\u043d\u044b\u0445 \u0432\u0435\u0449\u0435\u0439. <\/p>\n<p>\u0415\u0441\u043b\u0438 \u0432\u044b&nbsp;\u043d\u0435&nbsp;\u0445\u043e\u0442\u0438\u0442\u0435 \u043a\u043e\u043f\u0430\u0442\u044c \u0432&nbsp;\u0441\u0442\u043e\u0440\u043e\u043d\u0443 \u043a\u0430\u043a\u0438\u0445-\u0442\u043e \u0435\u0449\u0435 \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442\u043e\u0432 \u0437\u0430&nbsp;\u043f\u0440\u0435\u0434\u0435\u043b\u0430\u043c\u0438 Docker\u2019\u0430 \u0438&nbsp;\u0445\u043e\u0442\u0438\u0442\u0435 \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u0432\u0441\u0435 \u0447\u0438\u0441\u0442\u043e \u0438&nbsp;\u0430\u043a\u043a\u0443\u0440\u0430\u0442\u043d\u043e, \u0442\u043e&nbsp;\u0434\u0430\u043d\u043d\u044b\u0439 \u0442\u0443\u0442\u043e\u0440\u0438\u0430\u043b \u0432\u0430\u043c \u0431\u043e\u043b\u0435\u0435 \u0447\u0435\u043c \u043f\u043e\u0434\u043e\u0439\u0434\u0435\u0442. <\/p>\n<h4>\u0410 \u0432 \u043a\u043e\u043d\u0446\u0435 \u0431\u0443\u0434\u0435\u0442 \u043d\u0435\u0431\u043e\u043b\u044c\u0448\u043e\u0439 \u0431\u043e\u043d\u0443\u0441 <\/h4>\n<p>\u0412\u043e&nbsp;\u0432\u0442\u043e\u0440\u043e\u0439 \u0447\u0430\u0441\u0442\u0438 \u0442\u0443\u0442\u043e\u0440\u0438\u0430\u043b\u0430 \u044f&nbsp;\u043f\u043e\u043a\u0430\u0436\u0443 \u0440\u0430\u0437\u043b\u0438\u0447\u043d\u044b\u0435 \u0432\u0430\u0440\u0438\u0430\u043d\u0442\u044b \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0438 \u0441\u0442\u0430\u0442\u0443\u0441\u0430 \u043a\u043b\u0430\u0441\u0442\u0435\u0440\u0430 (\u0446\u0435\u043b\u044b\u0445&nbsp;3), \u0438&nbsp;\u0432&nbsp;\u043a\u043e\u043d\u0446\u0435 \u0434\u0430\u043c \u043f\u0440\u043e\u0441\u0442\u043e\u0439 \u0441\u043a\u0440\u0438\u043f\u0442 \u0441&nbsp;\u0438\u043d\u0441\u0442\u0440\u0443\u043a\u0446\u0438\u044f\u043c\u0438 \u0434\u043b\u044f \u0431\u044b\u0441\u0442\u0440\u043e\u0433\u043e \u0442\u0435\u0441\u0442\u0430 \u043a\u043b\u0430\u0441\u0442\u0435\u0440\u0430.<\/p>\n<p>\u041e\u043a\u0435\u0439, \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u0440\u0430\u0437\u0433\u043e\u0432\u043e\u0440\u043e\u0432. \u0414\u0430\u0432\u0430\u0439\u0442\u0435 \u043f\u0435\u0440\u0435\u0439\u0434\u0435\u043c \u043a&nbsp;\u043f\u0440\u0430\u043a\u0442\u0438\u043a\u0435.<\/p>\n<\/div>\n<\/details>\n<h2>Docker Swarm<\/h2>\n<p>\u0414\u043b\u044f \u0431\u044b\u0441\u0442\u0440\u043e\u0433\u043e \u0438&nbsp;\u043f\u0440\u0438\u0431\u043b\u0438\u0436\u0435\u043d\u043d\u043e\u0433\u043e \u043a&nbsp;\u0440\u0435\u0430\u043b\u044c\u043d\u043e\u0441\u0442\u0438 \u0442\u0435\u0441\u0442\u0430, \u043d\u0430\u043c, \u043d\u0430&nbsp;\u0441\u0430\u043c\u043e\u043c \u0434\u0435\u043b\u0435, \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u043e\u0434\u043d\u043e\u0439 \u043d\u043e\u0434\u044b \u0432&nbsp;Swarm \u043a\u043b\u0430\u0441\u0442\u0435\u0440\u0435. \u041f\u043e\u0441\u043a\u043e\u043b\u044c\u043a\u0443 \u043c\u044b&nbsp;\u043c\u043e\u0436\u0435\u043c \u043e\u0447\u0435\u043d\u044c \u043b\u0435\u0433\u043a\u043e \u043f\u043e\u0434\u043d\u0438\u043c\u0430\u0442\u044c \u0438&nbsp;\u0440\u043e\u043d\u044f\u0442\u044c \u0441\u0435\u0440\u0432\u0438\u0441\u044b, \u0437\u0430\u043f\u0443\u0449\u0435\u043d\u043d\u044b\u0435 \u0432&nbsp;Swarm\u2019\u0435, \u043c\u044b&nbsp;\u0441\u043c\u043e\u0436\u0435\u043c \u0438\u043c\u0438\u0442\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u043f\u0430\u0434\u0435\u043d\u0438\u0435 \u0441\u0435\u0440\u0432\u0435\u0440\u0430 \u0441&nbsp;\u043d\u043e\u0434\u043e\u0439, \u0438\u043c\u0435\u044f \u0432&nbsp;\u0440\u0430\u0441\u043f\u043e\u0440\u044f\u0436\u0435\u043d\u0438\u0438 \u0442\u043e\u043b\u044c\u043a\u043e \u043e\u0434\u043d\u0443 \u043b\u043e\u043a\u0430\u043b\u044c\u043d\u0443\u044e \u043c\u0430\u0448\u0438\u043d\u0443. <\/p>\n<p>\u042f&nbsp;\u0438\u0441\u0445\u043e\u0436\u0443 \u0438\u0437&nbsp;\u043f\u0440\u0435\u0434\u043f\u043e\u043b\u043e\u0436\u0435\u043d\u0438\u044f, \u0447\u0442\u043e \u0443&nbsp;\u0432\u0430\u0441 \u0443\u0436\u0435 \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043b\u0435\u043d \u0438&nbsp;\u043d\u0430\u0441\u0442\u0440\u043e\u0435\u043d Docker Engine. \u0412&nbsp;\u0442\u0430\u043a\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435, \u043d\u0443\u0436\u043d\u043e \u0442\u043e\u043b\u044c\u043a\u043e \u0432\u044b\u043f\u043e\u043b\u043d\u0438\u0442\u044c \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0443\u044e \u043a\u043e\u043c\u0430\u043d\u0434\u0443:<\/p>\n<pre><code>docker swarm init \/\/now check your single-node cluster docker node ls ID                            HOSTNAME       STATUS       AVAILABILITY           a9ej2flnv11ka1hencoc1mer2 *   floitet        Ready          Active       <\/code><\/pre>\n<p>\u041e\u0434\u043d\u0430 \u0438\u0437&nbsp;\u0432\u0430\u0436\u043d\u044b\u0445 \u0444\u0438\u0447 Swarm\u2019\u0430 \u0437\u0430\u043a\u043b\u044e\u0447\u0430\u0435\u0442\u0441\u044f \u0432&nbsp;\u0442\u043e\u043c, \u0447\u0442\u043e \u0442\u0435\u043f\u0435\u0440\u044c \u043c\u044b&nbsp;\u043c\u043e\u0436\u0435\u043c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u043d\u0435&nbsp;\u0442\u043e\u043b\u044c\u043a\u043e \u043e\u0431\u044b\u0447\u043d\u044b\u0435 Docker \u043a\u043e\u043d\u0442\u0435\u0439\u043d\u0435\u0440\u044b, \u043d\u043e&nbsp;\u0438&nbsp;\u0442\u0430\u043a \u043d\u0430\u0437\u044b\u0432\u0430\u0435\u043c\u044b\u0435 \u0441\u0435\u0440\u0432\u0438\u0441\u044b. \u0421\u0435\u0440\u0432\u0438\u0441\u044b&nbsp;\u2014 \u044d\u0442\u043e \u043f\u043e&nbsp;\u0441\u0443\u0442\u0438 \u0434\u0435\u043b\u0430 \u0430\u0431\u0441\u0442\u0440\u0430\u043a\u0446\u0438\u044f \u043d\u0430\u0434 \u043a\u043e\u043d\u0442\u0435\u0439\u043d\u0435\u0440\u0430\u043c\u0438. \u0415\u0441\u043b\u0438 \u043e\u0442\u0442\u0430\u043b\u043a\u0438\u0432\u0430\u0442\u044c\u0441\u044f \u043e\u0442&nbsp;\u0430\u043d\u0430\u043b\u043e\u0433\u0438\u0438 \u0441&nbsp;\u041e\u041e\u041f, \u0442\u043e&nbsp;\u0441\u0435\u0440\u0432\u0438\u0441&nbsp;\u2014 \u044d\u0442\u043e \u043a\u043b\u0430\u0441\u0441, \u0430&nbsp;\u043a\u043e\u043d\u0442\u0435\u0439\u043d\u0435\u0440 \u043a\u043e\u043d\u043a\u0440\u0435\u0442\u043d\u044b\u0439 \u043e\u0431\u044a\u0435\u043a\u0442 \u043a\u043b\u0430\u0441\u0441\u0430. \u041f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u044b \u0438&nbsp;\u043f\u0440\u0430\u0432\u0438\u043b\u0430 \u0441\u0435\u0440\u0432\u0438\u0441\u0430 \u0437\u0430\u0434\u0430\u044e\u0442\u0441\u044f \u043f\u0440\u0438 \u0434\u0435\u043f\u043b\u043e\u0435 \u0438\u0437&nbsp;yml-\u0444\u0430\u0439\u043b\u0430.<\/p>\n<p>\u0420\u0435\u043a\u043e\u043c\u0435\u043d\u0434\u0443\u044e \u0437\u0430\u043f\u043e\u043c\u043d\u0438\u0442\u044c hostname \u043d\u043e\u0434\u044b&nbsp;\u2014 \u043f\u043e\u0442\u043e\u043c \u043c\u044b&nbsp;\u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c \u0435\u0433\u043e \u0434\u043b\u044f \u0443\u043a\u0430\u0437\u0430\u043d\u0438\u044f \u2018constraint\u2019 \u0432&nbsp;\u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u043e\u043d\u043d\u043e\u043c \u0444\u0430\u0439\u043b\u0435. <\/p>\n<p>\u0412&nbsp;\u0446\u0435\u043b\u043e\u043c, \u044d\u0442\u043e \u0432\u0441\u0435 \u043f\u0440\u0438\u0433\u043e\u0442\u043e\u0432\u043b\u0435\u043d\u0438\u044f \u0432&nbsp;\u0447\u0430\u0441\u0442\u0438 Docker Swarm\u2019\u0430, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043d\u0443\u0436\u043d\u043e \u0441\u0434\u0435\u043b\u0430\u0442\u044c. \u0417\u0434\u0435\u0441\u044c \u043d\u0438\u043a\u0430\u043a\u0438\u0445 \u043f\u0440\u043e\u0431\u043b\u0435\u043c \u0431\u044b\u0442\u044c \u043d\u0435&nbsp;\u0434\u043e\u043b\u0436\u043d\u043e. \u0422\u0430\u043a \u0447\u0442\u043e \u0434\u0432\u0438\u043d\u0435\u043c\u0441\u044f \u0434\u0430\u043b\u044c\u0448\u0435.<\/p>\n<h2> Zookeeper<\/h2>\n<p>\u041f\u0440\u0435\u0436\u0434\u0435 \u0447\u0435\u043c \u043c\u044b&nbsp;\u043d\u0430\u0447\u043d\u0435\u043c \u0434\u0435\u043f\u043b\u043e\u0439 \u0441\u0430\u043c\u043e\u0433\u043e Patroni, \u043d\u0430\u043c \u043d\u0443\u0436\u043d\u043e \u0441\u043d\u0430\u0447\u0430\u043b\u0430 \u0440\u0430\u0437\u0432\u0435\u0440\u043d\u0443\u0442\u044c \u043a\u043b\u0430\u0441\u0442\u0435\u0440 \u0441&nbsp;DCS (\u0432&nbsp;\u043d\u0430\u0448\u0435\u043c \u0441\u043b\u0443\u0447\u0430\u0435, \u043a\u0430\u043a \u043c\u044b&nbsp;\u043f\u043e\u043c\u043d\u0438\u043c, \u044d\u0442\u043e Zookeeper). \u042f&nbsp;\u0432\u0437\u044f\u043b \u0432\u0435\u0440\u0441\u0438\u044e 3.4, \u0438&nbsp;\u043e\u043d\u0430 \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u0432\u043f\u043e\u043b\u043d\u0435 \u0441\u0442\u0430\u0431\u0438\u043b\u044c\u043d\u043e. \u0414\u0430\u043b\u0435\u0435 \u0438\u0434\u0435\u0442 docker-compose \u043a\u043e\u043d\u0444\u0438\u0433 \u0438&nbsp;\u043d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043a\u043e\u043c\u043c\u0435\u043d\u0442\u0430\u0440\u0438\u0438 \u043f\u043e&nbsp;\u043c\u043e\u043c\u0435\u043d\u0442\u0430\u043c, \u043a\u043e\u0442\u043e\u0440\u044b\u0435, \u043a\u0430\u043a \u043c\u043d\u0435 \u043a\u0430\u0436\u0435\u0442\u0441\u044f, \u0438\u043c\u0435\u0435\u0442 \u0441\u043c\u044b\u0441\u043b \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u043e \u0443\u043f\u043e\u043c\u044f\u043d\u0443\u0442\u044c.<\/p>\n<ul>\n<li>\n<p><strong>docker-compose-zookeeper.yml<\/strong><\/p>\n<\/li>\n<\/ul>\n<details class=\"spoiler\">\n<summary>docker-compose-zookeeper.yml<\/summary>\n<div class=\"spoiler__content\">\n<pre><code>version: '3.7'  services:   zoo1:     image: zookeeper:3.4     hostname: zoo1     ports:       - 2191:2181     networks:       - patroni     environment:       ZOO_MY_ID: 1       ZOO_SERVERS: server.1=0.0.0.0:2888:3888 server.2=zoo2:2888:3888 server.3=zoo3:2888:3888     deploy:       replicas: 1       placement:         constraints:           - node.hostname == floitet       restart_policy:         condition: any    zoo2:     image: zookeeper:3.4     hostname: zoo2     networks:       - patroni     ports:       - 2192:2181     environment:       ZOO_MY_ID: 2       ZOO_SERVERS: server.1=zoo1:2888:3888 server.2=0.0.0.0:2888:3888 server.3=zoo3:2888:3888     deploy:       replicas: 1       placement:         constraints:           - node.hostname == floitet       restart_policy:         condition: any    zoo3:     image: zookeeper:3.4     hostname: zoo3     networks:       - patroni     ports:       - 2193:2181     environment:       ZOO_MY_ID: 3       ZOO_SERVERS: server.1=zoo1:2888:3888 server.2=zoo2:2888:3888 server.3=0.0.0.0:2888:3888     deploy:       replicas: 1       placement:         constraints:           - node.hostname == floitet       restart_policy:         condition: any  networks:   patroni:     driver: overlay     attachable: true <\/code><\/pre>\n<\/p>\n<\/div>\n<\/details>\n<details class=\"spoiler\">\n<summary>Details<\/summary>\n<div class=\"spoiler__content\">\n<p>\u041a\u043e\u043d\u0435\u0447\u043d\u043e&nbsp;\u0436\u0435, \u0432\u0430\u0436\u043d\u043e \u0434\u0430\u0442\u044c \u043a\u0430\u0436\u0434\u043e\u0439 \u043d\u043e\u0434\u0435 \u0443\u043d\u0438\u043a\u0430\u043b\u044c\u043d\u043e\u0435 \u0438\u043c\u044f \u0438&nbsp;\u0432\u043d\u0435\u0448\u043d\u0438\u0439 \u043f\u043e\u0440\u0442. Hostname \u043b\u0443\u0447\u0448\u0435 \u0441\u0442\u0430\u0432\u0438\u0442\u044c \u043e\u0434\u0438\u043d\u0430\u043a\u043e\u0432\u043e\u0435 \u0441&nbsp;\u0438\u043c\u0435\u043d\u0435\u043c \u0441\u0435\u0440\u0432\u0438\u0441\u0430. <\/p>\n<pre><code>zoo1:     image: zookeeper:3.4     hostname: zoo1     ports:       - 2191:2181 <\/code><\/pre>\n<p>\u0421\u0442\u043e\u0438\u0442 \u043e\u0442\u043c\u0435\u0442\u0438\u0442\u044c \u0438&nbsp;\u0442\u043e, \u043a\u0430\u043a \u043c\u044b&nbsp;\u043f\u0435\u0440\u0435\u0447\u0438\u0441\u043b\u044f\u0435\u043c host\u2019\u044b \u0432&nbsp;\u0441\u0442\u0440\u043e\u043a\u0435 \u043d\u0438\u0436\u0435: \u0434\u043b\u044f \u043f\u0435\u0440\u0432\u043e\u0433\u043e \u0441\u0435\u0440\u0432\u0438\u0441\u0430 server.1 \u0431\u0443\u0434\u0435\u0442 \u043f\u0440\u0438\u0432\u044f\u0437\u0430\u043d \u043a&nbsp;0.0.0.0, \u0430, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0434\u043b\u044f zoo2 \u044d\u0442\u043e \u0443\u0436\u0435 \u0431\u0443\u0434\u0435\u0442 server.2 \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0435\u043d\u043d\u043e \u0438&nbsp;\u0442.\u0434.<\/p>\n<pre><code>ZOO_SERVERS: server.1=0.0.0.0:2888:3888 server.2=zoo2:2888:3888 server.3=zoo3:2888:3888<\/code><\/pre>\n<p>\u0410&nbsp;\u0442\u0430\u043a\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c \u043c\u044b&nbsp;\u043a\u043e\u043d\u0442\u0440\u043e\u043b\u0438\u0440\u0443\u0435\u043c \u0440\u0430\u0441\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u0435 \u0441\u0435\u0440\u0432\u0438\u0441\u043e\u0432 \u043f\u043e&nbsp;\u043d\u043e\u0434\u0430\u043c. \u041f\u043e\u0441\u043a\u043e\u043b\u044c\u043a\u0443 \u043d\u043e\u0434\u0430 \u0443&nbsp;\u043d\u0430\u0441 \u0441\u0435\u0439\u0447\u0430\u0441 \u0442\u043e\u043b\u044c\u043a\u043e \u043e\u0434\u043d\u0430, \u043c\u044b&nbsp;\u0441\u043f\u043e\u043a\u043e\u0439\u043d\u043e \u043c\u043e\u0433\u043b\u0438&nbsp;\u0431\u044b \u0443\u0431\u0440\u0430\u0442\u044c \u044d\u0442\u0438 \u0441\u0442\u0440\u043e\u0447\u043a\u0438 \u0438\u0437&nbsp;\u043a\u043e\u043d\u0444\u0438\u0433\u0430, \u043d\u043e&nbsp;\u043a\u043e\u0433\u0434\u0430 \u0441\u0435\u0440\u0432\u0435\u0440\u043e\u0432 \u0431\u0443\u0434\u0435\u0442 \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e, \u043c\u043e\u0436\u043d\u043e \u0431\u0443\u0434\u0435\u0442 \u043c\u0435\u043d\u044f\u0442\u044c node.hostname \u0438&nbsp;\u0442\u0435\u043c \u0441\u0430\u043c\u044b\u043c \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u0442\u044c \u043d\u0430&nbsp;\u043a\u0430\u043a\u0443\u044e \u043d\u043e\u0434\u0443 \u043f\u043e\u0439\u0434\u0435\u0442 \u0441\u0435\u0440\u0432\u0438\u0441.<\/p>\n<pre><code>     placement:         constraints:           - node.hostname == floitet <\/code><\/pre>\n<p>\u0418&nbsp;\u043f\u043e\u0441\u043b\u0435\u0434\u043d\u0438\u0439 \u043c\u043e\u043c\u0435\u043d\u0442, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043c\u044b&nbsp;\u0437\u0434\u0435\u0441\u044c \u043e\u0431\u0441\u0443\u0434\u0438\u043c, \u044d\u0442\u043e network. \u042f&nbsp;\u043d\u0430\u043c\u0435\u0440\u0435\u043d \u0434\u0435\u043f\u043b\u043e\u0438\u0442\u044c \u0432\u0441\u0435 \u0441\u0435\u0440\u0432\u0438\u0441\u044b Zookeeper\u2019\u0430 \u0438&nbsp;\u0432\u0441\u0435 \u0441\u0435\u0440\u0432\u0438\u0441\u044b Patroni \u0432&nbsp;\u043e\u0434\u043d\u0443 \u0441\u0435\u0442\u044c \u0441&nbsp;\u0434\u0440\u0430\u0439\u0432\u0435\u0440\u043e\u043c overlay, \u0447\u0442\u043e\u0431\u044b \u043e\u043d\u0438 \u0431\u044b\u043b\u0438 \u0438\u0437\u043e\u043b\u0438\u0440\u043e\u0432\u0430\u043d\u044b \u043e\u0442&nbsp;\u0434\u0440\u0443\u0433\u0438\u0445 \u0441\u0435\u0440\u0432\u0438\u0441\u043e\u0432 \u0438&nbsp;\u043c\u043e\u0433\u043b\u0438 \u043e\u0431\u0449\u0430\u0442\u044c\u0441\u044f \u043c\u0435\u0436\u0434\u0443 \u0441\u043e\u0431\u043e\u0439 \u043f\u043e&nbsp;\u0438\u043c\u0435\u043d\u0430\u043c, \u0430&nbsp;\u043d\u0435&nbsp;\u043f\u043e&nbsp;IP (\u043a\u0430\u043a \u044d\u0442\u043e \u0432\u044b\u0433\u043b\u044f\u0434\u0438\u0442, \u0431\u0443\u0434\u0435\u0442 \u0432\u0438\u0434\u043d\u043e \u0434\u0430\u043b\u044c\u0448\u0435). <\/p>\n<pre><code>networks:   patroni:     driver: overlay \/\/ \u043c\u044b \u0434\u043e\u043b\u0436\u043d\u044b \u043e\u0442\u043c\u0435\u0442\u0438\u0442\u044c \u0441\u0435\u0442\u044c \u043a\u0430\u043a attachable   \/\/ \u0447\u0442\u043e\u0431\u044b \u043f\u043e\u0442\u043e\u043c \u043c\u043e\u0436\u043d\u043e \u0431\u044b\u043b\u043e \u043f\u0440\u0438\u0441\u043e\u0435\u0434\u0438\u043d\u044f\u0442\u044c \u043a \u043d\u0435\u0439 \u043e\u0441\u0442\u0430\u043b\u044c\u043d\u044b\u0435 \u0441\u0435\u0440\u0432\u0438\u0441\u044b     attachable: true <\/code><\/pre>\n<\/p>\n<\/div>\n<\/details>\n<p>\u0418\u0442\u0430\u043a, \u043c\u043e\u0436\u043d\u043e \u0437\u0430\u0434\u0435\u043f\u043b\u043e\u0438\u0442\u044c Zookeeper:<\/p>\n<pre><code>sudo docker stack deploy --compose-file docker-compose-zookeeper.yml patroni<\/code><\/pre>\n<p>\u0422\u0435\u043f\u0435\u0440\u044c \u043d\u0443\u0436\u043d\u043e \u043f\u0440\u043e\u0432\u0435\u0440\u0438\u0442\u044c, \u0447\u0442\u043e \u0432\u0441\u0435 \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442. \u041f\u0435\u0440\u0432\u043e\u0435 \u0447\u0442\u043e \u043c\u043e\u0436\u043d\u043e \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u044d\u0442\u043e \u043f\u0440\u043e\u0441\u0442\u043e \u043f\u043e\u0441\u043c\u043e\u0442\u0440\u0435\u0442\u044c \u0441\u043f\u0438\u0441\u043e\u043a \u0441\u0435\u0440\u0432\u0438\u0441\u043e\u0432:<\/p>\n<pre><code>sudo docker service ls gxfj9rs3po7z        patroni_zoo1        replicated          1\/1                 zookeeper:3.4         *:2191-&gt;2181\/tcp ibp0mevmiflw        patroni_zoo2        replicated          1\/1                 zookeeper:3.4         *:2192-&gt;2181\/tcp srucfm8jrt57        patroni_zoo3        replicated          1\/1                 zookeeper:3.4         *:2193-&gt;2181\/tcp <\/code><\/pre>\n<p>\u0418&nbsp;\u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u043c \u0448\u0430\u0433\u043e\u043c \u043c\u043e\u0436\u043d\u043e \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u043f\u0438\u043d\u0433 \u0441\u0435\u0440\u0432\u0438\u0441\u043e\u0432 \u0441&nbsp;\u043f\u043e\u043c\u043e\u0449\u044c\u044e \u0441\u043f\u0435\u0446\u0438\u0430\u043b\u044c\u043d\u043e\u0439 \u043a\u043e\u043c\u0430\u043d\u0434\u044b mntr:<\/p>\n<pre><code>echo mntr | nc localhost 2191 \/\/ with the output being smth like this zk_version\t3.4.14-4c25d480e66aadd371de8bd2fd8da255ac140bcf, built on 03\/06\/2019 16:18 GMT zk_avg_latency\t6 zk_max_latency\t205 zk_min_latency\t0 zk_packets_received\t1745 zk_packets_sent\t1755 zk_num_alive_connections\t3 zk_outstanding_requests\t0 zk_server_state\tfollower zk_znode_count\t16 zk_watch_count\t9 zk_ephemerals_count\t4 zk_approximate_data_size\t1370<\/code><\/pre>\n<\/div>\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-315501","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/315501","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=315501"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/315501\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=315501"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=315501"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=315501"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}