4.3

You are viewing documentation for an older version of Lenses.io View latest documentation here

Kafka Connect

The CLI can create, modify, pause, restart and remove Apache Kafka Connect connectors.

Note: Kafka Connect cluster permissions will be applied to the operation.

View Connectors 

List currently deployed connectors, optionally filter by name, cluster and namespace:

lenses-cli connectors --cluster-name="dev" 

#[[--names [--unwrap]]

The —names flag displays only the names of the connectors. When used with —unwrap, it will print each connector name on a separate line in the output.

List all the supported connectors 

lenses-cli connectors --supported

View the available plugins per cluster \ 

lenses-cli connectors plugins --cluster-name="dev"

Create connectors 

lenses-cli connector create \
    --cluster-name="dev" \
    --name="connectorName" \
    --configs="{\"key\": \"value\"}"

From a file.

lenses-cli connector create ./connector.yaml

Example file:

clusterName: development
config:
  connector.class: "org.apache.kafka.connect.file.FileStreamSinkConnector"
  file: "/dev/null"
  tasks.max: "1"
  topics: "reddit_posts"
  name: "nullsink"

Update a connector 

# Inline
lenses-cli connector update --name=nullsink --cluster-name=dev \
  --configs="{\"connector.class\":\"org.apache.kafka.connect.file.FileStreamSinkConnector\",\"file\":\"/dev/null\",\"name\":\"nullsink\",\"tasks.max\":\"8\",\"topics\":\"reddit_posts\"}"

# or from file
lenses-cli connector update ./connector.yaml

View the configuration of a connector 

lenses-cli connector config \
    --cluster-name="dev" \
    --name="connectorName"

View the status of a connector 

lenses-cli connector status \
    --cluster-name="dev" \
    --name="connectorName"

Pause a connector 

lenses-cli connector pause \
    --cluster-name="dev" \
    --name="connectorName"

Resume a connector 

lenses-cli connector resume \
    --cluster-name="dev" \
    --name="connectorName"

Restart a connector 

lenses-cli connector restart \
    --cluster-name="dev" \
    --name="connectorName"

Restart a connector task 

lenses-cli connector task restart \
    --task=0 \
    --cluster-name="dev" \
    --name="connectorName"

View tasks for a connector 

lenses-cli connector tasks \
    --cluster-name="dev" \
    --name="connectorName"

View the status of a task for a connector 

lenses-cli connector task status \
    --cluster-name="dev" \
    --name="connectorName" --task=1

Delete a connector 

lenses-cli connector delete \
    --cluster-name="dev" \
    --name="connectorName"