Configuring the scheduler to run a job on an instance or cluster member

You can configure the HCL Commerce scheduler to run a job on a particular HCL Commerce instance or cluster member. This can be useful if you want to devote one server for scheduled jobs.

About this task

To isolate a scheduled job to a particular instance or cluster member:
  • Modify the Application Servers running the HCL Commerce instance to give the scheduler a unique identifier.
  • Create or update a scheduled job to run on a unique HCL Commerce instance.

To uniquely identify each server process running HCL Commerce, the following JVM parameter is required: com.ibm.commerce.scheduler.SchedulerHostName

The value should be unique across all servers running your HCL Commerce instance. This will allow you to created a scheduled job that runs on a particular server in your cluster. A recommended value would be: node name. server name. This will be unique across your Cell.

This value can be specified using the WebSphere Application Server Administrative Console and specifying this system property in the JVM settings of the HCL Commerce application:

To create a job to run on a particular host, when calling the AddJob command to create the new schedule job, specify the host parameter and use the value that uniquely identifies the scheduler process that should execute the scheduled job.

If you want to manually change an existing job, update the SCCHOST column in the SCHCONFIG table for the job you want to run on a particular instance. When changing the SCCHOST column, ensure that the value is specified in lowercase characters. Because of performance reasons, the scheduler assumes that the host parameter will be specified in lowercase. The AddJob command makes the host value lowercase automatically but there is nothing in place at the database to maintain this restriction.

Procedure

  • In a development or test environment, to configure the scheduler to run a job on one host, perform the following steps for each node in the cluster:
    1. Open the WebSphere Application Server Administrative Console.
    2. Select Servers > Application Servers.
    3. Select your Transaction server name. For example, server1.
    4. On the Application Servers panel, under the Server Infrastructure heading, select Java and Process Management > Process Definition.
    5. On the Process Definition panel, under the Additional Properties heading, select Java Virtual Machine.
    6. In the middle window, on the right hand side under the Additional Properties heading, select Custom Properties.
    7. Click New. A new page opens for you to add additional JVM properties.
    8. In the Name field, enter com.ibm.commerce.scheduler.SchedulerHostName.
    9. In the Value field, enter the unique identifier of the scheduler instance on this Java process.
    10. In the Description field, enter the host name parameter for this scheduler instance to use.
  • For production environments, to configure the scheduler to run a job on one host, do the following for each node in the cluster:
    Add an environment variable to the node's Docker container. The variable name is SCHEDULER_ID, and its value is the unique identifier of the scheduler instance. For example, here is how to declare the variable in Docker Compose:
    version: "2"
    services:
    
      app:
        image: ts-app:latest
        environment:
          - SCHEDULER_ID=host1
  • For a Kubernetes deployment, additional steps are required to set unique SCHEDULER_ID values for different Transaction server instances.
    1. Obtain the HCL Commerce Git Bundle, or modify your existing source.

      For more information on obtaining the latest HCL Commerce files, see HCL Commerce eAssemblies.

    2. Open the hcl-commerce-helmchart\stable\hcl-commerce\templates\ directory and locate the ts-app.yaml file.
    3. Create a copy of the file. For example, ts-app-scheduler1.yaml.
    4. Edit the file to add the environment variable SCHEDULER_ID, and assign a unique value for each pod.
      env:
      
      - name: "SCHEDULER_ID"
        value: "SCHEDULER_1"
    5. Save and close the file.
    6. Repeat this process for each scheduler pod.
    7. Deploy or re-deploy the HCL Commerce Helm Chart with these modifications.

      With this modification, the additional scheduler pods, with unique scheduler IDs, are deployed. You can then schedule jobs to a particular node by referencing the SCHEDULER_ID.

Results

The scheduler is now configured to run jobs on particular nodes or pods of your cluster.