SQL Processor Deployment

This page describes how to configure the agent to deploy and manage SQL Processors for stream processing.

Lenses can be used to define & deploy stream processing applications that read from Kafka and write back to Kafka with SQL. They are based on the Kafka Stream framework. They are known as SQL Processors.

SQL processing of real-time data can run in 2 modes:

  • SQL In-Process - the workload runs inside of Lenses.

  • SQL in Kubernetes - the workload runs & scale on your Kubernetes cluster.

Which mode the SQL Processors will run as should be defined within the lenses.conf before Lenses is started.

In-Process Mode

In this mode, SQL processors run as part of the Lenses process, sharing resources, memory, and CPU time with the rest of the platform.

Set the execution configuration to IN_PROC

lenses.conf
# Set up Lenses SQL processing engine
lenses.sql.execution.mode = "IN_PROC"

Set the directory to store the internal state of the SQL Processors:

lenses.conf
lenses.sql.state.dir = "/tmp/lenses-sql-kstream-state"

TLS connections to Kafka and Schema Registries

SQL processors use the same connection details that Lenses uses to speak to Kafka and Schema Registry. The following properties are mounted, if present, on the file system for each processor:

  • Kafka

    1. SSLTruststore

    2. SSLKeystore

  • Schema Registry

    1. SSL Keystore

    2. SSL Truststore

The file structure created by applications is the following: /run/[lenses_installation_id]/applications/

Kubernetes Mode

Kubernetes can be used to deploy SQL Processors. To configure Kubernetes, set the mode to KUBERNETES and configure the location of the kubeconfig file.

When Lenses is deployed inside Kubernetes, the lenses.kubernetes.config.file configuration entry should be set to an empty string. The Kubernetes client will auto-configure from the pod it is deployed in.

The SQL Processor docker image is live in Dockerhub.

Custom Serdes

Custom serdes should be embedded in a new Lenses SQL processor Docker image.

To build a custom Docker image, create the following directory structure:

Copy your serde jar files under processor-docker/serde.

Create Dockerfile containing:

Build the Docker.

Once the image is deployed in your registry, please set Lenses to use it (lenses.conf):

Use Role/RoleBinging to deploy Lenses processors

To deploy Lenses Processors in Kubernetes the suggested way is to activate RBAC in Cluster level through Helm values.yaml:

To achieve this you need to create a Role and a RoleBinding resource in the namespace you want the processors deployed to:

example for:

  • Lenses namespace = lenses-ns

  • Processor namespace = lenses-proc-ns

You can repeat this for as many namespaces you may want Lenses to have access to.

Finally you need to define in Lenses configuration which namespaces can Lenses access. To achieve this amend values.yaml to contain the following:

example:

Last updated

Was this helpful?