Datax離線資料抽取(Oracle--MySQL)

z597011036發表於2019-01-29

Datax下載地址:

Datax MySQL讀: 

Datax MySQL寫: 

Datax Sql Server抽到MySQL:https://www.cnblogs.com/itar/p/9013707.html


1.下載安裝Datax軟體(必須安裝jdk 1.8版本以上) 

[root@localhost ~]# tar xvf jdk-8u65-linux-x64.tar.gz 

[root@localhost ~]# mv jdk1.8.0_151  /usr/local/jdk1.8.0_151

[root@localhost ~]# vim /etc/profile

export PATH=$PATH:/usr/local/jdk1.8.0_151/bin

[root@localhost ~]# vim /etc/ld.so.conf.d/mysql-x86_64.conf

/usr/local/jdk1.8.0_151/lib

[root@localhost ~]# tar xvf  datax.tar.gz

[root@localhost ~]# cd datax/job/


2.編輯配置檔案(首先用kettle將表結構同步過去)

[root@localhost job]# vim job1.json

{
    "job": {
        "setting": {
            "speed": {
                "channel": 5
            }
        },
        "content": [
            {
                "reader": {
                    "name": "oraclereader",
                    "parameter": {
                        "username": "upcenter",
                        "password": "upcenter",
                        "column": ["*"],
                        "connection": [
                           {
                              "table": ["STOCK_CONC"],
                              "jdbcUrl": ["jdbc:oracle:thin:@192.168.7.7:1521:upqc"]
                           }
                        ]
                    }
                },
                "writer": {
                    "name": "mysqlwriter",
                    "parameter": {
                        "writeMode": "update",
                        "username": "wangying",
                        "password": "wangying",
                        "column": ["*"],
                        "connection": [
                            {
                               "jdbcUrl": "jdbc:mysql://172.16.8.93:3306/db_stktag",
                               "table": ["t3"]
                            }
                        ]
                      }
                    }
                }
        ]
    }
}

[root@localhost job]#


3.資料抽取

[root@localhost job]# python2 /root/datax/bin/datax.py job1.json

DataX (DATAX-OPENSOURCE-3.0), From Alibaba !

Copyright (C) 2010-2017, Alibaba Group. All Rights Reserved.

2019-01-29 14:23:53.177 [main] INFO  VMInfo - VMInfo# operatingSystem class => sun.management.OperatingSystemImpl

2019-01-29 14:23:53.186 [main] INFO  Engine - the machine info  => 

osInfo: Oracle Corporation 1.8 25.151-b12

jvmInfo: Linux amd64 3.10.0-123.el7.x86_64

cpu num: 8

totalPhysicalMemory: -0.00G

freePhysicalMemory: -0.00G

maxFileDescriptorCount: -1

currentOpenFileDescriptorCount: -1

。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。

。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。

2019-01-29 14:24:04.012 [job-0] INFO  JobContainer - 

任務啟動時刻                    : 2019-01-29 14:23:53

任務結束時刻                    : 2019-01-29 14:24:04

任務總計耗時                    :                 10s

任務平均流量                    :          176.48KB/s

記錄寫入速度                    :           4047rec/s

讀出記錄總數                    :               40475

讀寫失敗總數                    :                   0

[root@localhost job]#


4.驗證資料

mysql> select count(1) from t3;

+----------+

| count(1) |

+----------+

|    40475 |

+----------+

1 row in set (0.03 sec)

mysql> 


來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/25854343/viewspace-2565145/,如需轉載,請註明出處,否則將追究法律責任。

相關文章