CLI for Cloudera Lakehouse Optimizer
On Anywhere Cloud, use the Restish CLI or the Cloudera Lakehouse Optimizer landing page API explorer to call Cloudera Lakehouse Optimizer REST APIs for policies, associations, and maintenance tasks. Restish commands are generated from openapi.json.
Non-graphical clients on Anywhere Cloud
You can trigger Cloudera Lakehouse Optimizer APIs without the maintenance UI using either of the following clients:
- API explorer: Interactive OpenAPI UI on the Cloudera Lakehouse Optimizer landing page. Use it to review endpoints, send authenticated requests, and copy curl examples when your user has a Cloudera Lakehouse Optimizer application role. See Accessing the Cloudera Lakehouse Optimizer API and Accessing Cloudera Lakehouse Optimizer.
- Restish CLI: Open-source client that builds commands from the same OpenAPI specification at runtime (for example, restish clo health-check). Configure OAuth client credentials from the Anywhere Cloud Console before you run Restish commands.
Prerequisites for using Restish
- Deploy Cloudera Lakehouse Optimizer on Anywhere Cloud and complete post-deploy Ranger and Cloudera Data Engineering setup.
- Assign a Cloudera Lakehouse Optimizer application role (administrator, operator, or monitor) in the Anywhere Cloud Console. See Configuring roles for Cloudera Lakehouse Optimizer users.
- Provision API access key credentials and register Restish for Cloudera Lakehouse Optimizer as described in the optional Restish steps in Accessing Cloudera Lakehouse Optimizer (API Explorer POST for access keys, ~/.config/restish/restish.json, restish api sync clo).
- Install the Restish CLI on your workstation. Use a build certified by your security team.
CLI help
After you configure Restish, list Cloudera Lakehouse Optimizer commands with:
restish clo --help
For help on a specific operation, append --help to the command (for example, restish clo dry-run --help). Run restish api auth inspect clo to verify OAuth credentials.
For a summary of common Restish operations, see CLI options for Cloudera Lakehouse Optimizer. For bearer tokens when you use curl instead of Restish, see Generating tokens and accessing Cloudera Lakehouse Optimizer REST APIs.
CLI options for Cloudera Lakehouse Optimizer
On Anywhere Cloud, Restish exposes Cloudera Lakehouse Optimizer REST operations as restish clo subcommands. Run restish clo --help for the complete list from your deployment's openapi.json.
Getting help
restish clo --help
restish clo health-check --help
restish api auth inspect clo
Command names and flags match the OpenAPI specification. If your deployment version adds or renames operations, synchronize Restish after upgrades:
restish api sync clo
Common Restish commands
The following table summarizes frequently used restish clo commands on Anywhere Cloud. Equivalent operations are available in the landing page API explorer.
| Restish command | Description |
|---|---|
health-check |
Health check for the Cloudera Lakehouse Optimizer service (same as GET /config/health). |
ui-list-scripts |
List default and catalog-level policy script resources. |
create-policy-definition-json |
Create a policy definition from JSON resources. |
update-policy-definition-json |
Update an existing policy definition. |
delete-policy-definition |
Delete a policy definition for a scope such as *,
catalog.namespace.*, or catalog.namespace.table. |
create-policy-associations |
Create associations between tables or namespaces and a policy (catalog.namespace.table or catalog.namespace.* targets). |
set-table-policy |
Assign a single policy to a table. |
update-table-policy |
Add, remove, or replace policies on a table subscription. |
delete-table-policy |
Remove a policy from a table. |
dry-run / dry-run-policy |
Preview maintenance actions for a policy on a table without executing them (catalog.namespace.table path). |
evaluate-policy |
Run evaluation (and execution, when applicable) for a policy on a table. |
list-recent-tasks |
List recent maintenance tasks; filter with --table,
--policy, or --count. OpenAPI may also expose
get-recent-tasks. |
fetch-stats |
Query table statistics. |
list-tasks |
List maintenance tasks with cursor-based pagination. |
get-by-id |
Retrieve a task by ID. |
ui-list-timezones |
List time zones supported for policy cron schedules. |
ui-get-policy-details |
Read policy metadata and result.versions[] before download. |
ui-download-policy-version / download-policy-version |
Download policy scripts or arguments for a policy version ID. |
put-namespace / update-namespace |
Register or reschedule a namespace after policy or cron changes. |
Additional command groups (for example, config, namespaces,
policies, tables, and task details) appear in
the output of restish clo --help.
Creating and associating policies
An Administrator creates a Cloudera Lakehouse Optimizer policy with a name, description, selectable Iceberg maintenance actions, and adjustable parameters. Associate the policy with Iceberg tables, namespaces, or catalogs.
cron expression, see Scheduling policies with a cron expression using the CLI. To run the policy on demand, see Running policies on demand using the CLI.Scheduling policies with a cron expression using the CLI
On Anywhere Cloud, define a Quartz-style cron
expression and optional timezone in policy resources with Restish so Cloudera Lakehouse Optimizer evaluates associated tables on a recurring
schedule.
Set the schedule
in the base64-encoded policy arguments JSON that you pass to restish clo
create-policy-definition-json or restish clo
update-policy-definition-json. Include cron and,
when required, timezone alongside action constants. For field
examples, see JSON file and Clouderaadaptive Resources.
Running policies on demand using the CLI
On Anywhere Cloud, manually dry run or evaluate a Cloudera Lakehouse Optimizer policy for a table with Restish. Use dry run first to preview maintenance actions without executing them.
On-demand execution runs outside the cron schedule defined in the policy. Configure Restish (see CLI for Cloudera Lakehouse Optimizer), ensure the policy is associated with the table, and use administrator or operator roles (see Cloudera Lakehouse Optimizer roles and access).
Identify the table with <catalog>.<namespace>.<table> (for example, harmonycatalog.ns_expire_snapshots.tbl_many_snaps).
Performing dry runs on policies
Perform a dry run on a Cloudera Lakehouse Optimizer policy to preview maintenance actions without running them. On Anywhere Cloud, use the CLI or REST APIs.
On Anywhere Cloud, dry run generates table maintenance actions but does not initiate maintenance. Use one of the following:
- CLI (Restish): Run restish clo dry-run-policy with the policy name and catalog.namespace.table path. See Running policies on demand using the CLI.
- REST APIs: Run PUT /policies/{policyName}/tables/{tableName}/dryrun. See Running policies on demand using REST APIs.
For feature-level summary, see Cloudera Lakehouse Optimizer features.
Editing and deleting policies
On Anywhere Cloud, update or delete policy definitions with Restish. Operators can update policies; only administrators can delete policies. See Cloudera Lakehouse Optimizer roles and access.
