win10 安装DataX

win10 安装DataX

1.资源准备

2.环境变量配置(以自己安装目录为准)

3.在cmd窗口中输入CHCP 65001 防止中文乱码

4.测试(从stream读取数据并打印到控制台)

对人工智能感兴趣的同学,可以点击以下链接:

现在人工智能非常火爆,很多朋友都想学,但是一般的教程都是为博硕生准备的,太难看懂了。最近发现了一个非常适合小白入门的教程,不仅通俗易懂而且还很风趣幽默。所以忍不住分享一下给大家。点这里可以跳转到教程。

https://www.cbedai.net/u014646662

1.资源准备

   JDK1.8

   Python2.7

   DataX(点击下载

2.环境变量配置(以自己安装目录为准)

   %DATAX_HOME%\bin

   D:\Program Files\Python27\

   D:\Program Files\Java\jdk1.8.0_131\bin

3.在cmd窗口中输入CHCP 65001 防止中文乱码

4.测试(从stream读取数据并打印到控制台)

 a、查看模板

  cd    %DATAX_HOME%\bin

    python datax.py -r streamreader -w streamwriter

会显示如下内容

DataX (DATAX-OPENSOURCE-3.0), From Alibaba !
Copyright (C) 2010-2017, Alibaba Group. All Rights Reserved.


Please refer to the streamreader document:
     https://github.com/alibaba/DataX/blob/master/streamreader/doc/streamreader.md

Please refer to the streamwriter document:
     https://github.com/alibaba/DataX/blob/master/streamwriter/doc/streamwriter.md

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": "streamreader",
                    "parameter": {
                        "column": [],
                        "sliceRecordCount": ""
                    }
                },
                "writer": {
                    "name": "streamwriter",
                    "parameter": {
                        "encoding": "",
                        "print": true
                    }
                }
            }
        ],
        "setting": {
            "speed": {
                "channel": ""
            }
        }
    }
}

 

b、书写配置文件

     文件名:stream2stream.json 

内容如下:

{
  "job": {
    "content": [
      {
        "reader": {
          "name": "streamreader",
          "parameter": {
            "sliceRecordCount": 10,
            "column": [
              {
                "type": "String",
                "value": "helle DataX"
              },
              {
                "type": "string",
                "value": "你吃完晚饭了吗?"
              },
              {
                "type": "string",
                "value": "不要在写代码了,太累了"
              }
            ]
          }
        },
        "writer": {
          "name": "streamwriter",
          "parameter": {
            "encoding": "GBK",
            "print": true
          }
        }
      }
    ],
    "setting": {
      "speed": {
        "channel": 5
       }
    }
  }
}

c.执行配置文件

python datax.py ./steam2stream.json

会出现如下结果:

  

DataX (DATAX-OPENSOURCE-3.0), From Alibaba !
Copyright (C) 2010-2017, Alibaba Group. All Rights Reserved.


2018-09-17 20:18:48.235 [main] INFO  VMInfo - VMInfo# operatingSystem class => sun.management.OperatingSystemImpl
2018-09-17 20:18:48.242 [main] INFO  Engine - the machine info  =>

        osInfo: Oracle Corporation 1.8 25.131-b11
        jvmInfo:        Windows 10 x86 10.0
        cpu num:        8

        totalPhysicalMemory:    -0.00G
        freePhysicalMemory:     -0.00G
        maxFileDescriptorCount: -1
        currentOpenFileDescriptorCount: -1

        GC Names        [PS MarkSweep, PS Scavenge]

        MEMORY_NAME                    | allocation_size                | init_size
        PS Eden Space                  | 256.25MB                       | 256.25MB
        Code Cache                     | 240.00MB                       | 2.25MB
        PS Survivor Space              | 42.50MB                        | 42.50MB
        PS Old Gen                     | 682.75MB                       | 682.75MB
        Metaspace                      | -0.00MB                        | 0.00MB


2018-09-17 20:18:48.270 [main] INFO  Engine -
{
        "content":[
                {
                        "reader":{
                                "name":"streamreader",
                                "parameter":{
                                        "column":[
                                                {
                                                        "type":"String",
                                                        "value":"helle DataX"
                                                },
                                                {
                                                        "type":"string",
                                                        "value":"你吃完晚饭了吗?"
                                                },
                                                {
                                                        "type":"string",
                                                        "value":"不要在写代码了,太累了"
                                                }
                                        ],
                                        "sliceRecordCount":10
                                }
                        },
                        "writer":{
                                "name":"streamwriter",
                                "parameter":{
                                        "encoding":"GBK",
                                        "print":true
                                }
                        }
                }
        ],
        "setting":{
                "speed":{
                        "channel":5
                }
        }
}

2018-09-17 20:18:48.289 [main] WARN  Engine - prioriy set to 0, because NumberFormatException, the value is: null
2018-09-17 20:18:48.292 [main] INFO  PerfTrace - PerfTrace traceId=job_-1, isEnable=false, priority=0
2018-09-17 20:18:48.292 [main] INFO  JobContainer - DataX jobContainer starts job.
2018-09-17 20:18:48.295 [main] INFO  JobContainer - Set jobId = 0
2018-09-17 20:18:48.325 [job-0] INFO  JobContainer - jobContainer starts to do prepare ...
2018-09-17 20:18:48.326 [job-0] INFO  JobContainer - DataX Reader.Job [streamreader] do prepare work .
2018-09-17 20:18:48.335 [job-0] INFO  JobContainer - DataX Writer.Job [streamwriter] do prepare work .
2018-09-17 20:18:48.336 [job-0] INFO  JobContainer - jobContainer starts to do split ...
2018-09-17 20:18:48.338 [job-0] INFO  JobContainer - Job set Channel-Number to 5 channels.
2018-09-17 20:18:48.348 [job-0] INFO  JobContainer - DataX Reader.Job [streamreader] splits to [5] tasks.
2018-09-17 20:18:48.349 [job-0] INFO  JobContainer - DataX Writer.Job [streamwriter] splits to [5] tasks.
2018-09-17 20:18:48.371 [job-0] INFO  JobContainer - jobContainer starts to do schedule ...
2018-09-17 20:18:48.380 [job-0] INFO  JobContainer - Scheduler starts [1] taskGroups.
2018-09-17 20:18:48.382 [job-0] INFO  JobContainer - Running by standalone Mode.
2018-09-17 20:18:48.391 [taskGroup-0] INFO  TaskGroupContainer - taskGroupId=[0] start [5] channels for [5] tasks.
2018-09-17 20:18:48.397 [taskGroup-0] INFO  Channel - Channel set byte_speed_limit to -1, No bps activated.
2018-09-17 20:18:48.401 [taskGroup-0] INFO  Channel - Channel set record_speed_limit to -1, No tps activated.
2018-09-17 20:18:48.412 [taskGroup-0] INFO  TaskGroupContainer - taskGroup[0] taskId[1] attemptCount[1] is started
2018-09-17 20:18:48.415 [taskGroup-0] INFO  TaskGroupContainer - taskGroup[0] taskId[0] attemptCount[1] is started
helle DataX     你吃完晚饭了吗?        不要在写代码了,太累了
helle DataX     你吃完晚饭了吗?        不要在写代码了,太累了
helle DataX     你吃完晚饭了吗?        不要在写代码了,太累了
helle DataX     你吃完晚饭了吗?        不要在写代码了,太累了
helle DataX     你吃完晚饭了吗?        不要在写代码了,太累了
helle DataX     你吃完晚饭了吗?        不要在写代码了,太累了
helle DataX     你吃完晚饭了吗?        不要在写代码了,太累了
helle DataX     你吃完晚饭了吗?        不要在写代码了,太累了
helle DataX     你吃完晚饭了吗?        不要在写代码了,太累了
helle DataX     你吃完晚饭了吗?        不要在写代码了,太累了
helle DataX     你吃完晚饭了吗?        不要在写代码了,太累了
helle DataX     你吃完晚饭了吗?        不要在写代码了,太累了
helle DataX     你吃完晚饭了吗?        不要在写代码了,太累了
helle DataX     你吃完晚饭了吗?        不要在写代码了,太累了
helle DataX     你吃完晚饭了吗?        不要在写代码了,太累了
helle DataX     你吃完晚饭了吗?        不要在写代码了,太累了
helle DataX     你吃完晚饭了吗?        不要在写代码了,太累了
helle DataX     你吃完晚饭了吗?        不要在写代码了,太累了
helle DataX     你吃完晚饭了吗?        不要在写代码了,太累了
helle DataX     你吃完晚饭了吗?        不要在写代码了,太累了
2018-09-17 20:18:48.421 [taskGroup-0] INFO  TaskGroupContainer - taskGroup[0] taskId[3] attemptCount[1] is started
helle DataX     你吃完晚饭了吗?        不要在写代码了,太累了
helle DataX     你吃完晚饭了吗?        不要在写代码了,太累了
helle DataX     你吃完晚饭了吗?        不要在写代码了,太累了
helle DataX     你吃完晚饭了吗?        不要在写代码了,太累了
helle DataX     你吃完晚饭了吗?        不要在写代码了,太累了
helle DataX     你吃完晚饭了吗?        不要在写代码了,太累了
helle DataX     你吃完晚饭了吗?        不要在写代码了,太累了
helle DataX     你吃完晚饭了吗?        不要在写代码了,太累了
helle DataX     你吃完晚饭了吗?        不要在写代码了,太累了
helle DataX     你吃完晚饭了吗?        不要在写代码了,太累了
2018-09-17 20:18:48.433 [taskGroup-0] INFO  TaskGroupContainer - taskGroup[0] taskId[2] attemptCount[1] is started
helle DataX     你吃完晚饭了吗?        不要在写代码了,太累了
helle DataX     你吃完晚饭了吗?        不要在写代码了,太累了
helle DataX     你吃完晚饭了吗?        不要在写代码了,太累了
helle DataX     你吃完晚饭了吗?        不要在写代码了,太累了
helle DataX     你吃完晚饭了吗?        不要在写代码了,太累了
helle DataX     你吃完晚饭了吗?        不要在写代码了,太累了
helle DataX     你吃完晚饭了吗?        不要在写代码了,太累了
helle DataX     你吃完晚饭了吗?        不要在写代码了,太累了
helle DataX     你吃完晚饭了吗?        不要在写代码了,太累了
helle DataX     你吃完晚饭了吗?        不要在写代码了,太累了
2018-09-17 20:18:48.440 [taskGroup-0] INFO  TaskGroupContainer - taskGroup[0] taskId[4] attemptCount[1] is started
helle DataX     你吃完晚饭了吗?        不要在写代码了,太累了
helle DataX     你吃完晚饭了吗?        不要在写代码了,太累了
helle DataX     你吃完晚饭了吗?        不要在写代码了,太累了
helle DataX     你吃完晚饭了吗?        不要在写代码了,太累了
helle DataX     你吃完晚饭了吗?        不要在写代码了,太累了
helle DataX     你吃完晚饭了吗?        不要在写代码了,太累了
helle DataX     你吃完晚饭了吗?        不要在写代码了,太累了
helle DataX     你吃完晚饭了吗?        不要在写代码了,太累了
helle DataX     你吃完晚饭了吗?        不要在写代码了,太累了
helle DataX     你吃完晚饭了吗?        不要在写代码了,太累了
2018-09-17 20:18:48.548 [taskGroup-0] INFO  TaskGroupContainer - taskGroup[0] taskId[0] is successed, used[133]ms
2018-09-17 20:18:48.548 [taskGroup-0] INFO  TaskGroupContainer - taskGroup[0] taskId[1] is successed, used[137]ms
2018-09-17 20:18:48.550 [taskGroup-0] INFO  TaskGroupContainer - taskGroup[0] taskId[2] is successed, used[117]ms
2018-09-17 20:18:48.557 [taskGroup-0] INFO  TaskGroupContainer - taskGroup[0] taskId[3] is successed, used[136]ms
2018-09-17 20:18:48.559 [taskGroup-0] INFO  TaskGroupContainer - taskGroup[0] taskId[4] is successed, used[119]ms
2018-09-17 20:18:48.576 [taskGroup-0] INFO  TaskGroupContainer - taskGroup[0] completed it's tasks.
2018-09-17 20:18:58.400 [job-0] INFO  StandAloneJobContainerCommunicator - Total 50 records, 1500 bytes | Speed 150B/s, 5 records/s | Error 0 records, 0 bytes |  All Task WaitWriterTime 0.000s |  All Task WaitReaderTime 0.001s | Percentage 100.00%
2018-09-17 20:18:58.401 [job-0] INFO  AbstractScheduler - Scheduler accomplished all tasks.
2018-09-17 20:18:58.403 [job-0] INFO  JobContainer - DataX Writer.Job [streamwriter] do post work.
2018-09-17 20:18:58.410 [job-0] INFO  JobContainer - DataX Reader.Job [streamreader] do post work.
2018-09-17 20:18:58.412 [job-0] INFO  JobContainer - DataX jobId [0] completed successfully.
2018-09-17 20:18:58.414 [job-0] INFO  HookInvoker - No hook invoked, because base dir not exists or is a file: D:\datax\hook
2018-09-17 20:18:58.422 [job-0] INFO  JobContainer -
         [total cpu info] =>
                averageCpu                     | maxDeltaCpu                    | minDeltaCpu
                -1.00%                         | -1.00%                         | -1.00%


         [total gc info] =>
                 NAME                 | totalGCCount       | maxDeltaGCCount    | minDeltaGCCount    | totalGCTime        | maxDeltaGCTime     | minDeltaGCTime
                 PS MarkSweep         | 0                  | 0                  | 0                  | 0.000s             | 0.000s             | 0.000s
                 PS Scavenge          | 0                  | 0                  | 0                  | 0.000s             | 0.000s             | 0.000s

2018-09-17 20:18:58.431 [job-0] INFO  JobContainer - PerfTrace not enable!
2018-09-17 20:18:58.436 [job-0] INFO  StandAloneJobContainerCommunicator - Total 50 records, 1500 bytes | Speed 150B/s, 5 records/s | Error 0 records, 0 bytes |  All Task WaitWriterTime 0.000s |  All Task WaitReaderTime 0.001s | Percentage 100.00%
2018-09-17 20:18:58.445 [job-0] INFO  JobContainer -
任务启动时刻                    : 2018-09-17 20:18:48
任务结束时刻                    : 2018-09-17 20:18:58
任务总计耗时                    :                 10s
任务平均流量                    :              150B/s
记录写入速度                    :              5rec/s
读出记录总数                    :                  50
读写失败总数                    :                   0

 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值