Creating and managing snapshot policies

You must enable an HDFS directory for snapshots in Cloudera Manager and then create snapshot policies for that directory in Replication Manager.

Create a snapshot policy

  1. Go to Cloudera Manager > Replication > Snapshot Policies page.

    Existing snapshot policies appear in this page.

  2. Click Create Snapshot Policy.
  3. Select HDFS or HBase service, and the cluster for which you want to create a snapshot policy.
  4. Provide a name for the snapshot policy.
  5. Optionally, provide a description.
  6. Specify the directories, namespaces or tables to include in the snapshot.
    • For an HDFS service, select the paths of the directories to include in the snapshot. The drop-down list allows you to select only directories that are enabled for snapshotting. If no directories are enabled for snapshotting, a warning appears.

      Click to add a path and to remove a path.

    • For an HBase service, list the tables to include in your snapshot. You can use a Java regular expression to specify a set of tables. For example, finance.* matches all tables with names starting with finance. You can also create a snapshot for all tables in a given namespace, using the {namespace}:.* syntax.
  7. Specify the snapshot Schedule. You can schedule snapshots hourly, daily, weekly, monthly, or yearly, or any combination of those. Depending on the frequency you select, you can specify the time of day to take the snapshot, the day of the week, day of the month, or month of the year, and the number of snapshots to keep at each interval. Each time unit in the schedule information is shared with the time units of larger granularity. That is, the minute value is shared by all the selected schedules, hour by all the schedules for which hour is applicable, and so on. For example, if you specify that hourly snapshots are taken at the half hour, and daily snapshots taken at the hour 20, the daily snapshot will occur at 20:30.

    To select an interval, check its box. Fields display where you can edit the time and number of snapshots to keep. For example:

  8. Specify whether Alerts should be generated for various state changes in the snapshot workflow. You can alert on failure, on start, on success, or when the snapshot workflow is aborted.
  9. Click Save Policy.

    The new snapshot policy appears on the Snapshot Policies page.

Manage a snapshot policy

You can edit or delete a snapshot policy.

  1. Go to Cloudera Manager > Replication > Snapshot Policies page.
  2. Click Actions > Edit to edit the snapshot policy.
  3. Click Actions > Delete to delete the snapshot policy.

Errors might appear when you edit or delete a snapshot policy that contains the characters % . ; / \ or any character that is not ASCII printable which includes the ASCII characters less than 32 and the ASCII characters that are greater than or equal to 127. To resolve this issue, use the update command to replace the unsupported character in the policy name with an underscore, in the SNAPSHOT_POLICIES table.

To update the policy name in the SNAPSHOT_POLICIES table, perform the following steps:

  1. Take a backup of the Cloudera Manager database.
  2. Run the following command to replace the unsupported character in the policy name with an underscore:

    update SNAPSHOT_POLICIES set NAME = replace(NAME,CHAR([***Enter character number***]),'_');