{"id":5428,"date":"2018-02-07T10:37:26","date_gmt":"2018-02-07T08:37:26","guid":{"rendered":"http:\/\/skeletor.org.ua\/?p=5428"},"modified":"2018-02-08T14:38:59","modified_gmt":"2018-02-08T12:38:59","slug":"mysql-pt-table-sync-%d0%bf%d1%80%d0%be%d0%b2%d0%b5%d1%80%d1%8f%d0%b5%d0%bc-%d0%b8-%d1%83%d1%81%d1%82%d1%80%d0%b0%d0%bd%d1%8f%d0%b5%d0%bc-%d1%80%d0%b0%d1%81%d1%81%d0%b8%d0%bd%d1%85%d1%80%d0%be%d0%bd","status":"publish","type":"post","link":"https:\/\/skeletor.org.ua\/?p=5428","title":{"rendered":"[mysql] pt-table-sync: \u043f\u0440\u043e\u0432\u0435\u0440\u044f\u0435\u043c \u0438 \u0443\u0441\u0442\u0440\u0430\u043d\u044f\u0435\u043c \u0440\u0430\u0441\u0441\u0438\u043d\u0445\u0440\u043e\u043d \u043c\u0435\u0436\u0434\u0443 \u0431\u0430\u0437\u0430\u043c\u0438\/\u0442\u0430\u0431\u043b\u0438\u0446\u0430\u043c\u0438"},"content":{"rendered":"<p>\u0414\u043b\u044f \u0442\u0435\u0445, \u043a\u0442\u043e \u043d\u0435 \u0437\u043d\u0430\u0435\u0442, \u0435\u0441\u0442\u044c \u0437\u0430\u043c\u0435\u0447\u0430\u0442\u0435\u043b\u044c\u043d\u044b\u0439 \u043d\u0430\u0431\u043e\u0440 \u0443\u0442\u0438\u043b\u0438\u0442 \u0434\u043b\u044f \u0430\u0434\u043c\u0438\u043d\u0438\u0441\u0442\u0440\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u0431\u0430\u0437 \u0434\u0430\u043d\u043d\u044b\u0445 <strong>mysql<\/strong> &#8211; <a href=\"https:\/\/www.percona.com\/software\/database-tools\/percona-toolkit\">percona tools<\/a>\u00a0. \u0412 \u0434\u0430\u043d\u043d\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0435 \u0445\u043e\u0442\u0435\u043b\u043e\u0441\u044c \u0431\u044b \u0440\u0430\u0441\u0441\u043a\u0430\u0437\u0430\u0442\u044c \u043d\u0435 \u043e\u0431\u043e \u0432\u0441\u0435\u0445 \u0443\u0442\u0438\u043b\u0438\u0442\u0430\u0445, \u0430 \u0442\u043e\u043b\u044c\u043a\u043e \u043e <a href=\"https:\/\/www.percona.com\/doc\/percona-toolkit\/LATEST\/pt-table-sync.html\">pt-table-sync<\/a>. \u0415\u0441\u043b\u0438 \u043a\u0440\u0430\u0442\u043a\u043e &#8211; \u0442\u043e \u043e\u043d\u0430 \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u0443\u0437\u043d\u0430\u0442\u044c \u0440\u0430\u0441\u0441\u0438\u043d\u0445\u0440\u043e\u043d \u043c\u0435\u0436\u0434\u0443 \u0431\u0430\u0437\u0430\u043c\u0438\/\u0442\u0430\u0431\u043b\u0438\u0446\u0430\u043c\u0438 \u0438, \u0435\u0441\u043b\u0438 \u0435\u0441\u0442\u044c, \u0442\u043e \u0443\u0441\u0442\u0440\u0430\u043d\u0438\u0442\u044c \u0435\u0433\u043e.<\/p>\n<p>\u0414\u043b\u044f \u0441\u0432\u043e\u0435\u0439 \u0440\u0430\u0431\u043e\u0442\u044b, \u043e\u043d\u0430 \u043f\u043e\u0442\u0440\u0435\u0431\u0443\u0435\u0442 \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u043e\u0433\u043e \u044e\u0437\u0435\u0440\u0430 \u0441 \u043e\u0447\u0435\u043d\u044c \u0440\u0430\u0441\u0448\u0438\u0440\u0435\u043d\u043d\u044b\u043c\u0438 \u043f\u0440\u0430\u0432\u0430\u043c\u0438 (<strong>CREATE<\/strong>, <strong>DROP<\/strong>, <strong>ALTER<\/strong>,&#8230;). \u0415\u0441\u043b\u0438 \u043a\u0430\u043a\u043e\u0435-\u0442\u043e \u043f\u0440\u0430\u0432\u043e \u043d\u0435 \u0434\u0430\u043b\u0438 &#8211; \u0442\u043e <strong>pt-table-sync<\/strong> \u043e\u0431 \u044d\u0442\u043e\u043c \u0441\u043a\u0430\u0436\u0435\u0442.<\/p>\n<p><!--more--><\/p>\n<p>\u041f\u0440\u0438\u043c\u0435\u0440 \u043a\u043e\u043c\u0430\u043d\u0434\u044b, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u043f\u0440\u043e\u0432\u0435\u0440\u0438\u0442 \u0440\u0430\u0441\u0441\u0438\u043d\u0445\u0440\u043e\u043d \u043a\u0430\u0441\u0430\u0442\u0435\u043b\u044c\u043d\u043e \u0431\u0430\u0437\u044b db1 \u043c\u0435\u0436\u0434\u0443 \u0441\u0435\u0440\u0432\u0435\u0440\u0430\u043c\u0438 master (1.1.1.1)-slave (2.2.2.2):<\/p>\n<p><code>$ pt-table-sync --print --nobin-log --check-slave --databases=db1 --lock=0 --user=pt-user --password=pt-user-pass --verbose h=1.1.1.1 h=2.2.2.2<\/code><\/p>\n<p>\u042d\u0442\u043e \u043a\u043e\u043c\u0430\u043d\u0434\u0430 <strong>dry-run<\/strong>, \u0442\u043e \u0435\u0441\u0442\u044c \u0432\u044b\u0432\u0435\u0434\u0435\u0442 \u0447\u0442\u043e \u0431\u0443\u0434\u0435\u0442 \u0434\u0435\u043b\u0430\u0442\u044c. \u0415\u0441\u043b\u0438 \u0432\u0441\u0451 \u0443\u0441\u0442\u0440\u0430\u0438\u0432\u0430\u0435\u0442, \u0442\u043e \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440 <strong>&#8211;print<\/strong> \u043d\u0443\u0436\u043d\u043e \u0437\u0430\u043c\u0435\u043d\u0438\u0442\u044c \u043d\u0430 <strong>&#8211;execute<\/strong>. \u041f\u0440\u0438 \u044d\u0442\u043e\u043c \u043e\u043d\u0430 \u043f\u0440\u043e\u0432\u0435\u0440\u0438\u0442, \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u043b\u0438 \u0434\u0430\u043d\u043d\u044b\u0435 \u0441\u0435\u0440\u0432\u0435\u0440\u0430 \u0441\u0432\u044f\u0437\u0430\u043d\u044b \u043a\u0430\u043a master-slave.<\/p>\n<p>\u0412\u043e\u0442 \u0435\u0449\u0451 \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0432\u0430\u0436\u043d\u044b\u0445 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u043e\u0432:<\/p>\n<p><span style=\"color: #ff6600;\"><strong>&#8211;charset<\/strong><\/span>: \u0443\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u0442 \u043a\u043e\u0434\u0438\u0440\u043e\u0432\u043a\u0443 \u0431\u0430\u0437\u044b<br \/>\n<span style=\"color: #ff6600;\"><strong>&#8211;lock<\/strong><\/span>: \u0443\u0440\u043e\u0432\u0435\u043d\u044c \u0431\u043b\u043e\u043a\u0438\u0440\u043e\u0432\u043a\u0438<\/p>\n<pre>VALUE  MEANING\r\n=====  =======================================================\r\n0      Never lock tables.\r\n1      Lock and unlock one time per sync cycle (as implemented\r\n       by the syncing algorithm).  This is the most granular\r\n       level of locking available.  For example, the Chunk\r\n       algorithm will lock each chunk of C rows, and then\r\n       unlock them if they are the same on the source and the\r\n       destination, before moving on to the next chunk.\r\n2      Lock and unlock before and after each table.\r\n3      Lock and unlock once for every server (DSN) synced, with\r\n       C.\r\n<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>\u0414\u043b\u044f \u0442\u0435\u0445, \u043a\u0442\u043e \u043d\u0435 \u0437\u043d\u0430\u0435\u0442, \u0435\u0441\u0442\u044c \u0437\u0430\u043c\u0435\u0447\u0430\u0442\u0435\u043b\u044c\u043d\u044b\u0439 \u043d\u0430\u0431\u043e\u0440 \u0443\u0442\u0438\u043b\u0438\u0442 \u0434\u043b\u044f \u0430\u0434\u043c\u0438\u043d\u0438\u0441\u0442\u0440\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u0431\u0430\u0437 \u0434\u0430\u043d\u043d\u044b\u0445 mysql &#8211; percona tools\u00a0. \u0412 \u0434\u0430\u043d\u043d\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0435 \u0445\u043e\u0442\u0435\u043b\u043e\u0441\u044c \u0431\u044b \u0440\u0430\u0441\u0441\u043a\u0430\u0437\u0430\u0442\u044c \u043d\u0435 \u043e\u0431\u043e \u0432\u0441\u0435\u0445 \u0443\u0442\u0438\u043b\u0438\u0442\u0430\u0445, \u0430 \u0442\u043e\u043b\u044c\u043a\u043e \u043e pt-table-sync. \u0415\u0441\u043b\u0438 \u043a\u0440\u0430\u0442\u043a\u043e &#8211; \u0442\u043e \u043e\u043d\u0430 \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u0443\u0437\u043d\u0430\u0442\u044c \u0440\u0430\u0441\u0441\u0438\u043d\u0445\u0440\u043e\u043d \u043c\u0435\u0436\u0434\u0443 \u0431\u0430\u0437\u0430\u043c\u0438\/\u0442\u0430\u0431\u043b\u0438\u0446\u0430\u043c\u0438 \u0438, \u0435\u0441\u043b\u0438 \u0435\u0441\u0442\u044c, \u0442\u043e \u0443\u0441\u0442\u0440\u0430\u043d\u0438\u0442\u044c \u0435\u0433\u043e. \u0414\u043b\u044f \u0441\u0432\u043e\u0435\u0439 \u0440\u0430\u0431\u043e\u0442\u044b, \u043e\u043d\u0430 \u043f\u043e\u0442\u0440\u0435\u0431\u0443\u0435\u0442 \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u043e\u0433\u043e \u044e\u0437\u0435\u0440\u0430 \u0441 [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[9],"tags":[],"class_list":["post-5428","post","type-post","status-publish","format-standard","hentry","category-databases"],"_links":{"self":[{"href":"https:\/\/skeletor.org.ua\/index.php?rest_route=\/wp\/v2\/posts\/5428","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/skeletor.org.ua\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/skeletor.org.ua\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/skeletor.org.ua\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/skeletor.org.ua\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=5428"}],"version-history":[{"count":3,"href":"https:\/\/skeletor.org.ua\/index.php?rest_route=\/wp\/v2\/posts\/5428\/revisions"}],"predecessor-version":[{"id":5432,"href":"https:\/\/skeletor.org.ua\/index.php?rest_route=\/wp\/v2\/posts\/5428\/revisions\/5432"}],"wp:attachment":[{"href":"https:\/\/skeletor.org.ua\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=5428"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/skeletor.org.ua\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=5428"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/skeletor.org.ua\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=5428"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}