Examples to set up the AFM to cloud object storage

The examples to configure and set up an AFM to cloud object storage fileset are as follows:
  • AFM to cloud object storage by using the ObjectFS mode
  • AFM to cloud object storage by using the ObjectOnly mode

Prerequisites

Ensure that the following conditions are met before you set the AFM to cloud object storage:
  • Details and credentials of a cloud object storage server
  • An endpoint address with a port and a protocol
  • A target bucket

    Use an existing bucket or create new buckets with AFM.

  • An IBM Storage Scale cluster that to be used as an AFM cache cluster.
  • A cluster is upgraded to latest file system level and release level.
  • A gateway node is identified and configured in the IBM Storage Scale cluster.
  • The gpfs.afm.cos package is already installed on the gateway node.
  • Limitation and support consideration of the cloud object storage server and IBM Storage Scale features.

Setup information

The setup information is as follows:
  • Cloud object storage server
    • Endpoint: https://IP
    • Port: 443
    • Access Key ID: accesskey01
    • Secret Key ID: secretkey01
    • Bucket name: bucket01, bucket02
  • IBM Storage Scale server
    • An IBM Storage Scale cluster
    • IBM Storage Scale file system: gpfs0

      This file system is mounted on the /ibm/gpfs0 file system.

    • Linux node: Node01

      This node is used as a gateway node in this example.

    • AFM to cloud object storage fileset name: iw1, iw2

      The fileset mode is independent-writer (IW).

AFM to cloud object storage by using the ObjectFS mode

To set up and configure an AFM to cloud object storage IW-mode fileset by using the ObjectFS.

  1. Identify a Linux node on the IBM Storage Scale cluster and assign the gateway node role if it is not assigned.
    # mmchnode -N Node01 --gateway
  2. Provide an access key ID and a secret key ID to AFM.
    1. Set the access key ID and the secret key ID.
      # mmafmcoskeys bucket01 set accesskey01 secretkey01
    2. Verify the set access and secret keys.
      # mmafmcoskeys bucket01 get
      A sample output is as follows:
      accesskey01:secretkey01
  3. Configure the AFM to cloud object storage IW-mode fileset by using the ObjectFS mode.
    1. Create an AFM to cloud object storage IW-mode fileset by using the ObjectFS mode.
      # mmafmcosconfig gpfs0 iw1 -–end-point https://IP:443 --xattr --bucket bucket01 
      --mode iw --chunk-size 1048576 --read-size 1048576 --acls --object-fs
    2. Check the file set status.
      # mmlsfileset gpfs0 iw1 -L --afm
      A sample output is as follows:
      Filesets in file system 'gpfs0':
      
      Attributes for fileset objFSIW1:
      =================================
      Status                                  Linked
      Path                                    /ibm/gpfs0/iw1
      Id                                      1
      Root inode                              524291
      Parent Id                               0
      Created                                 Fri Oct  2 08:18:47 2020
      Comment
      Inode space                             1
      Maximum number of inodes                7340032
      Allocated inodes                        620544
      Permission change flag                  chmodAndSetacl
      afm-associated                          Yes
      Target                                  https://IP:443/bucket01
      Mode                                    independent-writer
      File Lookup Refresh Interval            120
      File Open Refresh Interval              120
      Dir Lookup Refresh Interval             120
      Dir Open Refresh Interval               120
      Async Delay                             15 (default)
      Last pSnapId                            0
      Display Home Snapshots                  no
      Parallel Read Chunk Size                0
      Number of Gateway Flush Threads         16
      Prefetch Threshold                      0 (default)
      Eviction Enabled                        yes (default)
      Parallel Write Chunk Size               0
      IO Flags                                0x8080000 (afmObjectXattr,afmObjectACL)
      
    3. List the objects on the bucket under the fileset.
      # ls -l /ibm/gpfs0/iw1
    4. Check the AFM fileset status.
      # mmafmctl gpfs0 getstate -j iw1

      A sample output is as follows:

      Fileset Name  Fileset Target 	       Cache State Gateway Node  Queue Length  Queue numExec
      ------------  --------------  	      ----------- ------------  ------------- -------------
      iw1           https://IP:443/bucket01  Active       Node01       0             13

      The objects from the buckets are now listed under the fileset but data size is shown as zero (‘0’). You can download the data to the AFM fileset either by reading all files as synchronous operation or by running the asynchronous download operation. Use the mmafmcosctl download command to download the data.

      Complete the following steps to download selected object data from a bucket to an AFM to cloud object storage fileset.
      1. Generate an object-list file that has unique file names in each line. Use this file as an object-list file for the download.
        # cat /tmp/file1file1
        file2
        file3
        file4
        file5
      2. Download the data of the objects, which are listed in the object-list file, from the bucket to the fileset.
        # mmafmcosctl gpfs0 iw1 /ibm/gpfs0/iw1 download --object-list /tmp/file1
        A sample output is as follows:
        Queued     (Total)     Failed       AlreadyCached   		TotalData
                                                      		(approx in Bytes)
        5          (5)          0                  0             4216333
        Object Download successfully queued at the gateway.
      3. Check the fileset status.
        # mmafmctl gpfs0 getstate -j iw1
        A sample output is as follows:
        Fileset Name  Fileset Target 	        Cache State Gateway Node  Queue Length  Queue numExec
        ------------  --------------  	       ----------- ------------  ------------- -------------
        iw1           https://IP:443/bucket01  Active       Node01       0             44
    5. Verify the object data on the cache.
      # ls -ls /ibm/gpfs0/iw1
      A sample output is as follows:
      total 5120
      1024 -rwx------ 1 root root 1048576 Oct 28  2020 file1
         0 -rwx------ 1 root root 1048576 Oct 28  2020 file10
      1024 -rwx------ 1 root root 1048576 Oct 28  2020 file2
      1024 -rwx------ 1 root root 1048576 Oct 28  2020 file3
      1024 -rwx------ 1 root root 1048576 Oct 28  2020 file4
      1024 -rwx------ 1 root root 1048576 Oct 28  2020 file5
         0 -rwx------ 1 root root 1048576 Oct 28  2020 file6
         0 -rwx------ 1 root root 1048576 Oct 28  2020 file7
         0 -rwx------ 1 root root 1048576 Oct 28  2020 file8
         0 -rwx------ 1 root root 1048576 Oct 28  2020 file9
  4. Modify the data on the AFM cache fileset and synchronize the data automatically to the bucket.
    # ls -ls /ibm/gpfs0/iw1
    A sample output is as follows:
    total 10240
    1024 -rwx------ 1 root root 1048576 Oct 28  2020 file1
    1024 -rwx------ 1 root root 1048576 Oct 28 05:14 file10
    1024 -rwx------ 1 root root 1048576 Oct 28 05:14 file2
    1024 -rwx------ 1 root root 1048576 Oct 28  2020 file3
    1024 -rwx------ 1 root root 1048576 Oct 28  2020 file4
    1024 -rwx------ 1 root root 1048576 Oct 28  2020 file5
    1024 -rwx------ 1 root root 1048576 Oct 28 05:14 file6
    1024 -rwx------ 1 root root 1048576 Oct 28 05:14 file7
    1024 -rwx------ 1 root root 1048576 Oct 28 05:14 file8
    1024 -rwx------ 1 root root 1048576 Oct 28 05:14 file9
    
    1. Check the status of the fileset when the data is synchronized from the AFM fileset to the bucket.
      # mmafmctl gpfs0 getstate -j iw1
      A sample output is as follows:
      Fileset Name  Fileset Target 	        Cache State Gateway Node  Queue Length  Queue numExec
      ------------  --------------  	       ----------- ------------  ------------- -------------
      iw1           https://IP:443/bucket01  Active       Node01       0             105
    2. Validate files on the bucket by using a client of a cloud object storage server or S3 API.
  5. Map a directory in an AFM to cloud object storage fileset. You can map the directory to a different directory on the same or a different cloud object storage server.
    1. Create a directory in an AFM to cloud object storage fileset.
      # mkdir /ibm/gpfs0/iw1/afm3
    2. Map the created directory with the existing new afm3 bucket.
      # mmafmcosaccess gpfs0 iw1 /ibm/gpfs0/iw1/afm3/ set --bucket afm3 
      --endpoint https://IP:443 --akey minioadmin --akey accesskey01 --skey accesskey01
    3. Check the fileset status.
      # mmafmctl gpfs0 getstate
      A sample output is as follows:
      Fileset Name  Fileset Target 	        Cache State Gateway Node  Queue Length  Queue numExec
      ------------  --------------  	       ----------- ------------  ------------- -------------
      iw1           https://IP:443/bucket01  Active       Node01       0             108
    4. Copy some files under the mapped directory. These files must synchronize to the new bucket.
      # ls -ls /ibm/gpfs0/iw1/afm3/
      A sample output is as follows:
      total 10240
      1024 -rwx------ 1 root root 1048576 Oct 28  2020 file1
      1024 -rwx------ 1 root root 1048576 Oct 28 05:14 file10
      1024 -rwx------ 1 root root 1048576 Oct 28 05:14 file2
      1024 -rwx------ 1 root root 1048576 Oct 28  2020 file3
      1024 -rwx------ 1 root root 1048576 Oct 28  2020 file4
      1024 -rwx------ 1 root root 1048576 Oct 28  2020 file5
      1024 -rwx------ 1 root root 1048576 Oct 28 05:14 file6
      1024 -rwx------ 1 root root 1048576 Oct 28 05:14 file7
      1024 -rwx------ 1 root root 1048576 Oct 28 05:14 file8
      1024 -rwx------ 1 root root 1048576 Oct 28 05:14 file9
      
    5. Validate the data that is uploaded to the bucket by using a client or S3 API.

AFM to cloud object storage by using the ObjectOnly mode

Set up and configure an AFM to cloud object storage IW-mode fileset by using the ObjectOnly mode.
  1. Identify a Linux node on an IBM Storage Scale cluster and assign the gateway node role if it is not assigned.
    # mmchnode -N Node01 --gateway
  2. Provide an access key ID and a secret key ID to AFM.
    1. Set the access key ID and the secret key ID.
      # mmafmcoskeys bucket02 set accesskey01 secretkey01
    2. Verify the set access and secret keys.
      # mmafmcoskeys bucket02 get
      A sample output is as follows:
      accesskey01:secretkey01
  3. Configure the AFM to cloud object storage IW-mode fileset by using the ObjectOnly mode.
    1. Create an AFM to cloud object storage IW-mode fileset by using the ObjectOnly mode.
      # mmafmcosconfig gpfs0 iw2 --endpoint https://IP:443
       --bucket bucket02 --xattr --cleanup --mode iw
    2. Check the fileset status.
      # mmlsfileset gpfs0 iw2 -L --afm
      A sample output is as follows:
      Filesets in file system 'gpfs0':
      
      Attributes for fileset iw2:
      ============================
      Status                                  Linked
      Path                                    /ibm/gpfs0/iw2
      Id                                      8
      Root inode                              2621443
      Parent Id                               0
      Created                                 Wed Oct 28 06:57:12 2020
      Comment
      Inode space                             5
      Maximum number of inodes                100352
      Allocated inodes                        100352
      Permission change flag                  chmodAndSetacl
      afm-associated                          Yes
      Target                                  http://IP:443/bucket02
      Mode                                    independent-writer
      File Lookup Refresh Interval            disable
      File Open Refresh Interval              disable
      Dir Lookup Refresh Interval             disable
      Dir Open Refresh Interval               disable
      Async Delay                             15 (default)
      Last pSnapId                            0
      Display Home Snapshots                  no
      Parallel Read Chunk Size                0
      Number of Gateway Flush Threads         4
      Prefetch Threshold                      0 (default)
      Eviction Enabled                        yes (default)
      Parallel Write Chunk Size               0
      IO Flags                                0x480000 (afmObjectXattr,afmSkipHomeRefresh)
    3. Check the fileset status.
      # mmafmctl gpfs0 getstate -j iw2
      A sample output is as follows:
      Fileset Name  Fileset Target 	      Cache State Gateway Node  Queue Length  Queue numExec
      ------------  --------------  	     ----------- ------------  ------------- -------------
      iw2           http://IP:443/bucket02 Inactive     Node01     
    4. List the objects on the bucket.
      # ls -ls /ibm/gpfs0/iw2
      A sample output is as follows:
      total 0

      The fileset is in the Inactive state because the fileset is configured by using the ObjectOnly mode. This fileset can be moved to the Active state either by copying a fileCheck in the fileset or by downloading objects from the bucket.

    5. Move the fileset from the Inactive state to the Active state.
      # touch /ibm/gpfs0/iw2/tempfile
    6. Check the fileset status.
      # mmafmctl gpfs0 getstate -j iw2
      A sample output is as follows:
      Fileset Name  Fileset Target 	       Cache State Gateway Node  Queue Length  Queue numExec
      ------------  --------------  	      ----------- ------------  ------------- -------------
      iw2           http://IP:443/bucket02 Active     Node01         0             1
    7. Check the created file that is synchronized to the bucket.
      # ls -l /ibm/gpfs0/iw2
      total 0
      -rw-r--r-- 1 root root 0 Oct 28 07:09 tmpfile

      This command shows only the iw2 fileset. It does not show existing objects that are created on the bucket.

      Complete the following steps to download selected object data from a bucket to an AFM to cloud object storage fileset.

      1. Create an object-list file that contains unique file names in each line. These objects are available on the bucket.
        # cat /tmp/file1
        file1
        file2
        file3
        file4
        file5
        
      2. Download the created objects.
        # mmafmcosctl gpfs0 iw2 /ibm/gpfs0/iw2 download --object-list /tmp/file1 --data
        A sample output is as follows:
        Queued     (Total)     Failed       AlreadyCached          TotalData
                                                              (approx in Bytes)
        5         (5)          0                  0             5242880
        Object Download successfully queued at the gateway.
      3. Check the fileset status.
        # mmafmctl gpfs0 getstate -j iw2
        A sample output is as follows:
        Fileset Name  Fileset Target 	       Cache State Gateway Node  Queue Length  Queue numExec
        ------------  --------------  	      ----------- ------------  ------------- -------------
        iw2           http://IP:443/bucket02 Active     Node01         0             20
      4. Verify the object data on the cache.
        # ls -ls /ibm/gpfs0/iw2
        A sample output is as follows:
        total 5120
        1024 -rwx------ 1 root root 1048576 Oct 28  2020 file1
        1024 -rwx------ 1 root root 1048576 Oct 28  2020 file2
        1024 -rwx------ 1 root root 1048576 Oct 28  2020 file3
        1024 -rwx------ 1 root root 1048576 Oct 28  2020 file4
        1024 -rwx------ 1 root root 1048576 Oct 28  2020 file5
           0 -rw-r--r-- 1 root root       0 Oct 28 07:09 tmpfile
  4. Modify files on the AFM IW ObjectOnly mode fileset. AFM synchronizes these files automatically to the bucket.
    1. Verify the files in the fileset.
      # ls -ls /ibm/gpfs0/iw2
      A sample output is as follows:
      total 20480
      4096 -rwx------ 1 root root 2097152 Oct 28  2020 file1
      4096 -rwx------ 1 root root 2097152 Oct 28  2020 file2
      4096 -rwx------ 1 root root 2097152 Oct 28  2020 file3
      4096 -rwx------ 1 root root 2097152 Oct 28  2020 file4
      4096 -rwx------ 1 root root 2097152 Oct 28  2020 file5
         0 -rw-r--r-- 1 root root       0 Oct 28 07:09 tmpfile
    2. Check the fileset status. The fileset status must be Active when data is synchronized from the AFM fileset to the bucket.
      # mmafmctl gpfs0 getstate -j iw2
      A sample output is as follows:
      Fileset Name  Fileset Target 	       Cache State Gateway Node  Queue Length  Queue numExec
      ------------  --------------  	      ----------- ------------  ------------- -------------
      iw2           http://IP:443/bucket02 Active     Node01         0             25
    3. Verify files on the bucket by using a cloud object storage server client or API.