Skip to content

FTP Reader

FTP Reader provides the ability to read data storage from remote FTP/SFTP file systems.

Functionality

Configuration Example

json
{
  "job": {
    "setting": {
      "speed": {
        "channel": 2,
        "bytes": -1
      }
    },
    "content": {
      "reader": {
        "name": "ftpreader",
        "parameter": {
          "protocol": "sftp",
          "host": "127.0.0.1",
          "port": 22,
          "username": "xx",
          "password": "xxx",
          "path": [
            "/var/ftp/test.txt",
            "/var/tmp/*.txt",
            "/public/ftp",
            "/public/a??.txt"
          ],
          "column": [
            {
              "index": 0,
              "type": "long"
            },
            {
              "index": 1,
              "type": "boolean"
            },
            {
              "index": 2,
              "type": "double"
            },
            {
              "index": 3,
              "type": "string"
            },
            {
              "index": 4,
              "type": "date",
              "format": "yyyy.MM.dd"
            }
          ],
          "encoding": "UTF-8",
          "fieldDelimiter": ","
        }
      },
      "writer": {
        "name": "ftpWriter",
        "parameter": {
          "path": "/var/ftp/FtpWriter/result",
          "fileName": "shihf",
          "writeMode": "truncate",
          "format": "yyyy-MM-dd"
        }
      }
    }
  }
}

Parameters

ConfigurationRequiredData TypeDefault ValueDescription
protocolYesstringNoneServer protocol, currently supports ftp and sftp transport protocols
hostYesstringNoneServer address
portNoint22/21If transport protocol is sftp, default is 22; if standard ftp protocol, default is 21
timeoutNoint60000Connection timeout for ftp server, in milliseconds (ms)
connectPatternNostringPASVConnection mode, only supports PORT, PASV modes. This parameter is only used for ftp protocol
usernameYesstringNoneFTP server access username
passwordNostringNoneFTP server access password
useKeyNobooleanfalseWhether to use private key login, only valid for sftp login
keyPathNostring~/.ssh/id_rsaPrivate key address
keyPassNostringNonePrivate key password, if no private key password is set, no need to configure this
pathYeslistNoneRemote FTP file system path information, note that multiple paths can be supported, detailed description below
columnYeslist<map>NoneList of fields to read, type specifies the type of source data, see below
fieldDelimiterYesstring,Field delimiter for reading
compressNostringNoneText compression type, default empty means no compression. Supports zip, gz, bzip2
encodingNostringutf-8File encoding configuration for reading
skipHeaderNobooleanfalseCSV format files may have header titles that need to be skipped. Default is not to skip
nullFormatNochar\NDefine which strings can represent null
maxTraversalLevelNoint100Maximum number of folder levels allowed for traversal
csvReaderConfigNomapNoneCSV file reading parameter configuration, Map type. Default values used if not configured, see below