GetHDFSEvents

Description:

This processor polls the notification events provided by the HdfsAdmin API. Since this uses the HdfsAdmin APIs it is required to run as an HDFS super user. Currently there are six types of events (append, close, create, metadata, rename, and unlink). Please see org.apache.hadoop.hdfs.inotify.Event documentation for full explanations of each event. This processor will poll for new events based on a defined duration. For each event received a new flow file will be created with the expected attributes and the event itself serialized to JSON and written to the flow file's content. For example, if event.type is APPEND then the content of the flow file will contain a JSON file containing the information about the append event. If successful the flow files are sent to the 'success' relationship. Be careful of where the generated flow files are stored. If the flow files are stored in one of processor's watch directories there will be a never ending flow of events. It is also important to be aware that this processor must consume all events. The filtering must happen within the processor. This is because the HDFS admin's event notifications API does not have filtering.

Tags:

hadoop, events, inotify, notifications, filesystem

Properties:

In the list below, the names of required properties appear in bold. Any other properties (not in bold) are considered optional. The table also indicates any default values, and whether a property supports the NiFi Expression Language.

NameDefault ValueAllowable ValuesDescription
Hadoop Configuration ResourcesA file or comma separated list of files which contains the Hadoop file system configuration. Without this, Hadoop will search the classpath for a 'core-site.xml' and 'hdfs-site.xml' file or will revert to a default configuration.
Kerberos PrincipalKerberos principal to authenticate as. Requires nifi.kerberos.krb5.file to be set in your nifi.properties
Kerberos KeytabKerberos keytab associated with the principal. Requires nifi.kerberos.krb5.file to be set in your nifi.properties
Kerberos Relogin Period4 hoursPeriod of time which should pass before attempting a kerberos relogin
Additional Classpath ResourcesA comma-separated list of paths to files and/or directories that will be added to the classpath. When specifying a directory, all files with in the directory will be added to the classpath, but further sub-directories will not be included.
Poll Duration1 secondThe time before the polling method returns with the next batch of events if they exist. It may exceed this amount of time by up to the time required for an RPC to the NameNode.
HDFS Path to WatchThe HDFS path to get event notifications for. This property accepts both expression language and regular expressions. This will be evaluated during the OnScheduled phase.
Supports Expression Language: true
Ignore Hidden Filesfalse
  • true
  • false
If true and the final component of the path associated with a given event starts with a '.' then that event will not be processed.
Event Types to Filter Onappend, close, create, metadata, rename, unlinkA comma-separated list of event types to process. Valid event types are: append, close, create, metadata, rename, and unlink. Case does not matter.
IOException Retries During Event Polling3According to the HDFS admin API for event polling it is good to retry at least a few times. This number defines how many times the poll will be retried if it throws an IOException.

Relationships:

NameDescription
successA flow file with updated information about a specific event will be sent to this relationship.

Reads Attributes:

None specified.

Writes Attributes:

NameDescription
mime.typeThis is always application/json.
hdfs.inotify.event.typeThis will specify the specific HDFS notification event type. Currently there are six types of events (append, close, create, metadata, rename, and unlink).
hdfs.inotify.event.pathThe specific path that the event is tied to.

State management:

ScopeDescription
CLUSTERThe last used transaction id is stored. This is used

Restricted:

This component is not restricted.

Input requirement:

This component does not allow an incoming relationship.

See Also:

GetHDFS, FetchHDFS, PutHDFS, ListHDFS