1. Connect to External Systems

Manage Kafka Connectors

StreamNative Cloud enables you to manage Pulsar IO Connectors by using a variety of tools, including kcctl, restful-api, and Console.

Update a connect

When you want to modify configurations or update resources for connects, you can update connectors using multiple tools.

The following example shows how to update the tasks.max of the data generator source connector test to 2 using different tools.

> cat datagen.json
{
  "name": "test",
  "config": {
    "connector.class": "io.confluent.kafka.connect.datagen.DatagenConnector",
    "kafka.topic": "testusers",
    "quickstart": "users",
    "key.converter": "org.apache.kafka.connect.storage.StringConverter",
    "value.converter": "org.apache.kafka.connect.json.JsonConverter",
    "value.converter.schemas.enable": "false",
    "max.interval": 1000,
    "iterations": 10000000,
    "tasks.max": "2"
  }
}
> kcctl apply -f datagen.json

You should see the following output:

Updated connector test

And you can further check the status:

kcctl describe connectors test --tasks-config

Name:       test
Type:       source
State:      RUNNING
Worker ID:  10.80.161.255:8083
Config:
  connector.class:                 io.confluent.kafka.connect.datagen.DatagenConnector
  iterations:                      10000000
  kafka.topic:                     testusers
  key.converter:                   org.apache.kafka.connect.storage.StringConverter
  max.interval:                    1000
  name:                            test
  quickstart:                      users
  tasks.max:                       2
  value.converter:                 org.apache.kafka.connect.json.JsonConverter
  value.converter.schemas.enable:  false
Tasks:
  0:
    State:                             RUNNING
    Worker ID:                         10.80.161.255:8083
    Config:
      connector.class:                 io.confluent.kafka.connect.datagen.DatagenConnector
      quickstart:                      users
      tasks.max:                       2
      max.interval:                    1000
      iterations:                      10000000
      task.class:                      io.confluent.kafka.connect.datagen.DatagenTask
      name:                            test
      value.converter.schemas.enable:  false
      kafka.topic:                     testusers
      task.id:                         0
      value.converter:                 org.apache.kafka.connect.json.JsonConverter
      key.converter:                   org.apache.kafka.connect.storage.StringConverter
  1:
    State:                             RUNNING
    Worker ID:                         10.80.160.255:8083
    Config:
      connector.class:                 io.confluent.kafka.connect.datagen.DatagenConnector
      quickstart:                      users
      tasks.max:                       2
      max.interval:                    1000
      iterations:                      10000000
      task.class:                      io.confluent.kafka.connect.datagen.DatagenTask
      name:                            test
      value.converter.schemas.enable:  false
      kafka.topic:                     testusers
      task.id:                         0
      value.converter:                 org.apache.kafka.connect.json.JsonConverter
      key.converter:                   org.apache.kafka.connect.storage.StringConverter
Topics:
  testusers

Delete a connector

The following example shows how to delete the data generator source connector test using different tools.

To delete the source connector test, use the following command.

kcctl delete connector test

You should see the following output:

Deleted connector test

If you want to verify whether the source connector has been deleted successfully, run the following command.

kcctl get connectors

You should see the following output:


 NAME                  TYPE     STATE        TASKS

Stop a connector

You can stop a running connector using different tools, after stopped, all resources of the connector will be released.

After stopped, you can restart the connector.

To stop the source connector test, use the following command.

kcctl stop connectors test

You should see the following output:

Stopped connector test

If you want to verify whether the source connector has been stopped successfully, run the following command.

kcctl get connectors

You should see the following output:

 NAME      TYPE     STATE     TASKS
 datagen   source   STOPPED

Restart a connector

You can restart a stopped or a running connector using different tools.

To restart the source connector test, use the following command.

kcctl restart connectors test

You should see the following output:

Restarted connector test

If you want to verify whether the source connector has been restarted successfully, run the following command.

kcctl get connectors

You should see the following output:

 NAME      TYPE     STATE     TASKS
 datagen   source   RUNNING

Pause a connector

You can pause a running connector using different tools, a paused connector still occupy the resources but just stop processing messages.

To pause the source connector test, use the following command.

kcctl pause connectors test

You should see the following output:

Paused connector test

If you want to verify whether the source connector has been paused successfully, run the following command.

kcctl get connectors

You should see the following output:

 NAME      TYPE     STATE     TASKS
 datagen   source   PAUSED    0: PAUSED

Resume a connector

You can resume a paused connector using different tools.

To resume the source connector test, use the following command.

kcctl resume connectors test

You should see the following output:

Resumed connector test

If you want to verify whether the source connector has been resumed successfully, run the following command.

kcctl get connectors

You should see the following output:

 NAME      TYPE     STATE     TASKS
 datagen   source   RUNNING   0: RUNNING

What’s next?

Previous
Create Kafka Connects