




版權(quán)說(shuō)明:本文檔由用戶(hù)提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權(quán),請(qǐng)進(jìn)行舉報(bào)或認(rèn)領(lǐng)
文檔簡(jiǎn)介
1、DataX3.0使用手冊(cè)目錄一、dataX概述11dataX作用12DataX3.0框架設(shè)計(jì)23DataX3.0插件體系2二、dataX安裝31創(chuàng)建用戶(hù)組及用戶(hù)32環(huán)境變量配置43安裝python4三、dataX使用41生成配置文件模板42配置定時(shí)任務(wù)73常見(jiàn)問(wèn)題及處理8四、dataX插件開(kāi)發(fā)及安裝81.Reader插件開(kāi)發(fā)82.Writter插件開(kāi)發(fā)93.插件部署10一、 dataX概述1 dataX作用DataX 是一個(gè)異構(gòu)數(shù)據(jù)源離線(xiàn)同步工具,致力于實(shí)現(xiàn)包括關(guān)系型數(shù)據(jù)庫(kù)(MySQL、Oracle等)、HDFS、Hive、ODPS、HBase、FTP等各種異構(gòu)數(shù)據(jù)源之間穩(wěn)定高效的數(shù)據(jù)同步功能
2、。為了解決異構(gòu)數(shù)據(jù)源同步問(wèn)題,DataX將復(fù)雜的網(wǎng)狀的同步鏈路變成了星型數(shù)據(jù)鏈路,DataX作為中間傳輸載體負(fù)責(zé)連接各種數(shù)據(jù)源。當(dāng)需要接入一個(gè)新的數(shù)據(jù)源的時(shí)候,只需要將此數(shù)據(jù)源對(duì)接到DataX,便能跟已有的數(shù)據(jù)源做到無(wú)縫數(shù)據(jù)同步。2 DataX3.0框架設(shè)計(jì)DataX本身作為離線(xiàn)數(shù)據(jù)同步框架,采用Framework + plugin架構(gòu)構(gòu)建。將數(shù)據(jù)源讀取和寫(xiě)入抽象成為Reader/Writer插件,納入到整個(gè)同步框架中。Reader:Reader為數(shù)據(jù)采集模塊,負(fù)責(zé)采集數(shù)據(jù)源的數(shù)據(jù),將數(shù)據(jù)發(fā)送給Framework。Writer: Writer為數(shù)據(jù)寫(xiě)入模塊,負(fù)責(zé)不斷向Framework取數(shù)據(jù),
3、并將數(shù)據(jù)寫(xiě)入到目的端。Framework:Framework用于連接reader和writer,作為兩者的數(shù)據(jù)傳輸通道,并處理緩沖,流控,并發(fā),數(shù)據(jù)轉(zhuǎn)換等核心技術(shù)問(wèn)題。3 DataX3.0插件體系類(lèi)型數(shù)據(jù)源Reader(讀)Writer(寫(xiě))RDBMS 關(guān)系型數(shù)據(jù)庫(kù)MySQL Oracle SQL Server PostgreSQL 達(dá)夢(mèng) 通用RDBMS(支持所有關(guān)系型數(shù)據(jù)庫(kù))阿里云數(shù)倉(cāng)數(shù)據(jù)存儲(chǔ)MaxCompute(原ODPS) Analytic DB(原ADS) OSS 云數(shù)據(jù)庫(kù)Memcache版(原
4、OCS)HiveNoSQL數(shù)據(jù)存儲(chǔ)Table Store(原OTS) Hbase0.94 Hbase1.1 MongoDB無(wú)結(jié)構(gòu)化數(shù)據(jù)存儲(chǔ)TxtFileJsonFile FTP HDFS二、 dataX安裝1 創(chuàng)建用戶(hù)組及用戶(hù)roothmaster-hdfs:/home/ubuntu# groupadd dataxroothmaster-hdfs:/home/ubuntu# useradd -g datax datax -m -d /home/dataxroothmaster-hdfs:/home/ubuntu# passwd dataxEnt
5、er new UNIX password: Retype new UNIX password: passwd: password updated successfullyroothmaster-hdfs:/home/ubuntu# usermod -G adm -a dataxroothmaster-hdfs:/home/ubuntu# su - dataxdataxhmaster-hdfs:$ iduid=1004(datax) gid=1000(ubuntu) groups=1000(ubuntu),4(adm),1002(datax)2 環(huán)境變量配置export JRE_HOME=$JA
6、VA_HOME/jreexport CLASSPATH=.:$JAVA_HOME/lib:$JRE_HOME/libexport PATH=$JAVA_HOME/binexport LANG=zh_CN.UTF-83 安裝pythondataxhmaster-hdfs:/home/ubuntu$ pythonPython 2.7.6 (default, Jun 22 2015, 17:58:13) GCC 4.8.2 on linux2Type "help", "copyright", "credits" or "licen
7、se" for more information.三、 dataX使用1 生成配置文件模板命令:bin/python datax.py -r YOUR_READER -w YOUR_WRITER案例1:mysqlreader-> mysqlwriterdataxhmaster-hdfs:/datax3/datax/bin$ python datax.py -r mysqlreader -w mysqlwriterDataX (DATAX-OPENSOURCE-1.0), From Alibaba !Copyright (C) 2010-2015, Alibaba Group.
8、All Rights Reserved.Please refer to the mysqlreader document: Please refer to the mysqlwriter document: Please save the following configuration as a json file and use python DATAX_HOME/bin/datax.py JSON_FILE_NAME.json to run the job. "job": "content": "reader": "na
9、me": "mysqlreader", "parameter": "column": , "connection": "jdbcUrl": , "table": , "password": "", "username": "", "where": "" , "writer": "name": "my
10、sqlwriter", "parameter": "column": , "connection": "jdbcUrl": "", "table": , "password": "", "preSql": , "session": , "username": "", "writeMode": "" , &qu
11、ot;setting": "speed": "channel": "" 案例2:jsonfilereader-> hbasewriterdataxhmaster-hdfs:/datax3/datax/bin$ python datax.py -r jsonfilereader -w hbasewriter DataX (DATAX-OPENSOURCE-1.0), From Alibaba !Copyright (C) 2010-2015, Alibaba Group. All Rights Reserved.Plea
12、se refer to the jsonfilereader document: Please refer to the hbasewriter document: Please save the following configuration as a json file and use python DATAX_HOME/bin/datax.py JSON_FILE_NAME.json to run the job. "job": "content": "reader": "name": "jsonf
13、ilereader", "parameter": "column": , "compress": "zip", "encoding": "", "path": , "writer": "name": "hbase11xwriter", "parameter": "column": , "encoding": "&quo
14、t;, "hbaseConfig": "hbase.cluster.distributed": "", "hbase.rootdir": "", "hbase.zookeeper.quorum": "" , "mode": "", "rowkeyColumn": , "table": "", "versionColumn": "
15、index": "", "value": "" , "setting": "speed": "channel": "" 2 配置定時(shí)任務(wù) 創(chuàng)建任務(wù)列表文件dataxhmaster-hdfs:/datax3/datax/task$ vi crontab.tasks.txt 20,30,40 0-23 * * * /usr/bin/python /home/datax/datax3/datax/bin/datax.py /home/da
16、tax/datax3/datax/job/jsonfile2hbase_fullry_log.terminal_log.json >/data/datax/log/datax.crontab.out.log 2>&12.2 crontab加載系統(tǒng)任務(wù)列表文件dataxhmaster-hdfs:/datax3/datax/task$ crontab crontab.tasks.txt dataxhmaster-hdfs:/datax3/datax/task$ crontab -l20,30,40 0-23 * * * /usr/bin/python /home/datax/d
17、atax3/datax/bin/datax.py /home/datax/datax3/datax/job/jsonfile2hbase_fullry_log.terminal_log.json >/data/datax/log/datax.crontab.out.log 2>&13 常見(jiàn)問(wèn)題及處理.1 /bin/sh: 1: java: not found原因:/home/datax/datax3/datax/bin/ datax.py未取到JAVA_HOME環(huán)境變量值四、 dataX插件開(kāi)發(fā)及安裝4.1. Reader插件開(kāi)發(fā)public class Js
18、onFileReader extends Readerpublic static class Job extends Reader.Job Overridepublic void init() / TODO Auto-generated method stubOverridepublic void destroy() / TODO Auto-generated method stubOverridepublic List<Configuration> split(int adviceNumber) / TODO Auto-generated method stubreturn nu
19、ll;public static class Task extends Reader.TaskOverridepublic void init() / TODO Auto-generated method stubOverridepublic void destroy() / TODO Auto-generated method stubOverridepublic void startRead(RecordSender recordSender) / TODO Auto-generated method stub2. Writter插件開(kāi)發(fā)public class JsonFileWrite
20、r extends Writer public static class Job extends Writer.Job Overridepublic void init() / TODO Auto-generated method stubOverridepublic void destroy() / TODO Auto-generated method stubOverridepublic List<Configuration> split(int mandatoryNumber) / TODO Auto-generated method stubreturn null;publ
21、ic static class Task extends Writer.Task Overridepublic void init() / TODO Auto-generated method stubOverridepublic void destroy() / TODO Auto-generated method stubOverridepublic void startWrite(RecordReceiver lineReceiver) / TODO Auto-generated method stub3. 插件部署目錄及文件說(shuō)明dataxhmaster-hdfs:/datax3/dat
22、ax/plugin/reader/jsonfilereader$ lltotal 56drwxr-xr-x 3 datax ubuntu 4096 Jul 6 16:10 ./drwxr-xr-x 21 datax ubuntu 4096 Jun 21 11:05 ./-rw-r-r- 1 datax ubuntu 36348 Jun 22 17:52 jsonfilereader.jardrwxr-xr-x 2 datax ubuntu 4096 May 16 12:46 libs/-rw- 1 datax ubuntu 315 May 16 11:24 plugin.json-rw- 1 datax ubuntu 149 May 15 18:24 plugin_job_template.jsonl jsonfilereader.jar 插件JAR包文件l
溫馨提示
- 1. 本站所有資源如無(wú)特殊說(shuō)明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請(qǐng)下載最新的WinRAR軟件解壓。
- 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請(qǐng)聯(lián)系上傳者。文件的所有權(quán)益歸上傳用戶(hù)所有。
- 3. 本站RAR壓縮包中若帶圖紙,網(wǎng)頁(yè)內(nèi)容里面會(huì)有圖紙預(yù)覽,若沒(méi)有圖紙預(yù)覽就沒(méi)有圖紙。
- 4. 未經(jīng)權(quán)益所有人同意不得將文件中的內(nèi)容挪作商業(yè)或盈利用途。
- 5. 人人文庫(kù)網(wǎng)僅提供信息存儲(chǔ)空間,僅對(duì)用戶(hù)上傳內(nèi)容的表現(xiàn)方式做保護(hù)處理,對(duì)用戶(hù)上傳分享的文檔內(nèi)容本身不做任何修改或編輯,并不能對(duì)任何下載內(nèi)容負(fù)責(zé)。
- 6. 下載文件中如有侵權(quán)或不適當(dāng)內(nèi)容,請(qǐng)與我們聯(lián)系,我們立即糾正。
- 7. 本站不保證下載資源的準(zhǔn)確性、安全性和完整性, 同時(shí)也不承擔(dān)用戶(hù)因使用這些下載資源對(duì)自己和他人造成任何形式的傷害或損失。
最新文檔
- 手術(shù)切痣后期護(hù)理常規(guī)
- 個(gè)人報(bào)稅流程規(guī)范
- 鐵皮保溫施工培訓(xùn)
- 家具設(shè)計(jì)經(jīng)典案例
- 2025年鐵路貨物運(yùn)輸服務(wù)項(xiàng)目申請(qǐng)報(bào)告模板
- 2025年金融服務(wù)項(xiàng)目立項(xiàng)申請(qǐng)報(bào)告
- 2025年河北中煙工業(yè)有限責(zé)任公司博士研究生招聘考試筆試試題(含答案)
- 2025年中央和國(guó)家機(jī)關(guān)工委所屬事業(yè)單位招聘工作人員4人筆試歷年典型考題及考點(diǎn)剖析附帶答案詳解
- 徜徉生字教學(xué)課件
- 奶油蛋糕教學(xué)課件制作
- GB/T 45719-2025半導(dǎo)體器件金屬氧化物半導(dǎo)體(MOS)晶體管的熱載流子試驗(yàn)
- 寶媽日常心理護(hù)理
- 2025年社會(huì)學(xué)概論測(cè)試題含答案(附解析)
- 2025-2030年環(huán)境工程產(chǎn)業(yè)深度調(diào)研及發(fā)展趨勢(shì)與投資戰(zhàn)略研究報(bào)告
- 2025年事業(yè)單位公開(kāi)招聘考試(E類(lèi))《綜合應(yīng)用能力西醫(yī)臨床》試卷真題及完整解析
- 2024年安徽大學(xué)專(zhuān)職輔導(dǎo)員招聘筆試真題
- GB 9743-2024轎車(chē)輪胎
- 固井工藝技術(shù)培訓(xùn)教學(xué)課件(77p)
- 入團(tuán)志愿書(shū)(2016版本)(可編輯打印標(biāo)準(zhǔn)A4) (1)
- 盤(pán)扣式腳手架模板與支撐架專(zhuān)項(xiàng)施工方案
- 消防器材購(gòu)銷(xiāo)合同2
評(píng)論
0/150
提交評(píng)論