blob: e325c6f2cddd051760c48984151b1622185f40ea [file] [log] [blame]
"use strict";(self.webpackChunkdoris_website=self.webpackChunkdoris_website||[]).push([[36728],{15680:(e,n,a)=>{a.d(n,{xA:()=>g,yg:()=>m});var l=a(296540);function r(e,n,a){return n in e?Object.defineProperty(e,n,{value:a,enumerable:!0,configurable:!0,writable:!0}):e[n]=a,e}function t(e,n){var a=Object.keys(e);if(Object.getOwnPropertySymbols){var l=Object.getOwnPropertySymbols(e);n&&(l=l.filter((function(n){return Object.getOwnPropertyDescriptor(e,n).enumerable}))),a.push.apply(a,l)}return a}function p(e){for(var n=1;n<arguments.length;n++){var a=null!=arguments[n]?arguments[n]:{};n%2?t(Object(a),!0).forEach((function(n){r(e,n,a[n])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(a)):t(Object(a)).forEach((function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(a,n))}))}return e}function s(e,n){if(null==e)return{};var a,l,r=function(e,n){if(null==e)return{};var a,l,r={},t=Object.keys(e);for(l=0;l<t.length;l++)a=t[l],n.indexOf(a)>=0||(r[a]=e[a]);return r}(e,n);if(Object.getOwnPropertySymbols){var t=Object.getOwnPropertySymbols(e);for(l=0;l<t.length;l++)a=t[l],n.indexOf(a)>=0||Object.prototype.propertyIsEnumerable.call(e,a)&&(r[a]=e[a])}return r}var y=l.createContext({}),o=function(e){var n=l.useContext(y),a=n;return e&&(a="function"==typeof e?e(n):p(p({},n),e)),a},g=function(e){var n=o(e.components);return l.createElement(y.Provider,{value:n},e.children)},i="mdxType",c={inlineCode:"code",wrapper:function(e){var n=e.children;return l.createElement(l.Fragment,{},n)}},u=l.forwardRef((function(e,n){var a=e.components,r=e.mdxType,t=e.originalType,y=e.parentName,g=s(e,["components","mdxType","originalType","parentName"]),i=o(a),u=r,m=i["".concat(y,".").concat(u)]||i[u]||c[u]||t;return a?l.createElement(m,p(p({ref:n},g),{},{components:a})):l.createElement(m,p({ref:n},g))}));function m(e,n){var a=arguments,r=n&&n.mdxType;if("string"==typeof e||r){var t=a.length,p=new Array(t);p[0]=u;var s={};for(var y in n)hasOwnProperty.call(n,y)&&(s[y]=n[y]);s.originalType=e,s[i]="string"==typeof e?e:r,p[1]=s;for(var o=2;o<t;o++)p[o]=a[o];return l.createElement.apply(null,p)}return l.createElement.apply(null,a)}u.displayName="MDXCreateElement"},640963:(e,n,a)=>{a.r(n),a.d(n,{assets:()=>y,contentTitle:()=>p,default:()=>c,frontMatter:()=>t,metadata:()=>s,toc:()=>o});var l=a(58168),r=(a(296540),a(15680));const t={title:"\u8de8\u96c6\u7fa4\u6570\u636e\u540c\u6b65",language:"zh-CN"},p=void 0,s={unversionedId:"admin-manual/data-admin/ccr",id:"version-2.0/admin-manual/data-admin/ccr",title:"\u8de8\u96c6\u7fa4\u6570\u636e\u540c\u6b65",description:"\x3c!--",source:"@site/i18n/zh-CN/docusaurus-plugin-content-docs/version-2.0/admin-manual/data-admin/ccr.md",sourceDirName:"admin-manual/data-admin",slug:"/admin-manual/data-admin/ccr",permalink:"/zh-CN/docs/2.0/admin-manual/data-admin/ccr",draft:!1,tags:[],version:"2.0",frontMatter:{title:"\u8de8\u96c6\u7fa4\u6570\u636e\u540c\u6b65",language:"zh-CN"},sidebar:"docs",previous:{title:"\u6570\u636e\u5220\u9664\u7684\u6062\u590d",permalink:"/zh-CN/docs/2.0/admin-manual/data-admin/delete-recover"},next:{title:"Workload Group",permalink:"/zh-CN/docs/2.0/admin-manual/resource-admin/workload-group"}},y={},o=[{value:"\u6982\u89c8",id:"\u6982\u89c8",level:2},{value:"\u539f\u7406",id:"\u539f\u7406",level:2},{value:"\u540d\u8bcd\u89e3\u91ca",id:"\u540d\u8bcd\u89e3\u91ca",level:3},{value:"\u67b6\u6784\u8bf4\u660e",id:"\u67b6\u6784\u8bf4\u660e",level:3},{value:"\u4f7f\u7528",id:"\u4f7f\u7528",level:2},{value:"Syncer \u8be6\u7ec6\u64cd\u4f5c\u624b\u518c",id:"syncer-\u8be6\u7ec6\u64cd\u4f5c\u624b\u518c",level:2},{value:"\u542f\u52a8 Syncer \u8bf4\u660e",id:"\u542f\u52a8-syncer-\u8bf4\u660e",level:3},{value:"Syncer \u505c\u6b62\u8bf4\u660e",id:"syncer-\u505c\u6b62\u8bf4\u660e",level:3},{value:"Syncer \u64cd\u4f5c\u5217\u8868",id:"syncer-\u64cd\u4f5c\u5217\u8868",level:3},{value:"operators",id:"operators",level:3},{value:"\u5f00\u542f\u5e93\u4e2d\u6240\u6709\u8868\u7684 binlog",id:"\u5f00\u542f\u5e93\u4e2d\u6240\u6709\u8868\u7684-binlog",level:3},{value:"Syncer \u9ad8\u53ef\u7528",id:"syncer-\u9ad8\u53ef\u7528",level:2},{value:"\u6743\u9650\u8981\u6c42",id:"\u6743\u9650\u8981\u6c42",level:3},{value:"\u4f7f\u7528\u9650\u5236",id:"\u4f7f\u7528\u9650\u5236",level:2},{value:"\u7f51\u7edc\u7ea6\u675f",id:"\u7f51\u7edc\u7ea6\u675f",level:3},{value:"ThriftPool \u9650\u5236",id:"thriftpool-\u9650\u5236",level:3},{value:"\u7248\u672c\u8981\u6c42",id:"\u7248\u672c\u8981\u6c42",level:3},{value:"\u4e0d\u652f\u6301\u7684\u64cd\u4f5c",id:"\u4e0d\u652f\u6301\u7684\u64cd\u4f5c",level:3},{value:"Feature",id:"feature",level:2},{value:"\u9650\u901f",id:"\u9650\u901f",level:3},{value:"IS_BEING_SYNCED \u5c5e\u6027",id:"is_being_synced-\u5c5e\u6027",level:2},{value:"\u5b9e\u73b0",id:"\u5b9e\u73b0",level:3},{value:"\u6ce8\u610f",id:"\u6ce8\u610f",level:3}],g={toc:o},i="wrapper";function c(e){let{components:n,...t}=e;return(0,r.yg)(i,(0,l.A)({},g,t,{components:n,mdxType:"MDXLayout"}),(0,r.yg)("h2",{id:"\u6982\u89c8"},"\u6982\u89c8"),(0,r.yg)("p",null,"CCR(Cross Cluster Replication) \u662f\u8de8\u7ea7\u7fa4\u6570\u636e\u540c\u6b65\uff0c\u80fd\u591f\u5728\u5e93/\u8868\u7ea7\u522b\u5c06\u6e90\u96c6\u7fa4\u7684\u6570\u636e\u53d8\u66f4\u540c\u6b65\u5230\u76ee\u6807\u96c6\u7fa4\uff0c\u53ef\u7528\u4e8e\u5728\u7ebf\u670d\u52a1\u7684\u6570\u636e\u53ef\u7528\u6027\u3001\u9694\u79bb\u5728\u79bb\u7ebf\u8d1f\u8f7d\u3001\u5efa\u8bbe\u4e24\u5730\u4e09\u4e2d\u5fc3\u3002"),(0,r.yg)("p",null,"CCR \u901a\u5e38\u88ab\u7528\u4e8e\u5bb9\u707e\u5907\u4efd\u3001\u8bfb\u5199\u5206\u79bb\u3001\u96c6\u56e2\u4e0e\u516c\u53f8\u95f4\u6570\u636e\u4f20\u8f93\u548c\u9694\u79bb\u5347\u7ea7\u7b49\u573a\u666f\u3002"),(0,r.yg)("ul",null,(0,r.yg)("li",{parentName:"ul"},(0,r.yg)("p",{parentName:"li"},"\u5bb9\u707e\u5907\u4efd\uff1a\u901a\u5e38\u662f\u5c06\u4f01\u4e1a\u7684\u6570\u636e\u5907\u4efd\u5230\u53e6\u4e00\u4e2a\u96c6\u7fa4\u4e0e\u673a\u623f\u4e2d\uff0c\u5f53\u7a81\u53d1\u4e8b\u4ef6\u5bfc\u81f4\u4e1a\u52a1\u4e2d\u65ad\u6216\u4e22\u5931\u65f6\uff0c\u53ef\u4ee5\u4ece\u5907\u4efd\u4e2d\u6062\u590d\u6570\u636e\u6216\u5feb\u901f\u8fdb\u884c\u4e3b\u5907\u5207\u6362\u3002\u4e00\u822c\u5728\u5bf9 SLA \u8981\u6c42\u6bd4\u8f83\u9ad8\u7684\u573a\u666f\u4e2d\uff0c\u90fd\u9700\u8981\u8fdb\u884c\u5bb9\u707e\u5907\u4efd\uff0c\u6bd4\u5982\u5728\u91d1\u878d\u3001\u533b\u7597\u3001\u7535\u5b50\u5546\u52a1\u7b49\u9886\u57df\u4e2d\u6bd4\u8f83\u5e38\u89c1\u3002")),(0,r.yg)("li",{parentName:"ul"},(0,r.yg)("p",{parentName:"li"},"\u8bfb\u5199\u5206\u79bb\uff1a\u8bfb\u5199\u5206\u79bb\u662f\u5c06\u6570\u636e\u7684\u67e5\u8be2\u64cd\u4f5c\u548c\u5199\u5165\u64cd\u4f5c\u8fdb\u884c\u5206\u79bb\uff0c\u76ee\u7684\u662f\u964d\u4f4e\u8bfb\u5199\u64cd\u4f5c\u7684\u76f8\u4e92\u5f71\u54cd\u5e76\u63d0\u5347\u8d44\u6e90\u7684\u5229\u7528\u7387\u3002\u6bd4\u5982\u5728\u6570\u636e\u5e93\u5199\u5165\u538b\u529b\u8fc7\u5927\u6216\u5728\u9ad8\u5e76\u53d1\u573a\u666f\u4e2d\uff0c\u91c7\u7528\u8bfb\u5199\u5206\u79bb\u53ef\u4ee5\u5c06\u8bfb/\u5199\u64cd\u4f5c\u5206\u6563\u5230\u591a\u4e2a\u5730\u57df\u7684\u53ea\u8bfb/\u53ea\u5199\u7684\u6570\u636e\u5e93\u6848\u4f8b\u4e0a\uff0c\u51cf\u5c11\u8bfb\u5199\u95f4\u7684\u4e92\u76f8\u5f71\u54cd\uff0c\u6709\u6548\u4fdd\u8bc1\u6570\u636e\u5e93\u7684\u6027\u80fd\u53ca\u7a33\u5b9a\u6027\u3002")),(0,r.yg)("li",{parentName:"ul"},(0,r.yg)("p",{parentName:"li"},"\u96c6\u56e2\u4e0e\u5206\u516c\u53f8\u95f4\u6570\u636e\u4f20\u8f93\uff1a\u96c6\u56e2\u603b\u90e8\u4e3a\u4e86\u5bf9\u96c6\u56e2\u5185\u6570\u636e\u8fdb\u884c\u7edf\u4e00\u7ba1\u63a7\u548c\u5206\u6790\uff0c\u901a\u5e38\u9700\u8981\u5206\u5e03\u5728\u5404\u5730\u57df\u7684\u5206\u516c\u53f8\u53ca\u65f6\u5c06\u6570\u636e\u4f20\u8f93\u540c\u6b65\u5230\u96c6\u56e2\u603b\u90e8\uff0c\u907f\u514d\u56e0\u4e3a\u6570\u636e\u4e0d\u4e00\u81f4\u800c\u5f15\u8d77\u7684\u7ba1\u7406\u6df7\u4e71\u548c\u51b3\u7b56\u9519\u8bef\uff0c\u6709\u5229\u4e8e\u63d0\u9ad8\u96c6\u56e2\u7684\u7ba1\u7406\u6548\u7387\u548c\u51b3\u7b56\u8d28\u91cf\u3002")),(0,r.yg)("li",{parentName:"ul"},(0,r.yg)("p",{parentName:"li"},"\u9694\u79bb\u5347\u7ea7\uff1a\u5f53\u5728\u5bf9\u7cfb\u7edf\u96c6\u7fa4\u5347\u7ea7\u65f6\uff0c\u6709\u53ef\u80fd\u56e0\u4e3a\u67d0\u4e9b\u539f\u56e0\u9700\u8981\u8fdb\u884c\u7248\u672c\u56de\u6eda\uff0c\u4f20\u7edf\u7684\u5347\u7ea7\u6a21\u5f0f\u5f80\u5f80\u4f1a\u56e0\u4e3a\u5143\u6570\u636e\u4e0d\u517c\u5bb9\u7684\u539f\u56e0\u65e0\u6cd5\u56de\u6eda\u3002\u800c\u4f7f\u7528 CCR \u53ef\u4ee5\u89e3\u51b3\u8be5\u95ee\u9898\uff0c\u5148\u6784\u5efa\u4e00\u4e2a\u5907\u7528\u7684\u96c6\u7fa4\u8fdb\u884c\u5347\u7ea7\u5e76\u53cc\u8dd1\u9a8c\u8bc1\uff0c\u7528\u6237\u53ef\u4ee5\u4f9d\u6b21\u5347\u7ea7\u5404\u4e2a\u96c6\u7fa4\uff0c\u540c\u65f6 CCR \u4e5f\u4e0d\u4f9d\u8d56\u7279\u5b9a\u7248\u672c\uff0c\u4f7f\u7248\u672c\u7684\u56de\u6eda\u53d8\u5f97\u53ef\u884c\u3002"))),(0,r.yg)("h2",{id:"\u539f\u7406"},"\u539f\u7406"),(0,r.yg)("h3",{id:"\u540d\u8bcd\u89e3\u91ca"},"\u540d\u8bcd\u89e3\u91ca"),(0,r.yg)("p",null,"\u6e90\u96c6\u7fa4\uff1a\u6e90\u5934\u96c6\u7fa4\uff0c\u4e1a\u52a1\u6570\u636e\u5199\u5165\u7684\u96c6\u7fa4\uff0c\u9700\u8981 2.0 \u7248\u672c"),(0,r.yg)("p",null,"\u76ee\u6807\u96c6\u7fa4\uff1a\u8de8\u96c6\u7fa4\u540c\u6b65\u7684\u76ee\u6807\u96c6\u7fa4\uff0c\u9700\u8981 2.0 \u7248\u672c"),(0,r.yg)("p",null,"binlog\uff1a\u6e90\u96c6\u7fa4\u7684\u53d8\u66f4\u65e5\u5fd7\uff0c\u5305\u62ec schema \u548c\u6570\u636e\u53d8\u66f4"),(0,r.yg)("p",null,"syncer\uff1a\u4e00\u4e2a\u8f7b\u91cf\u7ea7\u7684\u8fdb\u7a0b"),(0,r.yg)("h3",{id:"\u67b6\u6784\u8bf4\u660e"},"\u67b6\u6784\u8bf4\u660e"),(0,r.yg)("p",null,(0,r.yg)("img",{alt:"ccr \u67b6\u6784\u8bf4\u660e",src:a(815225).A,width:"3488",height:"1064"})),(0,r.yg)("p",null,"CCR \u5de5\u5177\u4e3b\u8981\u4f9d\u8d56\u4e00\u4e2a\u8f7b\u91cf\u7ea7\u8fdb\u7a0b\uff1aSyncers\u3002Syncers \u4f1a\u4ece\u6e90\u96c6\u7fa4\u83b7\u53d6 binlog\uff0c\u76f4\u63a5\u5c06\u5143\u6570\u636e\u5e94\u7528\u4e8e\u76ee\u6807\u96c6\u7fa4\uff0c\u901a\u77e5\u76ee\u6807\u96c6\u7fa4\u4ece\u6e90\u96c6\u7fa4\u62c9\u53d6\u6570\u636e\u3002\u4ece\u800c\u5b9e\u73b0\u5168\u91cf\u548c\u589e\u91cf\u8fc1\u79fb\u3002"),(0,r.yg)("h2",{id:"\u4f7f\u7528"},"\u4f7f\u7528"),(0,r.yg)("p",null,"\u4f7f\u7528\u975e\u5e38\u7b80\u5355\uff0c\u53ea\u9700\u628a Syncers \u670d\u52a1\u542f\u52a8\uff0c\u7ed9\u4ed6\u53d1\u4e00\u4e2a\u547d\u4ee4\uff0c\u5269\u4e0b\u7684\u4ea4\u7ed9 Syncers \u5b8c\u6210\u5c31\u884c\u3002"),(0,r.yg)("p",null,(0,r.yg)("strong",{parentName:"p"},"1. \u90e8\u7f72\u6e90 Doris \u96c6\u7fa4")),(0,r.yg)("p",null,(0,r.yg)("strong",{parentName:"p"},"2. \u90e8\u7f72\u76ee\u6807 Doris \u96c6\u7fa4")),(0,r.yg)("p",null,(0,r.yg)("strong",{parentName:"p"},"3. \u9996\u5148\u6e90\u96c6\u7fa4\u548c\u76ee\u6807\u96c6\u7fa4\u90fd\u9700\u8981\u6253\u5f00 binlog\uff0c\u5728\u6e90\u96c6\u7fa4\u548c\u76ee\u6807\u96c6\u7fa4\u7684 fe.conf \u548c be.conf \u4e2d\u914d\u7f6e\u5982\u4e0b\u4fe1\u606f\uff1a")),(0,r.yg)("pre",null,(0,r.yg)("code",{parentName:"pre",className:"language-sql"},"enable_feature_binlog=true\n")),(0,r.yg)("p",null,(0,r.yg)("strong",{parentName:"p"},"4. \u90e8\u7f72 syncers")),(0,r.yg)("ol",null,(0,r.yg)("li",{parentName:"ol"},(0,r.yg)("p",{parentName:"li"},"\u6784\u5efa CCR syncer"),(0,r.yg)("pre",{parentName:"li"},(0,r.yg)("code",{parentName:"pre",className:"language-Bash"},"git clone https://github.com/selectdb/ccr-syncer\n\ncd ccr-syncer\n\nbash build.sh <-j NUM_OF_THREAD> <--output SYNCER_OUTPUT_DIR>\n\ncd SYNCER_OUTPUT_DIR# \u8054\u7cfb\u76f8\u5173\u540c\u5b66\u514d\u8d39\u83b7\u53d6 ccr \u4e8c\u8fdb\u5236\u5305\n"))),(0,r.yg)("li",{parentName:"ol"},(0,r.yg)("p",{parentName:"li"},"\u542f\u52a8\u548c\u505c\u6b62 syncer"),(0,r.yg)("pre",{parentName:"li"},(0,r.yg)("code",{parentName:"pre",className:"language-Bash"},"# \u542f\u52a8\ncd bin && sh start_syncer.sh --daemon\n\n# \u505c\u6b62\nsh stop_syncer.sh\n")))),(0,r.yg)("p",null,(0,r.yg)("strong",{parentName:"p"},"5. \u6253\u5f00\u6e90\u96c6\u7fa4\u4e2d\u540c\u6b65\u5e93/\u8868\u7684 Binlog")),(0,r.yg)("pre",null,(0,r.yg)("code",{parentName:"pre",className:"language-Bash"},'-- \u5982\u679c\u662f\u6574\u5e93\u540c\u6b65\uff0c\u53ef\u4ee5\u6267\u884c\u5982\u4e0b\u811a\u672c\uff0c\u4f7f\u5f97\u8be5\u5e93\u4e0b\u9762\u6240\u6709\u7684\u8868\u90fd\u8981\u6253\u5f00 binlog.enable\nvim shell/enable_db_binlog.sh\n\u4fee\u6539\u6e90\u96c6\u7fa4\u7684 host\u3001port\u3001user\u3001password\u3001db\n\u6216\u8005 ./enable_db_binlog.sh --host $host --port $port --user $user --password $password --db $db\n\n-- \u5982\u679c\u662f\u5355\u8868\u540c\u6b65\uff0c\u5219\u53ea\u9700\u8981\u6253\u5f00 table \u7684 binlog.enable\uff0c\u5728\u6e90\u96c6\u7fa4\u4e0a\u6267\u884c\uff1a\nALTER TABLE enable_binlog SET ("binlog.enable" = "true");\n')),(0,r.yg)("p",null,(0,r.yg)("strong",{parentName:"p"},"6. \u5411 syncer \u53d1\u8d77\u540c\u6b65\u4efb\u52a1")),(0,r.yg)("pre",null,(0,r.yg)("code",{parentName:"pre",className:"language-Bash"},'curl -X POST -H "Content-Type: application/json" -d \'{\n "name": "ccr_test",\n "src": {\n "host": "localhost",\n "port": "9030",\n "thrift_port": "9020",\n "user": "root",\n "password": "",\n "database": "your_db_name",\n "table": "your_table_name"\n },\n "dest": {\n "host": "localhost",\n "port": "9030",\n "thrift_port": "9020",\n "user": "root",\n "password": "",\n "database": "your_db_name",\n "table": "your_table_name"\n }\n}\' http://127.0.0.1:9190/create_ccr\n')),(0,r.yg)("p",null,"\u540c\u6b65\u4efb\u52a1\u7684\u53c2\u6570\u8bf4\u660e\uff1a"),(0,r.yg)("pre",null,(0,r.yg)("code",{parentName:"pre",className:"language-Bash"},"name: CCR\u540c\u6b65\u4efb\u52a1\u7684\u540d\u79f0\uff0c\u552f\u4e00\u5373\u53ef\nhost\u3001port\uff1a\u5bf9\u5e94\u96c6\u7fa4 Master FE\u7684host\u548cmysql(jdbc) \u7684\u7aef\u53e3\nuser\u3001password\uff1asyncer\u4ee5\u4f55\u79cd\u8eab\u4efd\u53bb\u5f00\u542f\u4e8b\u52a1\u3001\u62c9\u53d6\u6570\u636e\u7b49\ndatabase\u3001table\uff1a\n\u5982\u679c\u662fdb\u7ea7\u522b\u7684\u540c\u6b65\uff0c\u5219\u586b\u5165your_db_name\uff0cyour_table_name\u4e3a\u7a7a\n\u5982\u679c\u662f\u8868\u7ea7\u522b\u540c\u6b65\uff0c\u5219\u9700\u8981\u586b\u5165your_db_name\uff0cyour_table_name\n\u5411syncer\u53d1\u8d77\u540c\u6b65\u4efb\u52a1\u4e2d\u7684name\u53ea\u80fd\u4f7f\u7528\u4e00\u6b21\n")),(0,r.yg)("h2",{id:"syncer-\u8be6\u7ec6\u64cd\u4f5c\u624b\u518c"},"Syncer \u8be6\u7ec6\u64cd\u4f5c\u624b\u518c"),(0,r.yg)("h3",{id:"\u542f\u52a8-syncer-\u8bf4\u660e"},"\u542f\u52a8 Syncer \u8bf4\u660e"),(0,r.yg)("p",null,"\u6839\u636e\u914d\u7f6e\u9009\u9879\u542f\u52a8 Syncer\uff0c\u5e76\u4e14\u5728\u9ed8\u8ba4\u6216\u6307\u5b9a\u8def\u5f84\u4e0b\u4fdd\u5b58\u4e00\u4e2a pid \u6587\u4ef6\uff0cpid \u6587\u4ef6\u7684\u547d\u540d\u65b9\u5f0f\u4e3a",(0,r.yg)("inlineCode",{parentName:"p"},"host_port.pid"),"\u3002 "),(0,r.yg)("p",null,(0,r.yg)("strong",{parentName:"p"},"\u8f93\u51fa\u8def\u5f84\u4e0b\u7684\u6587\u4ef6\u7ed3\u6784")),(0,r.yg)("p",null,"\u5728\u7f16\u8bd1\u5b8c\u6210\u540e\u7684\u8f93\u51fa\u8def\u5f84\u4e0b\uff0c\u6587\u4ef6\u7ed3\u6784\u5927\u81f4\u5982\u4e0b\u6240\u793a\uff1a"),(0,r.yg)("pre",null,(0,r.yg)("code",{parentName:"pre",className:"language-sql"},"output_dir\n bin\n ccr_syncer\n enable_db_binlog.sh\n start_syncer.sh\n stop_syncer.sh\n db\n [ccr.db] # \u9ed8\u8ba4\u914d\u7f6e\u4e0b\u8fd0\u884c\u540e\u751f\u6210\n log\n [ccr_syncer.log] # \u9ed8\u8ba4\u914d\u7f6e\u4e0b\u8fd0\u884c\u540e\u751f\u6210\n")),(0,r.yg)("admonition",{type:"caution"},(0,r.yg)("p",{parentName:"admonition"},(0,r.yg)("strong",{parentName:"p"},"\u540e\u6587\u4e2d\u7684 start_syncer.sh \u6307\u7684\u662f\u8be5\u8def\u5f84\u4e0b\u7684 start_syncer.sh\uff01\uff01\uff01"))),(0,r.yg)("p",null,(0,r.yg)("strong",{parentName:"p"},"\u542f\u52a8\u9009\u9879")),(0,r.yg)("ol",null,(0,r.yg)("li",{parentName:"ol"},"--daemon ")),(0,r.yg)("p",null,"\u540e\u53f0\u8fd0\u884c Syncer\uff0c\u9ed8\u8ba4\u4e3a false"),(0,r.yg)("pre",null,(0,r.yg)("code",{parentName:"pre",className:"language-sql"},"bash bin/start_syncer.sh --daemon\n")),(0,r.yg)("ol",{start:2},(0,r.yg)("li",{parentName:"ol"},"--db_type ")),(0,r.yg)("p",null,"Syncer \u76ee\u524d\u80fd\u591f\u4f7f\u7528\u4e24\u79cd\u6570\u636e\u5e93\u6765\u4fdd\u5b58\u81ea\u8eab\u7684\u5143\u6570\u636e\uff0c\u5206\u522b\u4e3a",(0,r.yg)("inlineCode",{parentName:"p"},"sqlite3"),"\uff08\u5bf9\u5e94\u672c\u5730\u5b58\u50a8\uff09\u548c",(0,r.yg)("inlineCode",{parentName:"p"},"mysql"),"\uff08\u672c\u5730\u6216\u8fdc\u7aef\u5b58\u50a8\uff09 "),(0,r.yg)("pre",null,(0,r.yg)("code",{parentName:"pre",className:"language-sql"},"bash bin/start_syncer.sh --db_type mysql\n")),(0,r.yg)("p",null,"\u9ed8\u8ba4\u503c\u4e3a sqlite3 "),(0,r.yg)("p",null,"\u5728\u4f7f\u7528 mysql \u5b58\u50a8\u5143\u6570\u636e\u65f6\uff0cSyncer \u4f1a\u4f7f\u7528",(0,r.yg)("inlineCode",{parentName:"p"},"CREATE IF NOT EXISTS"),"\u6765\u521b\u5efa\u4e00\u4e2a\u540d\u4e3a",(0,r.yg)("inlineCode",{parentName:"p"},"ccr"),"\u7684\u5e93\uff0cccr \u76f8\u5173\u7684\u5143\u6570\u636e\u8868\u90fd\u4f1a\u4fdd\u5b58\u5728\u5176\u4e2d"),(0,r.yg)("ol",{start:3},(0,r.yg)("li",{parentName:"ol"},"--db_dir ")),(0,r.yg)("p",null,(0,r.yg)("strong",{parentName:"p"},"\u8fd9\u4e2a\u9009\u9879\u4ec5\u5728 db \u4f7f\u7528**"),(0,r.yg)("inlineCode",{parentName:"p"},"sqlite3"),"*",(0,r.yg)("strong",{parentName:"p"},"*\u65f6\u751f\u6548")," "),(0,r.yg)("p",null,"\u53ef\u4ee5\u901a\u8fc7\u6b64\u9009\u9879\u6765\u6307\u5b9a sqlite3 \u751f\u6210\u7684 db \u6587\u4ef6\u540d\u53ca\u8def\u5f84\u3002 "),(0,r.yg)("pre",null,(0,r.yg)("code",{parentName:"pre",className:"language-sql"},"bash bin/start_syncer.sh --db_dir /path/to/ccr.db\n")),(0,r.yg)("p",null,"\u9ed8\u8ba4\u8def\u5f84\u4e3a",(0,r.yg)("inlineCode",{parentName:"p"},"SYNCER_OUTPUT_DIR/db"),"\uff0c\u6587\u4ef6\u540d\u4e3a",(0,r.yg)("inlineCode",{parentName:"p"},"ccr.db")),(0,r.yg)("ol",{start:4},(0,r.yg)("li",{parentName:"ol"},"--db_host & db_port & db_user & db_password")),(0,r.yg)("p",null,(0,r.yg)("strong",{parentName:"p"},"\u8fd9\u4e2a\u9009\u9879\u4ec5\u5728 db \u4f7f\u7528**"),(0,r.yg)("inlineCode",{parentName:"p"},"mysql"),"*",(0,r.yg)("strong",{parentName:"p"},"*\u65f6\u751f\u6548")," "),(0,r.yg)("pre",null,(0,r.yg)("code",{parentName:"pre",className:"language-sql"},'bash bin/start_syncer.sh --db_host 127.0.0.1 --db_port 3306 --db_user root --db_password "qwe123456"\n')),(0,r.yg)("p",null,"db_host\u3001db_port \u7684\u9ed8\u8ba4\u503c\u5982\u4f8b\u5b50\u4e2d\u6240\u793a\uff0cdb_user\u3001db_password \u9ed8\u8ba4\u503c\u4e3a\u7a7a"),(0,r.yg)("ol",{start:5},(0,r.yg)("li",{parentName:"ol"},"--log_dir ")),(0,r.yg)("p",null,"\u65e5\u5fd7\u7684\u8f93\u51fa\u8def\u5f84 "),(0,r.yg)("pre",null,(0,r.yg)("code",{parentName:"pre",className:"language-sql"},"bash bin/start_syncer.sh --log_dir /path/to/ccr_syncer.log\n")),(0,r.yg)("p",null,"\u9ed8\u8ba4\u8def\u5f84\u4e3a",(0,r.yg)("inlineCode",{parentName:"p"},"SYNCER_OUTPUT_DIR/log"),"\uff0c\u6587\u4ef6\u540d\u4e3a",(0,r.yg)("inlineCode",{parentName:"p"},"ccr_syncer.log")),(0,r.yg)("ol",{start:6},(0,r.yg)("li",{parentName:"ol"},"--log_level ")),(0,r.yg)("p",null,"\u7528\u4e8e\u6307\u5b9a Syncer \u65e5\u5fd7\u7684\u8f93\u51fa\u7b49\u7ea7\u3002"),(0,r.yg)("pre",null,(0,r.yg)("code",{parentName:"pre",className:"language-sql"},"bash bin/start_syncer.sh --log_level info\n")),(0,r.yg)("p",null,"\u65e5\u5fd7\u7684\u683c\u5f0f\u5982\u4e0b\uff0c\u5176\u4e2d hook \u53ea\u4f1a\u5728",(0,r.yg)("inlineCode",{parentName:"p"},"log_level > info"),"\u7684\u65f6\u5019\u6253\u5370\uff1a"),(0,r.yg)("pre",null,(0,r.yg)("code",{parentName:"pre",className:"language-sql"},"# time level msg hooks\n[2023-07-18 16:30:18] TRACE This is trace type. ccrName=xxx line=xxx\n[2023-07-18 16:30:18] DEBUG This is debug type. ccrName=xxx line=xxx\n[2023-07-18 16:30:18] INFO This is info type. ccrName=xxx line=xxx\n[2023-07-18 16:30:18] WARN This is warn type. ccrName=xxx line=xxx\n[2023-07-18 16:30:18] ERROR This is error type. ccrName=xxx line=xxx\n[2023-07-18 16:30:18] FATAL This is fatal type. ccrName=xxx line=xxx\n")),(0,r.yg)("p",null,"\u5728--daemon \u4e0b\uff0clog_level \u9ed8\u8ba4\u503c\u4e3a",(0,r.yg)("inlineCode",{parentName:"p"},"info")," "),(0,r.yg)("p",null,"\u5728\u524d\u53f0\u8fd0\u884c\u65f6\uff0clog_level \u9ed8\u8ba4\u503c\u4e3a",(0,r.yg)("inlineCode",{parentName:"p"},"trace"),"\uff0c\u540c\u65f6\u65e5\u5fd7\u4f1a\u901a\u8fc7 tee \u6765\u4fdd\u5b58\u5230 log_dir"),(0,r.yg)("ol",{start:6},(0,r.yg)("li",{parentName:"ol"},"--host && --port ")),(0,r.yg)("p",null,"\u7528\u4e8e\u6307\u5b9a Syncer \u7684 host \u548c port\uff0c\u5176\u4e2d host \u53ea\u8d77\u5230\u5728\u96c6\u7fa4\u4e2d\u7684\u533a\u5206\u81ea\u8eab\u7684\u4f5c\u7528\uff0c\u53ef\u4ee5\u7406\u89e3\u4e3a Syncer \u7684 name\uff0c\u96c6\u7fa4\u4e2d Syncer \u7684\u540d\u79f0\u4e3a",(0,r.yg)("inlineCode",{parentName:"p"},"host:port")," "),(0,r.yg)("pre",null,(0,r.yg)("code",{parentName:"pre",className:"language-sql"},"bash bin/start_syncer.sh --host 127.0.0.1 --port 9190\n")),(0,r.yg)("p",null,"host \u9ed8\u8ba4\u503c\u4e3a 127.0.0.1\uff0cport \u7684\u9ed8\u8ba4\u503c\u4e3a 9190 "),(0,r.yg)("ol",{start:7},(0,r.yg)("li",{parentName:"ol"},"--pid_dir ")),(0,r.yg)("p",null,"\u7528\u4e8e\u6307\u5b9a pid \u6587\u4ef6\u7684\u4fdd\u5b58\u8def\u5f84 "),(0,r.yg)("p",null,"pid \u6587\u4ef6\u662f stop_syncer.sh \u811a\u672c\u7528\u4e8e\u5173\u95ed Syncer \u7684\u51ed\u636e\uff0c\u91cc\u9762\u4fdd\u5b58\u4e86\u5bf9\u5e94 Syncer \u7684\u8fdb\u7a0b\u53f7\uff0c\u4e3a\u4e86\u65b9\u4fbf Syncer \u7684\u96c6\u7fa4\u5316\u7ba1\u7406\uff0c\u53ef\u4ee5\u6307\u5b9a pid \u6587\u4ef6\u7684\u4fdd\u5b58\u8def\u5f84 "),(0,r.yg)("pre",null,(0,r.yg)("code",{parentName:"pre",className:"language-sql"},"bash bin/start_syncer.sh --pid_dir /path/to/pids\n")),(0,r.yg)("p",null,"\u9ed8\u8ba4\u503c\u4e3a",(0,r.yg)("inlineCode",{parentName:"p"},"SYNCER_OUTPUT_DIR/bin")),(0,r.yg)("h3",{id:"syncer-\u505c\u6b62\u8bf4\u660e"},"Syncer \u505c\u6b62\u8bf4\u660e"),(0,r.yg)("p",null,"\u6839\u636e\u9ed8\u8ba4\u6216\u6307\u5b9a\u8def\u5f84\u4e0b pid \u6587\u4ef6\u4e2d\u7684\u8fdb\u7a0b\u53f7\u5173\u95ed\u5bf9\u5e94 Syncer\uff0cpid \u6587\u4ef6\u7684\u547d\u540d\u65b9\u5f0f\u4e3a",(0,r.yg)("inlineCode",{parentName:"p"},"host_port.pid"),"\u3002 "),(0,r.yg)("p",null,(0,r.yg)("strong",{parentName:"p"},"\u8f93\u51fa\u8def\u5f84\u4e0b\u7684\u6587\u4ef6\u7ed3\u6784")),(0,r.yg)("p",null,"\u5728\u7f16\u8bd1\u5b8c\u6210\u540e\u7684\u8f93\u51fa\u8def\u5f84\u4e0b\uff0c\u6587\u4ef6\u7ed3\u6784\u5927\u81f4\u5982\u4e0b\u6240\u793a\uff1a"),(0,r.yg)("pre",null,(0,r.yg)("code",{parentName:"pre",className:"language-Bash"},"output_dir\n bin\n ccr_syncer\n enable_db_binlog.sh\n start_syncer.sh\n stop_syncer.sh\n db\n [ccr.db] # \u9ed8\u8ba4\u914d\u7f6e\u4e0b\u8fd0\u884c\u540e\u751f\u6210\n log\n [ccr_syncer.log] # \u9ed8\u8ba4\u914d\u7f6e\u4e0b\u8fd0\u884c\u540e\u751f\u6210\n")),(0,r.yg)("admonition",{type:"caution"},(0,r.yg)("p",{parentName:"admonition"},(0,r.yg)("strong",{parentName:"p"},"\u540e\u6587\u4e2d\u7684 stop_syncer.sh \u6307\u7684\u662f\u8be5\u8def\u5f84\u4e0b\u7684 stop_syncer.sh\uff01\uff01\uff01"))),(0,r.yg)("p",null,(0,r.yg)("strong",{parentName:"p"},"\u505c\u6b62\u9009\u9879")),(0,r.yg)("p",null,"\u6709\u4e09\u79cd\u5173\u95ed\u65b9\u6cd5\uff1a "),(0,r.yg)("ol",null,(0,r.yg)("li",{parentName:"ol"},"\u5173\u95ed\u76ee\u5f55\u4e0b\u5355\u4e2a Syncer ")),(0,r.yg)("p",null,"\u200b \u6307\u5b9a\u8981\u5173\u95ed Syncer \u7684 host && port\uff0c\u6ce8\u610f\u8981\u4e0e start_syncer \u65f6\u6307\u5b9a\u7684 host \u4e00\u81f4"),(0,r.yg)("ol",{start:2},(0,r.yg)("li",{parentName:"ol"},"\u6279\u91cf\u5173\u95ed\u76ee\u5f55\u4e0b\u6307\u5b9a Syncer ")),(0,r.yg)("p",null,"\u200b \u6307\u5b9a\u8981\u5173\u95ed\u7684 pid \u6587\u4ef6\u540d\uff0c\u4ee5\u7a7a\u683c\u5206\u9694\uff0c\u7528",(0,r.yg)("inlineCode",{parentName:"p"},'" "'),"\u5305\u88f9"),(0,r.yg)("ol",{start:3},(0,r.yg)("li",{parentName:"ol"},"\u5173\u95ed\u76ee\u5f55\u4e0b\u6240\u6709 Syncer ")),(0,r.yg)("p",null,"\u200b \u9ed8\u8ba4\u5373\u53ef"),(0,r.yg)("ol",null,(0,r.yg)("li",{parentName:"ol"},"--pid_dir ")),(0,r.yg)("p",null,"\u6307\u5b9a pid \u6587\u4ef6\u6240\u5728\u76ee\u5f55\uff0c\u4e0a\u8ff0\u4e09\u79cd\u5173\u95ed\u65b9\u6cd5\u90fd\u4f9d\u8d56\u4e8e pid \u6587\u4ef6\u7684\u6240\u5728\u76ee\u5f55\u6267\u884c"),(0,r.yg)("pre",null,(0,r.yg)("code",{parentName:"pre",className:"language-Bash"},"bash bin/stop_syncer.sh --pid_dir /path/to/pids\n")),(0,r.yg)("p",null,"\u4f8b\u5b50\u4e2d\u7684\u6267\u884c\u6548\u679c\u5c31\u662f\u5173\u95ed",(0,r.yg)("inlineCode",{parentName:"p"},"/path/to/pids"),"\u4e0b\u6240\u6709 pid \u6587\u4ef6\u5bf9\u5e94\u7684 Syncers\uff08",(0,r.yg)("strong",{parentName:"p"},"\u65b9\u6cd5 3"),"\uff09\uff0c",(0,r.yg)("inlineCode",{parentName:"p"},"--pid_dir"),"\u53ef\u4e0e\u4e0a\u9762\u4e09\u79cd\u5173\u95ed\u65b9\u6cd5\u7ec4\u5408\u4f7f\u7528\u3002 "),(0,r.yg)("p",null,"\u9ed8\u8ba4\u503c\u4e3a",(0,r.yg)("inlineCode",{parentName:"p"},"SYNCER_OUTPUT_DIR/bin")),(0,r.yg)("ol",{start:2},(0,r.yg)("li",{parentName:"ol"},"--host && --port ")),(0,r.yg)("p",null,"\u5173\u95ed pid_dir \u8def\u5f84\u4e0b host:port \u5bf9\u5e94\u7684 Syncer"),(0,r.yg)("pre",null,(0,r.yg)("code",{parentName:"pre",className:"language-Bash"},"bash bin/stop_syncer.sh --host 127.0.0.1 --port 9190\n")),(0,r.yg)("p",null,"host \u7684\u9ed8\u8ba4\u503c\u4e3a 127.0.0.1\uff0cport \u9ed8\u8ba4\u503c\u4e3a\u7a7a "),(0,r.yg)("p",null,"\u5373\uff0c\u5355\u72ec\u6307\u5b9a host \u65f6",(0,r.yg)("strong",{parentName:"p"},"\u65b9\u6cd5 1"),"\u4e0d\u751f\u6548\uff0c\u4f1a\u9000\u5316\u4e3a",(0,r.yg)("strong",{parentName:"p"},"\u65b9\u6cd5 3"),"\u3002 "),(0,r.yg)("p",null,"host \u4e0e port \u90fd\u4e0d\u4e3a\u7a7a\u65f6",(0,r.yg)("strong",{parentName:"p"},"\u65b9\u6cd5 1"),"\u624d\u80fd\u751f\u6548"),(0,r.yg)("ol",{start:3},(0,r.yg)("li",{parentName:"ol"},"--files ")),(0,r.yg)("p",null,"\u5173\u95ed pid_dir \u8def\u5f84\u4e0b\u6307\u5b9a pid \u6587\u4ef6\u540d\u5bf9\u5e94\u7684 Syncer"),(0,r.yg)("pre",null,(0,r.yg)("code",{parentName:"pre",className:"language-Bash"},'bash bin/stop_syncer.sh --files "127.0.0.1_9190.pid 127.0.0.1_9191.pid"\n')),(0,r.yg)("p",null,"\u6587\u4ef6\u4e4b\u95f4\u7528\u7a7a\u683c\u5206\u9694\uff0c\u6574\u4f53\u9700\u8981\u7528",(0,r.yg)("inlineCode",{parentName:"p"},'" "'),"\u5305\u88f9\u4f4f"),(0,r.yg)("h3",{id:"syncer-\u64cd\u4f5c\u5217\u8868"},"Syncer \u64cd\u4f5c\u5217\u8868"),(0,r.yg)("p",null,(0,r.yg)("strong",{parentName:"p"},"\u8bf7\u6c42\u7684\u901a\u7528\u6a21\u677f")),(0,r.yg)("pre",null,(0,r.yg)("code",{parentName:"pre",className:"language-Bash"},'curl -X POST -H "Content-Type: application/json" -d {json_body} http://ccr_syncer_host:ccr_syncer_port/operator\n')),(0,r.yg)("p",null,"json_body: \u4ee5 json \u7684\u683c\u5f0f\u53d1\u9001\u64cd\u4f5c\u6240\u9700\u4fe1\u606f "),(0,r.yg)("p",null,"operator\uff1a\u5bf9\u5e94 Syncer \u7684\u4e0d\u540c\u64cd\u4f5c"),(0,r.yg)("p",null,"\u6240\u4ee5\u63a5\u53e3\u8fd4\u56de\u90fd\u662f json, \u5982\u679c\u6210\u529f\u5219\u662f\u5176\u4e2d success \u5b57\u6bb5\u4e3a true, \u7c7b\u4f3c\uff0c\u9519\u8bef\u7684\u65f6\u5019\uff0c\u662f false\uff0c\u7136\u540e\u5b58\u5728",(0,r.yg)("inlineCode",{parentName:"p"},"ErrMsgs"),"\u5b57\u6bb5"),(0,r.yg)("pre",null,(0,r.yg)("code",{parentName:"pre",className:"language-JSON"},'{"success":true}\n\nor\n\n{"success":false,"error_msg":"job ccr_test not exist"}\n')),(0,r.yg)("h3",{id:"operators"},"operators"),(0,r.yg)("ul",null,(0,r.yg)("li",{parentName:"ul"},"create_ccr ")),(0,r.yg)("p",null,"\u200b \u521b\u5efa CCR \u4efb\u52a1"),(0,r.yg)("pre",null,(0,r.yg)("code",{parentName:"pre"},'```Bash\ncurl -X POST -H "Content-Type: application/json" -d \'{\n "name": "ccr_test",\n "src": {\n "host": "localhost",\n "port": "9030",\n "thrift_port": "9020",\n "user": "root",\n "password": "",\n "database": "demo",\n "table": "example_tbl"\n },\n "dest": {\n "host": "localhost",\n "port": "9030",\n "thrift_port": "9020",\n "user": "root",\n "password": "",\n "database": "ccrt",\n "table": "copy"\n }\n}\' http://127.0.0.1:9190/create_ccr\n```\n')),(0,r.yg)("ul",null,(0,r.yg)("li",{parentName:"ul"},(0,r.yg)("p",{parentName:"li"},"name: CCR \u540c\u6b65\u4efb\u52a1\u7684\u540d\u79f0\uff0c\u552f\u4e00\u5373\u53ef")),(0,r.yg)("li",{parentName:"ul"},(0,r.yg)("p",{parentName:"li"},"host\u3001port\uff1a\u5bf9\u5e94\u96c6\u7fa4 master \u7684 host \u548c mysql(jdbc) \u7684\u7aef\u53e3")),(0,r.yg)("li",{parentName:"ul"},(0,r.yg)("p",{parentName:"li"},"thrift_port\uff1a\u5bf9\u5e94 FE \u7684 rpc_port")),(0,r.yg)("li",{parentName:"ul"},(0,r.yg)("p",{parentName:"li"},"user\u3001password\uff1asyncer \u4ee5\u4f55\u79cd\u8eab\u4efd\u53bb\u5f00\u542f\u4e8b\u52a1\u3001\u62c9\u53d6\u6570\u636e\u7b49")),(0,r.yg)("li",{parentName:"ul"},(0,r.yg)("p",{parentName:"li"},"database\u3001table\uff1a"),(0,r.yg)("ul",{parentName:"li"},(0,r.yg)("li",{parentName:"ul"},(0,r.yg)("p",{parentName:"li"},"\u5982\u679c\u662f db \u7ea7\u522b\u7684\u540c\u6b65\uff0c\u5219\u586b\u5165 dbName\uff0ctableName \u4e3a\u7a7a")),(0,r.yg)("li",{parentName:"ul"},(0,r.yg)("p",{parentName:"li"},"\u5982\u679c\u662f\u8868\u7ea7\u522b\u540c\u6b65\uff0c\u5219\u9700\u8981\u586b\u5165 dbName\u3001tableName")))),(0,r.yg)("li",{parentName:"ul"},(0,r.yg)("p",{parentName:"li"},"get_lag"))),(0,r.yg)("p",null,"\u200b \u67e5\u770b\u540c\u6b65\u8fdb\u5ea6"),(0,r.yg)("pre",null,(0,r.yg)("code",{parentName:"pre"},'```Bash\ncurl -X POST -H "Content-Type: application/json" -d \'{\n "name": "job_name"\n}\' http://ccr_syncer_host:ccr_syncer_port/get_lag\n```\n')),(0,r.yg)("p",null,"\u200b \u5176\u4e2d job_name \u662f create_ccr \u65f6\u521b\u5efa\u7684 name"),(0,r.yg)("ul",null,(0,r.yg)("li",{parentName:"ul"},"pause")),(0,r.yg)("p",null,"\u200b \u6682\u505c\u540c\u6b65\u4efb\u52a1"),(0,r.yg)("pre",null,(0,r.yg)("code",{parentName:"pre"},'```Bash\ncurl -X POST -H "Content-Type: application/json" -d \'{\n "name": "job_name"\n}\' http://ccr_syncer_host:ccr_syncer_port/pause \n```\n')),(0,r.yg)("ul",null,(0,r.yg)("li",{parentName:"ul"},"resume")),(0,r.yg)("p",null,"\u200b \u6062\u590d\u540c\u6b65\u4efb\u52a1"),(0,r.yg)("pre",null,(0,r.yg)("code",{parentName:"pre"},'```Bash\ncurl -X POST -H "Content-Type: application/json" -d \'{\n "name": "job_name"\n}\' http://ccr_syncer_host:ccr_syncer_port/resume\n```\n')),(0,r.yg)("ul",null,(0,r.yg)("li",{parentName:"ul"},"delete")),(0,r.yg)("p",null,"\u200b \u5220\u9664\u540c\u6b65\u4efb\u52a1"),(0,r.yg)("pre",null,(0,r.yg)("code",{parentName:"pre"},'```Bash\ncurl -X POST -H "Content-Type: application/json" -d \'{\n "name": "job_name"\n}\' http://ccr_syncer_host:ccr_syncer_port/delete\n```\n')),(0,r.yg)("ul",null,(0,r.yg)("li",{parentName:"ul"},(0,r.yg)("p",{parentName:"li"},"version"),(0,r.yg)("p",{parentName:"li"}," \u83b7\u53d6\u7248\u672c\u4fe1\u606f"),(0,r.yg)("pre",{parentName:"li"},(0,r.yg)("code",{parentName:"pre",className:"language-Bash"},'curl http://ccr_syncer_host:ccr_syncer_port/version\n\n# > return\n{"version": "2.0.1"}\n'))),(0,r.yg)("li",{parentName:"ul"},(0,r.yg)("p",{parentName:"li"},"job status"),(0,r.yg)("p",{parentName:"li"}," \u67e5\u770b job \u7684\u72b6\u6001"),(0,r.yg)("pre",{parentName:"li"},(0,r.yg)("code",{parentName:"pre",className:"language-Bash"},'curl -X POST -H "Content-Type: application/json" -d \'{\n "name": "job_name"\n}\' http://ccr_syncer_host:ccr_syncer_port/job_status\n\n{\n"success": true,\n"status": {\n "name": "ccr_db_table_alias",\n "state": "running",\n "progress_state": "TableIncrementalSync"\n}\n}\n'))),(0,r.yg)("li",{parentName:"ul"},(0,r.yg)("p",{parentName:"li"},"desync job"),(0,r.yg)("p",{parentName:"li"}," \u4e0d\u505a sync\uff0c\u6b64\u65f6\u7528\u6237\u53ef\u4ee5\u5c06\u6e90\u548c\u76ee\u7684\u96c6\u7fa4\u4e92\u6362"),(0,r.yg)("pre",{parentName:"li"},(0,r.yg)("code",{parentName:"pre",className:"language-Bash"},'curl -X POST -H "Content-Type: application/json" -d \'{\n "name": "job_name"\n}\' http://ccr_syncer_host:ccr_syncer_port/desync\n'))),(0,r.yg)("li",{parentName:"ul"},(0,r.yg)("p",{parentName:"li"},"list_jobs"),(0,r.yg)("p",{parentName:"li"}," \u5c55\u793a\u5df2\u7ecf\u521b\u5efa\u7684\u6240\u6709\u4efb\u52a1"),(0,r.yg)("pre",{parentName:"li"},(0,r.yg)("code",{parentName:"pre",className:"language-Bash"},'curl http://ccr_syncer_host:ccr_syncer_port/list_jobs\n\n{"success":true,"jobs":["ccr_db_table_alias"]}\n')))),(0,r.yg)("h3",{id:"\u5f00\u542f\u5e93\u4e2d\u6240\u6709\u8868\u7684-binlog"},"\u5f00\u542f\u5e93\u4e2d\u6240\u6709\u8868\u7684 binlog"),(0,r.yg)("p",null,(0,r.yg)("strong",{parentName:"p"},"\u8f93\u51fa\u8def\u5f84\u4e0b\u7684\u6587\u4ef6\u7ed3\u6784")),(0,r.yg)("p",null,"\u5728\u7f16\u8bd1\u5b8c\u6210\u540e\u7684\u8f93\u51fa\u8def\u5f84\u4e0b\uff0c\u6587\u4ef6\u7ed3\u6784\u5927\u81f4\u5982\u4e0b\u6240\u793a\uff1a"),(0,r.yg)("pre",null,(0,r.yg)("code",{parentName:"pre",className:"language-Bash"},"output_dir\n bin\n ccr_syncer\n enable_db_binlog.sh\n start_syncer.sh\n stop_syncer.sh\n db\n [ccr.db] # \u9ed8\u8ba4\u914d\u7f6e\u4e0b\u8fd0\u884c\u540e\u751f\u6210\n log\n [ccr_syncer.log] # \u9ed8\u8ba4\u914d\u7f6e\u4e0b\u8fd0\u884c\u540e\u751f\u6210\n")),(0,r.yg)("admonition",{type:"caution"},(0,r.yg)("p",{parentName:"admonition"},(0,r.yg)("strong",{parentName:"p"},"\u540e\u6587\u4e2d\u7684 enable_db_binlog.sh \u6307\u7684\u662f\u8be5\u8def\u5f84\u4e0b\u7684 enable_db_binlog.sh\uff01\uff01\uff01"))),(0,r.yg)("p",null,(0,r.yg)("strong",{parentName:"p"},"\u4f7f\u7528\u8bf4\u660e")),(0,r.yg)("pre",null,(0,r.yg)("code",{parentName:"pre",className:"language-Bash"},"bash bin/enable_db_binlog.sh -h host -p port -u user -P password -d db\n")),(0,r.yg)("h2",{id:"syncer-\u9ad8\u53ef\u7528"},"Syncer \u9ad8\u53ef\u7528"),(0,r.yg)("p",null,"Syncer \u9ad8\u53ef\u7528\u4f9d\u8d56 mysql\uff0c\u5982\u679c\u4f7f\u7528 mysql \u4f5c\u4e3a\u540e\u7aef\u5b58\u50a8\uff0cSyncer \u53ef\u4ee5\u53d1\u73b0\u5176\u5b83 syncer\uff0c\u5982\u679c\u4e00\u4e2a crash \u4e86\uff0c\u5176\u4ed6\u4f1a\u5206\u62c5\u4ed6\u7684\u4efb\u52a1"),(0,r.yg)("h3",{id:"\u6743\u9650\u8981\u6c42"},"\u6743\u9650\u8981\u6c42"),(0,r.yg)("ol",null,(0,r.yg)("li",{parentName:"ol"},(0,r.yg)("p",{parentName:"li"},"Select_priv \u5bf9\u6570\u636e\u5e93\u3001\u8868\u7684\u53ea\u8bfb\u6743\u9650\u3002")),(0,r.yg)("li",{parentName:"ol"},(0,r.yg)("p",{parentName:"li"},"Load_priv \u5bf9\u6570\u636e\u5e93\u3001\u8868\u7684\u5199\u6743\u9650\u3002\u5305\u62ec Load\u3001Insert\u3001Delete \u7b49\u3002")),(0,r.yg)("li",{parentName:"ol"},(0,r.yg)("p",{parentName:"li"},"Alter_priv \u5bf9\u6570\u636e\u5e93\u3001\u8868\u7684\u66f4\u6539\u6743\u9650\u3002\u5305\u62ec\u91cd\u547d\u540d \u5e93/\u8868\u3001\u6dfb\u52a0/\u5220\u9664/\u53d8\u66f4 \u5217\u3001\u6dfb\u52a0/\u5220\u9664 \u5206\u533a\u7b49\u64cd\u4f5c\u3002")),(0,r.yg)("li",{parentName:"ol"},(0,r.yg)("p",{parentName:"li"},"Create_priv \u521b\u5efa\u6570\u636e\u5e93\u3001\u8868\u3001\u89c6\u56fe\u7684\u6743\u9650\u3002")),(0,r.yg)("li",{parentName:"ol"},(0,r.yg)("p",{parentName:"li"},"Drop_priv \u5220\u9664\u6570\u636e\u5e93\u3001\u8868\u3001\u89c6\u56fe\u7684\u6743\u9650\u3002"))),(0,r.yg)("p",null,"\u52a0\u4e0a Admin \u6743\u9650 (\u4e4b\u540e\u8003\u8651\u5f7b\u5e95\u79fb\u9664), \u8fd9\u4e2a\u662f\u7528\u6765\u68c0\u6d4b enable binlog config \u7684\uff0c\u73b0\u5728\u9700\u8981 admin"),(0,r.yg)("h2",{id:"\u4f7f\u7528\u9650\u5236"},"\u4f7f\u7528\u9650\u5236"),(0,r.yg)("h3",{id:"\u7f51\u7edc\u7ea6\u675f"},"\u7f51\u7edc\u7ea6\u675f"),(0,r.yg)("ul",null,(0,r.yg)("li",{parentName:"ul"},(0,r.yg)("p",{parentName:"li"},"\u9700\u8981 Syncer \u4e0e\u4e0a\u4e0b\u6e38\u7684 FE \u548c BE \u90fd\u662f\u901a\u7684")),(0,r.yg)("li",{parentName:"ul"},(0,r.yg)("p",{parentName:"li"},"\u4e0b\u6e38 BE \u4e0e\u4e0a\u6e38 BE \u662f\u901a\u7684")),(0,r.yg)("li",{parentName:"ul"},(0,r.yg)("p",{parentName:"li"},"\u5bf9\u5916 IP \u548c Doris \u5185\u90e8 IP \u662f\u4e00\u6837\u7684\uff0c\u4e5f\u5c31\u662f\u8bf4",(0,r.yg)("inlineCode",{parentName:"p"},"show frontends/backends"),"\u770b\u5230\u7684\uff0c\u548c\u80fd\u76f4\u63a5\u8fde\u7684 IP \u662f\u4e00\u81f4\u7684\uff0c\u8981\u662f\u76f4\u8fde\uff0c\u4e0d\u80fd\u662f IP \u8f6c\u53d1\u6216\u8005 nat"))),(0,r.yg)("h3",{id:"thriftpool-\u9650\u5236"},"ThriftPool \u9650\u5236"),(0,r.yg)("p",null,"\u5f00\u5927 thrift thread pool \u5927\u5c0f\uff0c\u6700\u597d\u662f\u8d85\u8fc7\u4e00\u6b21 commit \u7684 bucket \u6570\u76ee\u5927\u5c0f"),(0,r.yg)("h3",{id:"\u7248\u672c\u8981\u6c42"},"\u7248\u672c\u8981\u6c42"),(0,r.yg)("p",null,"\u7248\u672c\u6700\u4f4e\u8981\u6c42\uff1av2.0.3"),(0,r.yg)("h3",{id:"\u4e0d\u652f\u6301\u7684\u64cd\u4f5c"},"\u4e0d\u652f\u6301\u7684\u64cd\u4f5c"),(0,r.yg)("ul",null,(0,r.yg)("li",{parentName:"ul"},(0,r.yg)("p",{parentName:"li"},"rename table \u652f\u6301\u6709\u70b9\u95ee\u9898")),(0,r.yg)("li",{parentName:"ul"},(0,r.yg)("p",{parentName:"li"},"\u4e0d\u652f\u6301\u4e00\u4e9b trash \u7684\u64cd\u4f5c\uff0c\u6bd4\u5982 table \u7684 drop-recovery \u64cd\u4f5c")),(0,r.yg)("li",{parentName:"ul"},(0,r.yg)("p",{parentName:"li"},"\u548c rename table \u6709\u5173\u7684\uff0creplace partition \u4e0e")),(0,r.yg)("li",{parentName:"ul"},(0,r.yg)("p",{parentName:"li"},"\u4e0d\u80fd\u53d1\u751f\u5728\u540c\u4e00\u4e2a db \u4e0a\u540c\u65f6 backup/restore"))),(0,r.yg)("h2",{id:"feature"},"Feature"),(0,r.yg)("h3",{id:"\u9650\u901f"},"\u9650\u901f"),(0,r.yg)("p",null,"BE \u7aef\u914d\u7f6e\u53c2\u6570"),(0,r.yg)("pre",null,(0,r.yg)("code",{parentName:"pre",className:"language-Bash"},"download_binlog_rate_limit_kbs=1024 # \u8fd9\u5c31\u662f\u9650\u5236\u52301MB\uff0c\u8fd9\u4e2a\u662f\u5355\u4e2abe\u5bf9\u6240\u6709\u5173\u4e8ebinlog \u5305\u62eclocal snapshot\u7684\u914d\u7f6e\n")),(0,r.yg)("h2",{id:"is_being_synced-\u5c5e\u6027"},"IS_BEING_SYNCED \u5c5e\u6027"),(0,r.yg)("p",null,'\u4ece Doris v2.0 "is_being_synced" = "true"'),(0,r.yg)("p",null,"CCR \u529f\u80fd\u5728\u5efa\u7acb\u540c\u6b65\u65f6\uff0c\u4f1a\u5728\u76ee\u6807\u96c6\u7fa4\u4e2d\u521b\u5efa\u6e90\u96c6\u7fa4\u540c\u6b65\u8303\u56f4\u4e2d\u8868\uff08\u540e\u79f0\u6e90\u8868\uff0c\u4f4d\u4e8e\u6e90\u96c6\u7fa4\uff09\u7684\u526f\u672c\u8868\uff08\u540e\u79f0\u76ee\u6807\u8868\uff0c\u4f4d\u4e8e\u76ee\u6807\u96c6\u7fa4\uff09\uff0c\u4f46\u662f\u5728\u521b\u5efa\u526f\u672c\u8868\u65f6\u9700\u8981\u5931\u6548\u6216\u8005\u64e6\u9664\u4e00\u4e9b\u529f\u80fd\u548c\u5c5e\u6027\u4ee5\u4fdd\u8bc1\u540c\u6b65\u8fc7\u7a0b\u4e2d\u7684\u6b63\u786e\u6027\u3002"),(0,r.yg)("p",null,"\u5982\uff1a"),(0,r.yg)("ul",null,(0,r.yg)("li",{parentName:"ul"},(0,r.yg)("p",{parentName:"li"},"\u6e90\u8868\u4e2d\u5305\u542b\u4e86\u53ef\u80fd\u6ca1\u6709\u88ab\u540c\u6b65\u5230\u76ee\u6807\u96c6\u7fa4\u7684\u4fe1\u606f\uff0c\u5982",(0,r.yg)("inlineCode",{parentName:"p"},"storage_policy"),"\u7b49\uff0c\u53ef\u80fd\u4f1a\u5bfc\u81f4\u76ee\u6807\u8868\u521b\u5efa\u5931\u8d25\u6216\u8005\u884c\u4e3a\u5f02\u5e38\u3002")),(0,r.yg)("li",{parentName:"ul"},(0,r.yg)("p",{parentName:"li"},"\u6e90\u8868\u4e2d\u53ef\u80fd\u5305\u542b\u4e00\u4e9b\u52a8\u6001\u529f\u80fd\uff0c\u5982\u52a8\u6001\u5206\u533a\u7b49\uff0c\u53ef\u80fd\u5bfc\u81f4\u76ee\u6807\u8868\u7684\u884c\u4e3a\u4e0d\u53d7 syncer \u63a7\u5236\u5bfc\u81f4 partition \u4e0d\u4e00\u81f4\u3002"))),(0,r.yg)("p",null,"\u5728\u88ab\u590d\u5236\u65f6\u56e0\u5931\u6548\u800c\u9700\u8981\u64e6\u9664\u7684\u5c5e\u6027\u6709\uff1a"),(0,r.yg)("ul",null,(0,r.yg)("li",{parentName:"ul"},(0,r.yg)("p",{parentName:"li"},(0,r.yg)("inlineCode",{parentName:"p"},"storage_policy"))),(0,r.yg)("li",{parentName:"ul"},(0,r.yg)("p",{parentName:"li"},(0,r.yg)("inlineCode",{parentName:"p"},"colocate_with")))),(0,r.yg)("p",null,"\u5728\u88ab\u540c\u6b65\u65f6\u9700\u8981\u5931\u6548\u7684\u529f\u80fd\u6709\uff1a"),(0,r.yg)("ul",null,(0,r.yg)("li",{parentName:"ul"},(0,r.yg)("p",{parentName:"li"},"\u81ea\u52a8\u5206\u6876")),(0,r.yg)("li",{parentName:"ul"},(0,r.yg)("p",{parentName:"li"},"\u52a8\u6001\u5206\u533a"))),(0,r.yg)("h3",{id:"\u5b9e\u73b0"},"\u5b9e\u73b0"),(0,r.yg)("p",null,"\u5728\u521b\u5efa\u76ee\u6807\u8868\u65f6\uff0c\u8fd9\u6761\u5c5e\u6027\u5c06\u4f1a\u7531 syncer \u63a7\u5236\u6dfb\u52a0\u6216\u8005\u5220\u9664\uff0c\u5728 CCR \u529f\u80fd\u4e2d\uff0c\u521b\u5efa\u4e00\u4e2a\u76ee\u6807\u8868\u6709\u4e24\u4e2a\u9014\u5f84\uff1a"),(0,r.yg)("ol",null,(0,r.yg)("li",{parentName:"ol"},(0,r.yg)("p",{parentName:"li"},"\u5728\u8868\u540c\u6b65\u65f6\uff0csyncer \u901a\u8fc7 backup/restore \u7684\u65b9\u5f0f\u5bf9\u6e90\u8868\u8fdb\u884c\u5168\u91cf\u590d\u5236\u6765\u5f97\u5230\u76ee\u6807\u8868\u3002")),(0,r.yg)("li",{parentName:"ol"},(0,r.yg)("p",{parentName:"li"},"\u5728\u5e93\u540c\u6b65\u65f6\uff0c\u5bf9\u4e8e\u5b58\u91cf\u8868\u800c\u8a00\uff0csyncer \u540c\u6837\u901a\u8fc7 backup/restore \u7684\u65b9\u5f0f\u6765\u5f97\u5230\u76ee\u6807\u8868\uff0c\u5bf9\u4e8e\u589e\u91cf\u8868\u800c\u8a00\uff0csyncer \u4f1a\u901a\u8fc7\u643a\u5e26\u6709 CreateTableRecord \u7684 binlog \u6765\u521b\u5efa\u76ee\u6807\u8868\u3002"))),(0,r.yg)("p",null,"\u7efc\u4e0a\uff0c\u5bf9\u4e8e\u63d2\u5165",(0,r.yg)("inlineCode",{parentName:"p"},"is_being_synced"),"\u5c5e\u6027\u6709\u4e24\u4e2a\u5207\u5165\u70b9\uff1a\u5168\u91cf\u540c\u6b65\u4e2d\u7684 restore \u8fc7\u7a0b\u548c\u589e\u91cf\u540c\u6b65\u65f6\u7684 getDdlStmt\u3002"),(0,r.yg)("p",null,"\u5728\u5168\u91cf\u540c\u6b65\u7684 restore \u8fc7\u7a0b\u4e2d\uff0csyncer \u4f1a\u901a\u8fc7 rpc \u53d1\u8d77\u5bf9\u539f\u96c6\u7fa4\u4e2d snapshot \u7684 restore\uff0c\u5728\u8fd9\u4e2a\u8fc7\u7a0b\u4e2d\u4e3a\u4f1a\u4e3a RestoreStmt \u6dfb\u52a0",(0,r.yg)("inlineCode",{parentName:"p"},"is_being_synced"),"\u5c5e\u6027\uff0c\u5e76\u5728\u6700\u7ec8\u7684 restoreJob \u4e2d\u751f\u6548\uff0c\u6267\u884c",(0,r.yg)("inlineCode",{parentName:"p"},"isBeingSynced"),"\u7684\u76f8\u5173\u903b\u8f91\u3002\u5728\u589e\u91cf\u540c\u6b65\u65f6\u7684 getDdlStmt \u4e2d\uff0c\u4e3a getDdlStmt \u65b9\u6cd5\u6dfb\u52a0\u53c2\u6570",(0,r.yg)("inlineCode",{parentName:"p"},"boolean getDdlForSync"),"\uff0c\u4ee5\u533a\u5206\u662f\u5426\u4e3a\u53d7\u63a7\u8f6c\u5316\u4e3a\u76ee\u6807\u8868 ddl \u7684\u64cd\u4f5c\uff0c\u5e76\u5728\u521b\u5efa\u76ee\u6807\u8868\u65f6\u6267\u884c",(0,r.yg)("inlineCode",{parentName:"p"},"isBeingSynced"),"\u7684\u76f8\u5173\u903b\u8f91\u3002"),(0,r.yg)("p",null,"\u5bf9\u4e8e\u5931\u6548\u5c5e\u6027\u7684\u64e6\u9664\u65e0\u9700\u591a\u8a00\uff0c\u5bf9\u4e8e\u4e0a\u8ff0\u529f\u80fd\u7684\u5931\u6548\u9700\u8981\u8fdb\u884c\u8bf4\u660e\uff1a"),(0,r.yg)("ul",null,(0,r.yg)("li",{parentName:"ul"},(0,r.yg)("p",{parentName:"li"},"\u81ea\u52a8\u5206\u6876 \u81ea\u52a8\u5206\u6876\u4f1a\u5728\u521b\u5efa\u8868\u65f6\u751f\u6548\uff0c\u8ba1\u7b97\u5f53\u524d\u5408\u9002\u7684 bucket \u6570\u91cf\uff0c\u8fd9\u5c31\u53ef\u80fd\u5bfc\u81f4\u6e90\u8868\u548c\u76ee\u7684\u8868\u7684 bucket \u6570\u76ee\u4e0d\u4e00\u81f4\u3002\u56e0\u6b64\u5728\u540c\u6b65\u65f6\u9700\u8981\u83b7\u5f97\u6e90\u8868\u7684 bucket \u6570\u76ee\uff0c\u5e76\u4e14\u4e5f\u8981\u83b7\u5f97\u6e90\u8868\u662f\u5426\u4e3a\u81ea\u52a8\u5206\u6876\u8868\u7684\u4fe1\u606f\u4ee5\u4fbf\u7ed3\u675f\u540c\u6b65\u540e\u6062\u590d\u529f\u80fd\u3002\u5f53\u524d\u7684\u505a\u6cd5\u662f\u5728\u83b7\u53d6 distribution \u4fe1\u606f\u65f6\u9ed8\u8ba4 autobucket \u4e3a false\uff0c\u5728\u6062\u590d\u8868\u65f6\u901a\u8fc7\u68c0\u67e5",(0,r.yg)("inlineCode",{parentName:"p"},"_auto_bucket"),"\u5c5e\u6027\u6765\u5224\u65ad\u6e90\u8868\u662f\u5426\u4e3a\u81ea\u52a8\u5206\u6876\u8868\uff0c\u5982\u662f\u5219\u5c06\u76ee\u6807\u8868\u7684 autobucket \u5b57\u6bb5\u8bbe\u7f6e\u4e3a true\uff0c\u4ee5\u6b64\u6765\u8fbe\u5230\u8df3\u8fc7\u8ba1\u7b97 bucket \u6570\u91cf\uff0c\u76f4\u63a5\u5e94\u7528\u6e90\u8868 bucket \u6570\u91cf\u7684\u76ee\u7684\u3002")),(0,r.yg)("li",{parentName:"ul"},(0,r.yg)("p",{parentName:"li"},"\u52a8\u6001\u5206\u533a \u52a8\u6001\u5206\u533a\u5219\u662f\u901a\u8fc7\u5c06",(0,r.yg)("inlineCode",{parentName:"p"},"olapTable.isBeingSynced()"),"\u6dfb\u52a0\u5230\u662f\u5426\u6267\u884c add/drop partition \u7684\u5224\u65ad\u4e2d\u6765\u5b9e\u73b0\u7684\uff0c\u8fd9\u6837\u76ee\u6807\u8868\u5728\u88ab\u540c\u6b65\u7684\u8fc7\u7a0b\u4e2d\u5c31\u4e0d\u4f1a\u5468\u671f\u6027\u7684\u6267\u884c add/drop partition \u64cd\u4f5c\u3002"))),(0,r.yg)("h3",{id:"\u6ce8\u610f"},"\u6ce8\u610f"),(0,r.yg)("p",null,"\u5728\u672a\u51fa\u73b0\u5f02\u5e38\u65f6\uff0c",(0,r.yg)("inlineCode",{parentName:"p"},"is_being_synced"),"\u5c5e\u6027\u5e94\u8be5\u5b8c\u5168\u7531 syncer \u63a7\u5236\u5f00\u542f\u6216\u5173\u95ed\uff0c\u7528\u6237\u4e0d\u8981\u81ea\u884c\u4fee\u6539\u8be5\u5c5e\u6027\u3002"))}c.isMDXComponent=!0},815225:(e,n,a)=>{a.d(n,{A:()=>l});const l=a.p+"assets/images/ccr-architecture-description-555f71e6eddcf0a744f55c0e0b12eb4a.png"}}]);