Connect CLI

Kafka Connect CLI Download

This is a tiny command line interface (CLI) around the Kafka Connect REST Interface to manage connectors. It is used in a git like fashion where the first program argument indicates the command: it can be one of ps|get|rm|create|run|diff|status|plugins|describe|validate|restart|pause|resume.

The CLI is meant to behave as a good unix citizen: input from stdin; output to stdout; out of band info to stderr and non-zero exit status on error. Commands dealing with configuration expect or produce data in .properties style: key=value lines and comments start with a #. Json config files can be used with the -f | --format flag.

You can override the default endpoint by setting an environment variable KAFKA_CONNECT_REST or the -e | --endpoint flag i.e.

export KAFKA_CONNECT_REST="http://myserver:myport"
connect-cli 1.0.6
Usage: connect-cli [ps|get|rm|create|run|diff|status|plugins|describe|validate|restart|pause|resume] [options] [<connector-name>]

--help
        prints this usage text
-e <value> | --endpoint <value>
        Kafka Connect REST URL, default is http://localhost:8083/
-f <value> | --format <value>
        Format of the config, default is PROPERTIES. Valid options are 'properties' and 'json'.

Command: ps
list active connectors names.

Command: get
get the configuration of the specified connector.

Command: rm
remove the specified connector.

Command: create
create the specified connector with the config from stdin; the connector cannot already exist.

Command: run
create or update the specified connector with the config from stdin.

Command: diff
diff the specified connector with the config from stdin.

Command: status
get connector and it's task(s) state(s).

Command: plugins
list the available connector class plugins on the classpath.

Command: describe
list the configurations for a connector class plugin on the classpath.

Command: pause
pause the specified connector.

Command: restart
restart the specified connector.

Command: resume
resume the specified connector.

Command: validate
validate the connector config from stdin against a connector class plugin on the classpath.

Get Active Connectors

Command: ps

Example:

$ ./connect-cli ps
twitter-source

Get Connector Information

Command: get

Example:

$ ./connect-cli get twitter-source
#Connector `twitter-source`:
name=twitter-source
tasks.max=1

(snip)

track.terms=test
#task ids: 0

Delete a Connector

Command: rm

Example:

$ ./connect-cli rm twitter-source

Create a New Connector

The connector cannot already exist.

Command: create

Example:

$ ./connect-cli create twitter-source <twitter.properties
#Connector `twitter-source`:
name=twitter-source
tasks.max=1

(snip)

track.terms=test
#task ids: 0

Create or Update a Connector

Either starts a new connector if it did not exist, or update an existing connector.

Command: run

Example:

$ ./connect-cli run twitter-source <twitter.properties
#Connector `twitter-source`:
name=twitter-source
tasks.max=1

(snip)

track.terms=test
#task ids: 0

List available Connectors

List the Connector plugins available on the worker.

Command: plugins

Example:

$ ./connect-cli plugins
Class name: com.datamountaineer.streamreactor.connect.azure.documentdb.sink.DocumentDbSinkConnector, Type: Sink, Version: 3.0.0

Pause a Connector

Pauses the specified Connector.

Command: pause

Example:

$ ./connect-cli pause twitter-source

Resume a Connector

Resumes the specified Connector.

Command: resume

Example:

$ ./connect-cli resume twitter-source

Describe a Connector

Describe the required configuration of a Connector class.

Command: describe

Example:

$ ./connect-cli describe com.datamountaineer.streamreactor.connect.cassandra.sink.CassandraSinkConnector

Validate a Connector Config

Validate a connector properties file.

Command: validate

Example:

$ ./connect-cli validate ConnectorClassName < connector.properties

Diff a Connector Config

Diff a connector properties file against a running connector.

Command: diff

Example:

$ ./connect-cli diff twitter-source  < connector.properties