Skip to main content
Version: 2.1.0

File

Sink plugin : File [Flink]

Description​

Write data to the file system

Options​

nametyperequireddefault value
formatstringyes-
pathstringyes-
path_time_formatstringnoyyyyMMddHHmmss
write_modestringno-
common-optionsstringno-
parallelismintno-

format [string]​

Currently, csv , json , and text are supported. The streaming mode currently only supports text

path [string]​

The file path is required. The hdfs file starts with hdfs:// , and the local file starts with file://, we can add the variable ${now} or ${uuid} in the path, like hdfs:///test_${uuid}_${now}.txt, ${now} represents the current time, and its format can be defined by specifying the option path_time_format

path_time_format [string]​

When the format in the path parameter is xxxx-${now} , path_time_format can specify the time format of the path, and the default value is yyyy.MM.dd . The commonly used time formats are listed as follows:

SymbolDescription
yYear
MMonth
dDay of month
HHour in day (0-23)
mMinute in hour
sSecond in minute

See Java SimpleDateFormat for detailed time format syntax.

write_mode [string]​

  • NO_OVERWRITE

    • No overwrite, there is an error in the path
  • OVERWRITE

    • Overwrite, delete and then write if the path exists

common options [string]​

Sink plugin common parameters, please refer to Sink Plugin for details

parallelism [Int]​

The parallelism of an individual operator, for FileSink

Examples​

  FileSink {
format = "json"
path = "hdfs://localhost:9000/flink/output/"
write_mode = "OVERWRITE"
}