Configuring asynchronous auto prefetch for AFM NFS-based filesets

Configure an AFM cache fileset in read-only (RO) or independent writer (IW) mode to periodically fetch changed data from a home cluster. After this configuration, the system synchronizes created, modified, or deleted data at a specified interval.

Before you begin

Before you begin, ensure the following prerequisites are met:

  • A home cluster with an NFS export is configured.
  • Network connectivity exists between the home and cache clusters.
  • For watch folder integration, Apache Kafka or another supported message broker is available.

About this task

Use this procedure to configure asynchronous auto prefetch with watch folder integration to monitor and stream file system events to an external message queue.

Procedure

  1. Create a home export at the home cluster site.

    Configure an NFS export on the home cluster that serves as the data source for the AFM cache fileset. For more information about creating NFS exports, see Changing NFS export configuration.

  2. Create an AFM cache fileset in the RO or IW mode by using an NFS target at the cache cluster.
    mmcrfileset fs1 afmRO1 -p afmtarget=home1:/gpfs/fs1/export1 \
      --inode-space=new --inode-limit=10000 \
      -p afmmode=ro,afmFileOpenRefreshInterval=disable,\
    afmFileLookupRefreshInterval=disable,\
    afmDirOpenRefreshInterval=disable,\
    afmDirLookupRefreshInterval=disable,\
    afmAsyncPrefetchInterval=60
    where:
    afmtarget
    Specifies the NFS path on the home cluster (home1:/gpfs/fs1/export1).
    afmmode=ro
    Creates the fileset in the RO mode. Use iw for IW mode.
    afmAsyncPrefetchInterval=60
    Sets the synchronization interval to 60 minutes.
    All refresh intervals are disabled to rely on asynchronous prefetch for data synchronization.

    A sample output is as follows:

    Fileset afmRO1 created with id 5 root inode 2097155.
  3. Configure watch folder events for the created AFM fileset.
    mmwatch fs1 enable --fileset afmRO1 \
      --events IN_CREATE,IN_DELETE,IN_MODIFY \
      --event-handler kafkasink \
      --sink-topic ro1 \
      --sink-brokers localhost:9092

    This command enables watch folder monitoring for the afmRO1 fileset and streams events to a Kafka topic named ro1.

    Verify the active watch folders on the fileset.

    mmwatch fs1 list

    A sample output is as follows:

    Filesystem fs1 has 1 watcher(s):
    Cluster ID            WatchID/PID   Type  Start Time               Path Description
    --------------------------------------------------------------------------------------
    10258389552690212634  CLW1741845048 INODE Wed Apr 02 00:06:50 2026 /gpfs/fs1/ afmRO1

    For more information about the watch folder, see Producers in clustered watch folder.

  4. Start the ZooKeeper service to manage the Kafka cluster coordination.
    bin/zookeeper-server-start.sh config/zookeeper.properties
  5. Start the Kafka producer.
    bin/kafka-server-start.sh config/server.properties

    The Kafka server receives and stores event notifications from the watch folder.

  6. Start the Kafka consumer to monitor events.
    bin/kafka-console-consumer.sh --topic ro1 \
      --from-beginning \
      --bootstrap-server localhost:9092

    The consumer displays events when the watch folder generates the events.

  7. Verify the configuration by creating or modifying data on the home cluster.

    AFM fetches modified data from the home to the cache fileset. Watch folder events are generated and passed to the Kafka consumer.

    When a file is created on the home cluster, the Kafka consumer displays an event similar to the following example:

    {
      "WF_JSON": "0.0.3",
      "wd": "1",
      "cookie": "0",
      "mask": "0x100",
      "event": "IN_CREATE",
      "path": "/gpfs/fs1/afmRO1/file1.gz",
      "clusterName": "testCluster",
      "nodeName": "host1",
      "nfsClientIp": "",
      "fsName": "fs1",
      "inode": "2098181",
      "fileSetID": "3",
      "linkCount": "1",
      "openFlags": "0",
      "poolName": "system",
      "fileSize": "0",
      "ownerUserId": "0",
      "ownerGroupId": "0",
      "atime": "2026-04-02_00:07:32.735-0700",
      "ctime": "2026-04-02_00:07:32.735-0700",
      "mtime": "2026-04-02_00:07:32.735-0700",
      "eventTime": "2026-04-02_00:07:32.735-0700",
      "clientUserId": "0",
      "clientGroupId": "0",
      "accessMode": null,
      "processId": "NA",
      "bytesRead": null,
      "bytesWritten": null,
      "minReadOffset": null,
      "maxReadOffset": null,
      "minWriteOffset": null,
      "maxWriteOffset": null,
      "permissions": "200100770",
      "acls": null,
      "xattrs": null,
      "subEvent": "NONE"
    }

    When a file is modified on the home cluster, the Kafka consumer displays an event similar to the following example:

    {
      "WF_JSON": "0.0.3",
      "wd": "1",
      "cookie": "0",
      "mask": "0x2",
      "event": "IN_MODIFY",
      "path": "/gpfs/fs1/afmRO1/file1.gz",
      "clusterName": "testCluster",
      "nodeName": "host1",
      "nfsClientIp": "",
      "fsName": "fs1",
      "inode": "2098180",
      "fileSetID": "3",
      "linkCount": "1",
      "openFlags": "32771",
      "poolName": "system",
      "fileSize": "220760979",
      "ownerUserId": "0",
      "ownerGroupId": "0",
      "atime": "2026-04-02_00:07:32.729-0700",
      "ctime": "2026-04-02_00:07:32.779-0700",
      "mtime": "2026-04-02_00:06:56.000-0700",
      "eventTime": "2026-04-02_00:08:15.825-0700",
      "clientUserId": "0",
      "clientGroupId": "0",
      "accessMode": null,
      "processId": "442952",
      "bytesRead": "0",
      "bytesWritten": "220760979",
      "minReadOffset": "9223372036854775807",
      "maxReadOffset": "0",
      "minWriteOffset": "0",
      "maxWriteOffset": "220760978",
      "permissions": "200102770",
      "acls": null,
      "xattrs": null,
      "subEvent": "NONE"
    }

Results

The AFM cache fileset is configured with asynchronous auto prefetch and watch folder integration. The system synchronizes data changes from the home cluster at the specified interval and generates event notifications for monitoring and auditing purposes.

What to do next

To modify the prefetch interval for an existing fileset, use the mmchfileset command. For more information, see mmchfileset command.