{"id":7433,"date":"2023-02-28T17:29:34","date_gmt":"2023-02-28T09:29:34","guid":{"rendered":"https:\/\/nj.transwarp.cn:8180\/?p=7433"},"modified":"2023-02-28T17:29:34","modified_gmt":"2023-02-28T09:29:34","slug":"slipstream%e5%af%b9%e6%8e%a5%e6%95%b0%e6%8d%ae%e5%ba%93%e6%97%a5%e5%bf%97%e7%9a%84%e7%bb%9f%e4%b8%80decoder%e5%8a%9f%e8%83%bd","status":"publish","type":"post","link":"https:\/\/kbwp.transwarp.cn\/?p=7433","title":{"rendered":"slipstream\u5bf9\u63a5\u6570\u636e\u5e93\u65e5\u5fd7\u7684\u7edf\u4e00decoder\u529f\u80fd"},"content":{"rendered":"<h3>\u6982\u8981\u63cf\u8ff0<\/h3>\n<hr \/>\n<p>\u7814\u53d1\u51fajar\u5305\u5bf9cdc\u7684\u6570\u636e\u5e93\u65e5\u5fd7\u63d0\u4f9bjson\u89e3\u6790\u65b9\u6cd5<\/p>\n<h3>\u8be6\u7ec6\u8bf4\u660e<\/h3>\n<hr \/>\n<p><strong>\u4f7f\u7528\u65b9\u5f0f\uff1a<\/strong><\/p>\n<pre><code class=\"language-sql\">9.0.0\u53ca\u5176\u4e4b\u540e\u7684\u7248\u672c\n--mysql\u8868\nCREATE TABLE <code>students<\/code> (\n  <code>id<\/code> int(6) unsigned NOT NULL AUTO_INCREMENT,\n  <code>firstname<\/code> varchar(30) NOT NULL,\n  <code>lastname<\/code> varchar(30) NOT NULL,\n  <code>email<\/code> varchar(50) DEFAULT NULL,\n  <code>reg_date<\/code> timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,\n  PRIMARY KEY (<code>id<\/code>)\n) ENGINE=InnoDB AUTO_INCREMENT=5 DEFAULT CHARSET=latin1;\n\n--slipstream \u8f93\u5165\u6d41\nCREATE stream students_sync( \nid int,\nfirstname string,\nlastname string,\nemail string,\nreg_date timestamp,\nop_type string\n) tblproperties (\n'kafka.zookeeper'='localhost:2181',\n'kafka.broker.list'='localhost:9092', \n'changelog.format'='mysql',\n'topic'='dbserver1.inventory.students'\n);\n\n--slipstream \u8f93\u51fa\u8868\nCREATE table students_sync_out(\nid int,\nfirstname string,\nlastname string,\nemail string,\nreg_date timestamp\n);\n\n--\u521b\u5efa\u666e\u901a\u6d41\u4efb\u52a1\ncreate streamjob mysql_changelog_syncjob as (\"insert into students_sync_out select id, firstname, lastname, email, reg_date from students_sync\");\n\n--\u521b\u5efa\u5e26\u6709delete_mark\u7684\u6d41\u4efb\u52a1 TODO\ncreate streamjob mysql_changelog_syncjob_with_delete_mark as\n(\"insert  \/*+USE_DELETE_MARK*\/ into students_sync\nselect id, firstname, lastname, email, reg_data,\ncase when op='D' then true else false end as delete_mark\nfrom students_sync_stream\");\n\nstart streamjob mysql_changelog_syncjob;<\/code><\/pre>\n<pre><code class=\"language-sql\">--\u57287.0 - 9.0\uff08\u4e0d\u5305\u62ec9.0\uff09\u7684sql\n\n--mysql\u8868\nCREATE TABLE <code>students<\/code> (\n  <code>id<\/code> int(6) unsigned NOT NULL AUTO_INCREMENT,\n  <code>firstname<\/code> varchar(30) NOT NULL,\n  <code>lastname<\/code> varchar(30) NOT NULL,\n  <code>email<\/code> varchar(50) DEFAULT NULL,\n  <code>reg_date<\/code> timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,\n  PRIMARY KEY (<code>id<\/code>)\n) ENGINE=InnoDB AUTO_INCREMENT=5 DEFAULT CHARSET=latin1;\n\n-- \u521b\u5efastream\nCREATE stream students_sync_pre(\nid int,\nfirstname string,\nlastname string,\nemail string,\nreg_date timestamp,\nop_type string\n) tblproperties (\n'kafka.zookeeper'='localhost:2181',\n'kafka.broker.list'='localhost:9092',\n'kafka.decoder'='io.transwarp.slipstream.api.decoder.DBZBinlogDecoder',   -- \u89e3\u6790\u51fd\u6570, \u4e0b\u9762\u6709\u89e3\u6790\u51fd\u6570\u8868\n'kafka.decoder.columns.type'='int\/string\/string\/string\/timestamp\/string',\n'kafka.decoder.columns'='id\/firstname\/lastname\/email\/reg_date\/op_type',   --\u4e0d\u8981\u7528\",\"\u5206\u9694, \u56e0\u4e3a\u5982\u679c\u662f\u5e26\u7cbe\u5ea6\u7684\u6570\u5b57\u7c7b\u578b\u6bd4\u5982decimal(4,2), \u7a0b\u5e8f\u4f1a\u96be\u4ee5\u8bc6\u522b\u4e24\u4e2a\u9017\u53f7\n'topic'='dbserver1.inventory.students'\n);\n\n--slipstream \u8f93\u51fa\u8868\nCREATE table students_sync_out(\nid int,\nfirstname string,\nlastname string,\nemail string,\nreg_date timestamp\n);\n\n--\u521b\u5efa\u666e\u901a\u6d41\u4efb\u52a1\ncreate streamjob mysql_changelog_syncjob_pre as (\"insert into students_sync_out select id, firstname, lastname, email, reg_date from students_sync_pre\");\n\n--\u521b\u5efa\u5e26\u6709delete_mark\u7684\u6d41\u4efb\u52a1 TODO\ncreate streamjob mysql_changelog_syncjob_with_delete_mark as\n(\"insert  \/*+USE_DELETE_MARK*\/ into students_sync\nselect id, firstname, lastname, email, reg_data,\ncase when op='D' then true else false end as delete_mark\nfrom students_sync_stream\");\n\nstart streamjob mysql_changelog_syncjob_pre;<\/code><\/pre>\n<pre><code class=\"language-sql\">**transwarp-5.2 ogg oracle**\ncreate table table_ogg_oracle_decoder (\n    EMPNO int,\n    ENAME string,\n    JOB string,\n    MGR int,\n    HIREDATE timestamp,\n    SAL double,\n    COMM double,\n    DEPTNO int\n)\n\ndrop stream stream_ogg_oracle_decoder;\ncreate stream stream_ogg_oracle_decoder( EMPNO int,\n    ENAME string,\n    JOB string,\n    MGR int,\n    HIREDATE timestamp,\n    SAL double,\n    COMM double,\n    DEPTNO int,\n    op_type string     --op_type\u5b57\u6bb5\u522b\u5fd8\u4e86\n) tblproperties (\n\"topic\"=\"topic_ogg_oracle\",\n\"kafka.zookeeper\"=\"stream371:2181\",\n\"kafka.broker.list\"=\"stream371:9092\",\n\"kafka.decoder\"=\"io.transwarp.slipstream.api.decoder.OGGOracleDecoder\",   --\u89e3\u6790\u51fd\u6570, \u4e0b\u9762\u6709\u89e3\u6790\u51fd\u6570\u8868\u5bf9\u7167\n\"transwarp.consumer.kafka.decoder.delimited\"=\"\/\",  -- \u4f7f\u7528\u9ed8\u8ba4\u7684\"\/\"\u5206\u5272coloums\u548ccolums.type\u65f6\u53ef\u4ee5\u4e0d\u5199\uff0c\u4e0d\u8981\u7528\",\"\u5206\u9694, \u56e0\u4e3a\u5982\u679c\u662f\u5e26\u7cbe\u5ea6\u7684\u6570\u5b57\u7c7b\u578b\u6bd4\u5982decimal(4,2), \u7a0b\u5e8f\u65e0\u6cd5\u8bc6\u522b\n\"transwarp.consumer.kafka.decoder.columns.type\"=\"int\/string\/string\/int\/timestamp\/double\/double\/int\/string\",  -- \u8fd9\u91cc\u7684key\u8ddf\u5176\u4ed6\u7248\u672c\u4e0d\u4e00\u6837\uff0c\u6ce8\u610f\u533a\u5206\n\"transwarp.consumer.kafka.decoder.columns\"=\"EMPNO\/ENAME\/JOB\/MGR\/HIREDATE\/SAL\/COMM\/DEPTNO\/op_type\",\n\"topic\"=\"topic_ogg_oracle\"\n);\n\ncreate streamjob streamjob_ogg_oracle_decoder as (\"insert into table_ogg_oracle_decoder select EMPNO ,\n    ENAME ,\n    JOB ,\n    MGR ,\n    HIREDATE ,\n    SAL ,\n    COMM ,\n    DEPTNO from stream_ogg_oracle_decoder\");\n<\/code><\/pre>\n<p>\u901a\u8fc7add jar\u7684\u65b9\u5f0f\u4f7f\u7528jar\u5305\uff1a<a href=\"https:\/\/nj.transwarp.cn:8180\/?p=1541\">https:\/\/nj.transwarp.cn:8180\/?p=1541<\/a><br \/>\n<strong>transwarp-5.2 jar\u5305MD5\uff1a629ae977122ea4fac4039c521d5ee083<\/strong><br \/>\njar\u5305\u4e0b\u8f7d\u94fe\u63a5\uff1a<br \/>\n<a href=\"https:\/\/nj.transwarp.club:666\/main.html?download&weblink=8a4ef0d222abc6cfe481dd1f737c61fa&realfilename=formatter-transwarp-5.2.jar\">https:\/\/nj.transwarp.club:666\/main.html?download&#038;weblink=8a4ef0d222abc6cfe481dd1f737c61fa&#038;realfilename=formatter-transwarp-5.2.jar<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u6982\u8981\u63cf\u8ff0 \u7814\u53d1\u51fajar\u5305\u5bf9cdc\u7684\u6570\u636e\u5e93\u65e5\u5fd7\u63d0\u4f9bjson\u89e3\u6790\u65b9\u6cd5 \u8be6\u7ec6\u8bf4\u660e \u4f7f\u7528\u65b9\u5f0f\uff1a 9.0.0\u53ca\u5176\u4e4b\u540e\u7684\u7248 ..<\/p>\n<div class=\"clear-fix\"><\/div>\n<p><a href=\"https:\/\/kbwp.transwarp.cn\/?p=7433\" title=\"read more...\">Read more<\/a><\/p>\n","protected":false},"author":9,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-7433","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"acf":[],"_links":{"self":[{"href":"https:\/\/kbwp.transwarp.cn\/index.php?rest_route=\/wp\/v2\/posts\/7433","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/kbwp.transwarp.cn\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/kbwp.transwarp.cn\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/kbwp.transwarp.cn\/index.php?rest_route=\/wp\/v2\/users\/9"}],"replies":[{"embeddable":true,"href":"https:\/\/kbwp.transwarp.cn\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=7433"}],"version-history":[{"count":1,"href":"https:\/\/kbwp.transwarp.cn\/index.php?rest_route=\/wp\/v2\/posts\/7433\/revisions"}],"predecessor-version":[{"id":9814,"href":"https:\/\/kbwp.transwarp.cn\/index.php?rest_route=\/wp\/v2\/posts\/7433\/revisions\/9814"}],"wp:attachment":[{"href":"https:\/\/kbwp.transwarp.cn\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=7433"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/kbwp.transwarp.cn\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=7433"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/kbwp.transwarp.cn\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=7433"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}