Upgrade to the latest version of Portworx Enterprise for continued support. Documentation for the latest version of Portworx Enterprise can be found here.
Manage snapshot schedule policies using pxctl
Overview
This document explains how to manage your snapshot schedule policies using the pxctl
command-line tool. To see the list of the available subcommands and flags, run the pxctl sched-policy
command with the --help
flag as in the following example:
pxctl sched-policy --help
Manage schedule policies
Usage:
pxctl sched-policy [flags]
pxctl sched-policy [command]
Aliases:
sched-policy, sp
Examples:
pxctl sched-policy create --periodic 15 myPolicyName
Available Commands:
create Create a schedule policy
delete Delete a schedule policy
list List all schedule policies
update Update a schedule policy
Flags:
-h, --help help for sched-policy
Global Flags:
--ca string path to root certificate for ssl usage
--cert string path to client certificate for ssl usage
--color output with color coding
--config string config file (default is $HOME/.pxctl.yaml)
--context string context name that overrides the current auth context
-j, --json output in json
--key string path to client key for ssl usage
--output-type string use "wide" to show more details
--raw raw CLI output for instrumentation
--ssl ssl enabled for portworx
Use "pxctl sched-policy [command] --help" for more information about a command.
Create a schedule policy
To create a snapshotting policy, use the pxctl sched-policy create
command. Run it with the --help
flag to list the available options:
pxctl sched-policy create --help
Create a schedule policy
Usage:
pxctl sched-policy create [flags]
Aliases:
create, c
Examples:
pxctl sched-policy create [flags] policy-name
Flags:
-d, --daily strings daily snapshot at specified hh:mm,k (keeps 7 by default)
-h, --help help for create
-m, --monthly strings monthly snapshot at specified day@hh:mm,k (keeps 12 by default)
-p, --periodic string periodic snapshot interval in mins,k (keeps 5 by default), 0 disables all schedule snapshots
-w, --weekly strings weekly snapshot at specified weekday@hh:mm,k (keeps 5 by default)
Global Flags:
--ca string path to root certificate for ssl usage
--cert string path to client certificate for ssl usage
--color output with color coding
--config string config file (default is $HOME/.pxctl.yaml)
--context string context name that overrides the current auth context
-j, --json output in json
--key string path to client key for ssl usage
--output-type string use "wide" to show more details
--raw raw CLI output for instrumentation
--ssl ssl enabled for portworx
The example below creates a policy named p1
with the following properties:
- Portworx performs periodic backups every 60 minutes and keeps the last periodic 5 backups
- Portworx performs weekly backups every Sunday at 12:00 and keeps the last 4 weekly backups
Run the following command to create the p1
backup policy:
pxctl sched-policy create --periodic 60,5 --weekly sunday@12:00,4 p1
You can add schedule policies either when a volume gets created or afterward.
Here is an example of how you can add a schedule policy when the volume is created:
pxctl volume create --policy p1 vol1
The following example adds or updates a schedule policy later:
pxctl volume snap-interval-update --policy p1 vol1
The example below removes a policy from a volume by setting the snap interval to 0:
pxctl volume snap-interval-update --periodic 0 vol1
List schedule policies
Run the following command to list your schedule policies:
pxctl sched-policy list
Policy Description
p1 periodic 1h0m0s,keep last 5, weekly Sunday@12:00,keep last 4
Update schedule policies
To update a schedule policy, use the pxctl sched-policy update
command. Run it with the --help
flag and you will see the list of the available options:
pxctl sched-policy update --help
Update a schedule policy
Usage:
pxctl sched-policy update [flags]
Aliases:
update, u
Examples:
pxctl sched-policy update [flags] policy-name
Flags:
-d, --daily strings daily snapshot at specified hh:mm,k (keeps 7 by default)
-h, --help help for update
-m, --monthly strings monthly snapshot at specified day@hh:mm,k (keeps 12 by default)
-p, --periodic string periodic snapshot interval in mins,k (keeps 5 by default), 0 disables all schedule snapshots
-w, --weekly strings weekly snapshot at specified weekday@hh:mm,k (keeps 5 by default)
Global Flags:
--ca string path to root certificate for ssl usage
--cert string path to client certificate for ssl usage
--color output with color coding
--config string config file (default is $HOME/.pxctl.yaml)
--context string context name that overrides the current auth context
-j, --json output in json
--key string path to client key for ssl usage
--output-type string use "wide" to show more details
--raw raw CLI output for instrumentation
--ssl ssl enabled for portworx
Continuing our previous example with the p1
schedule policy, let’s make it so that our policy creates periodic backups every 120 minutes instead of 60:
pxctl sched-policy update --periodic 120,5 --weekly sunday@12:00,4 p1
Now, let’s make sure our new settings are applied:
pxctl sched-policy list
Policy Description
p1 periodic 2h0m0s,keep last 5, weekly Sunday@12:00,keep last 4
Delete a schedule policy
To delete a schedule policy, run the pxctl sched-policy delete
command with the name of the policy you want to delete as a parameter:
pxctl sched-policy delete p1