Preparing and defining policies using REST APIs

Before you create or define the Cloudera Lakehouse Optimizer policies using REST APIs, the administrator must complete the necessary prerequisites. After defining the policy, the administrator must onboard the required namespace, associate the required tables to the policy, and reschedule the namespace.

Consider the best practices before you create or define the policy.
The following section explains the prerequisites, defining the policy, and post-requisites that you must complete using REST APIs for Cloudera Lakehouse Optimizer to initiate table maintenance.
  1. Ensure that you do not have any other optimization services enabled alongside Cloudera Lakehouse Optimizer, such as AWS S3 Table Optimization, to avoid conflicts during the optimization process.
  2. The Anywhere Cloud environment administrator must perform the following steps to install and configure Cloudera Lakehouse Optimizer:
    1. Contact your Cloudera account team to enable the Cloudera Lakehouse Optimizer service for your Cloudera Open Data Lakehouse environment.
      On Anywhere Cloud, deploy Cloudera Lakehouse Optimizer from the Anywhere Cloud Console Marketplace; you do not use this account-team step for an Anywhere Cloud deployment. See Configuring Cloudera Lakehouse Optimizer on Anywhere Cloud.
    2. Ensure that the environment has the following minimum configuration to support Cloudera Lakehouse Optimizer:
      For cluster sizing details, see Cluster sizing for Cloudera Lakehouse Optimizer on Anywhere Cloud
    3. Provision only one Cloudera Lakehouse Optimizer instance for your AWS, Azure, or GCS environment. For instructions, see Provisioning Cloudera Lakehouse Optimizer.
      On Anywhere Cloud, deploy one Cloudera Lakehouse Optimizer blueprint instance per data service cluster as described in Configuring Cloudera Lakehouse Optimizer on Anywhere Cloud.
    4. Assign Cloudera Lakehouse Optimizer Administrator, Operator, or Monitor roles to users. For role definitions, see Cloudera Lakehouse Optimizer roles and access. For configuration steps, see Configuring roles for Cloudera Lakehouse Optimizer users.
    5. Modify the default values for Spark Executor Memory and Spark Driver Memory. The default values are 8 GB and 4 GB respectively. The default memory settings might be enough for a majority of the use cases. However, for heavy workloads you might want to increase these values.
      On Anywhere Cloud, size and tune the dedicated Cloudera Data Engineering Spark compute engine in the Cloudera Lakehouse Optimizer blueprint deployment form in the Anywhere Cloud Console. Adjust spark.driver.memory and spark.executor.memory on that compute engine for heavy workloads.
  3. Cloudera Lakehouse Optimizer administrators must perform the following actions to verify whether the REST APIs are accessible and the service is available:
    1. Verify whether you can access Lakehouse Optimizer REST APIs after you generate a bearer token for REST access. For more information, see Generating tokens and accessing Cloudera Lakehouse Optimizer REST APIs.
      On Anywhere Cloud, assign Cloudera Lakehouse Optimizer workspace roles in the Anywhere Cloud Console, open the Cloudera Lakehouse Optimizer landing page API explorer, and call protected endpoints using your console identity. See Accessing Cloudera Lakehouse Optimizer and Accessing the Cloudera Lakehouse Optimizer API. Optional Restish CLI setup is in the same accessing topic.
    2. Perform a health check, and then verify whether the ClouderaAdaptive default policy is available. For more information, see Verifying service health and viewing default Cloudera Lakehouse Optimizer policy.
      On Anywhere Cloud, run GET /clo/api/v1/config/health and GET /policies/resource from the landing page API explorer after post-deploy Ranger and role setup; see Accessing Cloudera Lakehouse Optimizer.
  4. Cloudera Lakehouse Optimizer administrators must perform the following actions to initiate the Iceberg table maintenance activity:
    1. Onboard a namespace using the PUT /namespaces/{namespace} API. The API informs Cloudera Lakehouse Optimizer to include the associated tables in the namespace for maintenance.
    2. Define or create the policy. For more information, see Defining Cloudera Lakehouse Optimizer resources using REST APIs.
    3. Associate or subscribe the tables in the onboarded namespace to the required policy using the POST /policies/{policyName}/tables/{tableName}/subs API. The action modifies or appends the mapping of the Iceberg tables to the policies in the association file.
      You must run the PUT /policies/{policyName}/tables/{tableName}/subs API for subsequent associations. For more information, see Table-policy associations.
    4. Reschedule the namespace to update the policies for all the tables in an existing namespace using the PATCH /namespaces/{namespace} API.
    5. Optionally, dry run the policy, during which Cloudera Lakehouse Optimizer only generates the table maintenance actions and does not initiate the maintenance actions. For instructions, see Step 2 of Running policies on demand using REST APIs.
Wait for Cloudera Lakehouse Optimizer to initiate the table maintenance based on the CRON schedule in the policies. For cron scheduling steps, see Scheduling policies with a cron expression.

Optionally, initiate on-demand policy execution when required. Ensure that you dry run the policy before manual maintenance. For more information, see Running policies on demand using REST APIs and Running policies on demand using the CLI.

To monitor the policies, use REST APIs or the CLI. For more information, see Table maintenance task management and monitoring and Viewing table maintenance status.