{"id":87685,"date":"2020-05-13T20:42:33","date_gmt":"2020-05-13T12:42:33","guid":{"rendered":"http:\/\/4563.org\/?p=87685"},"modified":"2020-05-13T20:42:33","modified_gmt":"2020-05-13T12:42:33","slug":"%e5%90%84%e4%bd%8d%ef%bc%8c%e6%88%91%e5%8f%88%e6%9d%a5%e6%b1%82-star-%e4%ba%86%ef%bc%8c-mysql2ch%ef%bc%8c%e4%b8%80%e4%b8%aa%e5%90%8c%e6%ad%a5-mysql-%e5%88%b0-clickhouse-%e7%9a%84%e5%b7%a5%e5%85%b7","status":"publish","type":"post","link":"http:\/\/4563.org\/?p=87685","title":{"rendered":"\u5404\u4f4d\uff0c\u6211\u53c8\u6765\u6c42 star \u4e86\uff0c mysql2ch\uff0c\u4e00\u4e2a\u540c\u6b65 MySQL \u5230 Clickhouse \u7684\u5de5\u5177"},"content":{"rendered":"<div>\n<div>\n<div>\n<h1>                  \u5404\u4f4d\uff0c\u6211\u53c8\u6765\u6c42 star \u4e86\uff0c mysql2ch\uff0c\u4e00\u4e2a\u540c\u6b65 MySQL \u5230 Clickhouse \u7684\u5de5\u5177               <\/h1>\n<p> <\/p>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : long2ice <\/span>  <span><i><\/i> 6<\/span> <\/div>\n<div> <\/div>\n<\/p><\/div>\n<\/p><\/div>\n<\/p><\/div>\n<div isfirst=\"1\"> <\/p>\n<p>\u8ddd\u7b2c\u4e00\u7248\u53d1\u5e03\u5df2\u7ecf\u8fc7\u53bb\u4e24\u4e09\u4e2a\u6708\uff0c\u7ecf\u8fc7\u4e0d\u65ad\u5b8c\u5584\uff0cmysql2ch \u5df2\u7ecf\u53d1\u5e03 0.4.0 \u7248\u672c\u4e86~<\/p>\n<h2>\u7279\u6027<\/h2>\n<ul>\n<li>\u652f\u6301\u5168\u91cf\u540c\u6b65\u4e0e\u589e\u91cf\u540c\u6b65\u3002<\/li>\n<li>\u652f\u6301 DDL \u4e0e DML\uff0c\u5f53\u524d\u652f\u6301 DDL \u5b57\u6bb5\u65b0\u589e\u4e0e\u5220\u9664\uff0c\u652f\u6301\u6240\u6709\u7684 DML\uff0c\u589e\u5220\u6539\u5168\u90e8\u53ef\u4ee5\u540c\u6b65\u3002<\/li>\n<li>\u4e30\u5bcc\u7684\u914d\u7f6e\u9879\u3002<\/li>\n<\/ul>\n<h2>\u4f9d\u8d56<\/h2>\n<ul>\n<li>kafka\uff0c\u7f13\u51b2 MySQL binlog \u7684\u6d88\u606f\u961f\u5217\u3002<\/li>\n<li>redis\uff0c\u7f13\u5b58 MySQL binlog position \u4e0e file \u3002<\/li>\n<\/ul>\n<h2>\u7528\u6cd5<\/h2>\n<h3>\u5168\u91cf\u540c\u6b65<\/h3>\n<pre><code>$ mysql2ch etl -h  usage: mysql2ch etl [-h] --schema SCHEMA [--tables TABLES] [--renew]  optional arguments:   -h, --help       show this help message and exit   --schema SCHEMA  Schema to full etl.   --tables TABLES  Tables to full etl,multiple tables split with comma,default read from environment.   --renew          Etl after try to drop the target tables.  <\/code><\/pre>\n<h3>\u76d1\u542c binlog<\/h3>\n<pre><code>$ mysql2ch produce <\/code><\/pre>\n<h3>\u6d88\u8d39\u6d88\u606f\u5e76\u63d2\u5165 ClickHouse<\/h3>\n<pre><code>$ mysql2ch consume -h  usage: mysql2ch consume [-h] --schema SCHEMA [--skip-error] [--auto-offset-reset AUTO_OFFSET_RESET]  optional arguments:   -h, --help            show this help message and exit   --schema SCHEMA       Schema to consume.   --skip-error          Skip error rows.   --auto-offset-reset AUTO_OFFSET_RESET                         Kafka auto offset reset,default earliest. <\/code><\/pre>\n<h2>\u9879\u76ee\u5730\u5740<\/h2>\n<p>https:\/\/github.com\/long2ice\/mysql2ch\uff0c\u6c42\u4e2a star~      <\/p><\/div>\n<div> <b>\u5927\u4f6c\u6709\u8a71\u8aaa<\/b> (<span>3<\/span>)        <\/div>\n<div> <\/div>\n<\/p><\/div>\n<\/p><\/div>\n<ul>\n<li data-pid=\"1465615\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : azkaban <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             \u5df2 star\uff0cclone \u4e0b\u6765\u7814\u7a76\u4e00\u4e0b                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"1465616\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u4e3b<\/span> <span>\u8cc7\u6df1\u5927\u4f6c : long2ice <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             @azkaban \u611f\u8c22~                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"1465617\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : walker2laok <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             star, \u6b63\u597d\u501f\u6b64\u7814\u7a76\u4e00\u756a&#8230;                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li>\n","protected":false},"excerpt":{"rendered":"<p>\u5404\u4f4d\uff0c\u6211\u53c8\u6765\u6c42 star \u4e86\uff0c m&hellip;<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[],"tags":[],"_links":{"self":[{"href":"http:\/\/4563.org\/index.php?rest_route=\/wp\/v2\/posts\/87685"}],"collection":[{"href":"http:\/\/4563.org\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/4563.org\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/4563.org\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/4563.org\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=87685"}],"version-history":[{"count":0,"href":"http:\/\/4563.org\/index.php?rest_route=\/wp\/v2\/posts\/87685\/revisions"}],"wp:attachment":[{"href":"http:\/\/4563.org\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=87685"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/4563.org\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=87685"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/4563.org\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=87685"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}