Executing SQL jobs in production mode

As by default the SQL jobs are running in a session cluster, there is a risk in case of a cluster failure that every job is affected within that cluster. However, you can set a per-job production mode in SQL Stream Builder to create a dedicated environment for your production jobs.

Production mode means that separately from the running session in SSB, you deploy a SQL job (Flink job) in per-job mode with a dedicated YARN cluster that is configured specifically to that particular production job.

To run your SQL jobs in production mode, you need to add a --PROD prefix to the SQL window at the beginning of your SQL query, and execute the SQL query after setting the execution target and properties in the same window:
--PROD
set 'execution.target' = 'yarn-per-job';
set 'logging.configuration.file' = '/tmp/log4j.properties';
select * from datagen_table_1631781644;

In the above example, the production mode is indicated as --PROD, and the execution target is set to per-job to create a new YARN application for the job. Setting the execution target to per-job allows you to have an individual cluster for the specific job. The additional properties that you configure using the SET statement overwrites the properties that are configured for the running session. However, when you set properties for the production mode, the settings of the session cluster are not affected.

  1. Go to your cluster in Cloudera Manager.
  2. Click on SQL Stream Builder from the list of Services.
  3. Click on the SQLStreamBuilder Console.

    The Streaming SQL Console opens up in a new window.

  4. Specify a job name in the SQL Job Name field, or click Random Name.
  5. Add --PROD to the SQL window.
  6. Set the execution mode to per-job.
    set 'execution.target' = 'yarn-per-job';
  7. Add additional configuration to the production job.

    For the list of configurable parameters, see Session cluster properties section.

  8. Add a SQL statement you want to execute
    Example:
    --PROD
    set 'execution.target' = 'yarn-per-job';
    set 'state.backend' = 'rocksdb';
    select * from faker_table_1631781644;
  9. Click Execute.