Running the Prune Command Using the Cloudera Manager API
Cloudera recommends that you automate running the Prune command by
creating a script that uses the Cloudera Manager API to run the
command. You can run the command using a REST command, a Python
script, or Java class. Configure the script using the Linux
cron
command or another scheduling mechanism to run
on a regular schedule.
REST
See the Rest API documentation.
You can run the Prune command by issuing the following REST request:
curl -X POST -u username:password
'Cloudera_Manager_server_URL:port_number/api/vAPI_version_number/externalAccounts/account/Credential_Name/commands/S3GuardPrune'
For example, the following request runs the S3Guard prune command on the data associated
with the
johnsmith
credential. The response from Cloudera Manager is also
displayed (within the curly
brackets):curl -X POST -u admin:admin 'http://clusterhost-1.gce.mycompany.com:7180/api/v16/externalAccounts/account/johnsmith/commands/S3GuardPrune'
{
"id" : 322,
"name" : "S3GuardPrune",
"startTime" : "2017-03-20T23:35:55.453Z",
"active" : true,
"children" : {
"items" : [ {
"id" : 323,
"name" : "HostS3GuardPrune",
"startTime" : "2017-03-20T23:35:55.777Z",
"active" : true,
"hostRef" : {
"hostId" : "ff988a15-3749-4178-b167-a60b15f91653"
}
Python
You can also use a Python script to run the Prune command. See the aws.py link under Related Information for the code and usage instructions.
Java
See the Javadoc.