Migrating NiFi state and custom components

This section provides a step-by-step process to migrate NiFi state and custom components.

Copy local state

The state-management.xml file contains a local-provider value with a directory path. Copy the contents of local state directory from each source NiFi node to a node in the destination cluster. For example: source Node 1 → destination Node 1, source Node 2 → destination Node 2, …, source Node N → destination Node N.

The default state directory path in CFM 2.01 is /var/lib/nifi/state.

Copy cluster state

The state-management.xml file contains a cluster-provider value with ZooKeeper configuration. Use the ZooKeeper Migrator in the NiFi Toolkit to migrate NiFi ZooKeeper content from the source cluster to the destination.

  1. Export the NiFi component data from the source ZooKeeper:
    
    ./zk-migrator.sh
    -r
    -z sourceHostname:sourceClientPort/sourceRootPath/components
    -f /path/to/export/zk-source-data.json
    
  2. Migrate the source ZooKeeper data to the destination ZooKeeper:
    
    ./zk-migrator.sh
    -s
    -z destinationHostname:destinationClientPort/destinationRootPath/components
    -f /path/to/export/zk-source-data.json
    
    

For more information on the ZooKeeper Migrator, see Using the Apache NiFi Toolkit.

Manage custom components

  1. In Cloudera Manager:
    1. Find the NiFi configuration property “NiFi Node Advanced Configuration Snippet (Safety Valve) for staging/nifi.properties.xml”
    2. Click “+” to add a snippet.
    3. For the Name, enter: nifi.nar.library.directory.custom
    4. For the Value, enter: /opt/configuration_resources/custom_lib
    5. Enter a description.

    For example:

  2. On every destination NiFi cluster node, copy any custom NiFi NARs to the directory path specified by the Value field.

After you finish

When you have finished migrating NiFi state and any custom components, proceed by migrating the NiFi Registry data storage.