Creating a Storage Tier Policy

Explains how to create a tiering policy for storage using either the Control System, the CLI, or the REST API.

Creating a Storage Tier Policy Using the Control System

To create a storage tier policy (or rule) using the Control System:
  1. Log in to the Control System, click Data > Volumes, and then do one of the following:
    Note: The Volumes page is under the Volumes menu in the Kubernetes version of the Control System.
    • Go to the Storage Policies tab if you wish to create a storage policy that is not (yet) associated with a volume.
    • Click Create Volume if you wish to create a storage policy for a volume when you are creating the volume.
      Note: You must enable data tiering to create the storage policy.
    • Click Edit Volume in the volume information page if you wish to create a storage policy for a volume when you are editing the volume settings.
  2. Click one of the following to display the Create Storage Policy dialog.
    • Create Policy if you are in the Storage Policies tab.
    • Create link associated with the Storage Policy field if you are in the Create New Volume page.
    • Create link associated with the Storage Policy field if you are in the Edit Volume page.
  3. Enter a name for the storage policy in the Storage Policy Name text field.
  4. Choose Build rule or Rule expression radio button to define the criteria for offloading data.
    Use the Build rule option to build simple rules. Click Add Condition to add one of the following entities:
    • Group
    • User
    • File size
    • Time since the file was modified
    • Time since the file was accessed
    Use a condition group, to add AND and OR conditions.

    Click Add condition group to add AND and OR conditions. You can toggle the AND and OR conditions as needed.

    Use the Rule expression option to create advanced rules that comprise a combination of the following expressions:

    u Username or user ID, as configured in the OS registry (such as /etc/passwd file, LDAP, etc.), of a specific user.

    Usage: u:<username or user ID>

    g Group name or group ID, as configured in the OS registry (such as /etc/group file, LDAP, etc.), of a specific group.

    Usage: g:<groupname or group ID>

    a (atime) Time (in seconds or days) since the files were last accessed. The number of seconds can be specified by appending s to value and the number of days can be specified by appending d to the value.

    Usage:

    • "a:<value>s" — specifies atime in seconds
    • "a:<value>d" — specifies atime in days
    Note: If the system time on CLDB and file server nodes are different, the atime rule for offloading data may not work as intended.

    This tier rule is matched and files are offloaded, when all of the following conditions are met:

    1. atime tracking is enabled at volume level
    2. Time since atime that is configured on the volume is more than the time specified in the rule
    3. Duration since the file was last accessed is more than the time specified in the rule

    Assume that the atime feature is enabled on the volume and that the time in the rule is set to a:300s. Based on this rule, all files that are not accessed since 300s, are offloaded. However, this rule is valid only if time since atime tracking is enabled, is more than 300s. The volume level parameter atimeTrackingStartTime denotes the start time of atime.

    For more information, see Tuning Last Access Time.
    m (mtime) Time (in seconds or days) since the files were last modified. The number of seconds can be specified by appending s to value and the number of days can be specified by appending d to the value.

    Usage:

    • "m:<value>s" — specifies mtime in seconds
    • "m:<value>d" — specifies mtime in days
    All files that are not modified since the specified amount of time, are offloaded.
    Note: If the system time on CLDB and file server nodes are different, the mtime rule for offloading data may not work as intended.
    s The size of the file in bytes, kilobytes, megabytes, or gigabytes. The size of the file can be specified by appending one of the following to the value: b for bytes, k for kilobytes, m for megabytes, or g for gigabytes.

    Usage

    • "s:<value>b" — specifies file size in bytes
    • "s:<value>k" — specifies file size in KB
    • "s:<value>m" — specifies file size in MB
    • "s:<value>g" — specifies file size in GB
    All files whose size exceeds the specified size are offloaded.
    Or, use the following:
    p (Default) Specifies all files. Specifies that this operation is applicable to all the files without restriction. This cannot be combined with any other operator.
    "" Indicates none of the files. Specifies that this operation cannot be performed on any of the files.
    Use the following to string multiple criteria for offload:
    & AND operation to combine multiple expressions as the criteria for the rule.
    | OR operation to indicate either of the expressions as the criteria for the rule.
    () Delimiters for subexpressions.

    If a rule is not defined, the default rule, which is all files (p), is associated with the storage policy.

  5. Click Create Policy to create the storage policy.

Creating a Rule Using the CLI and REST API

Run the following command to create a rule:
$ maprcli tier rule create -name <rule_name> -expr <expressions>
Send a request of type POST. For example:
# curl -k -X POST 'https://abc.sj.us:8443/rest/tier/rule/create?name=rule1&expr=m:365d' --user mapr:mapr
{"timestamp":1519681475025,"timeofday":"2018-02-26 01:44:35.025 GMT-0800 PM","status":"OK","total":0,"data":[],"messages":["Successfully created rule: 'rule1'"]}

For more information, see tier rule create.