Connector Monitoring
It is possible to monitor a connector:
You can retrieve the state of a connector and its tasks in the CLI ksqlDB with the command:
SHOW CONNECTORS;
````
For errors that lead to the termination of a task, once the administrator has resolved the problem (for example, a permissions issue with writing a file), the task can be restarted with the following commands (these commands use the REST interface of Kafka Connect):
curl localhost:8083/connectors
This command retrieves the list of the connector's tasks and provides information about them, such as their ID and status.
curl localhost:8083/connectors/
Replace **connectorName** with the name of the connector retrieved with the previous command (case sensitive).
You can then restart the **FAILED** tasks with the command:
curl -X POST localhost:8083/connectors/connectorName/tasks/taskId/restart ```
Here, replace taskId with the ID of the task retrieved with the previous command, and connectorName with the name of the connector (case sensitive) from two commands ago.
For more information and commands about the monitoring of connectors/tasks, follow this link: Confluent Documentation.
It is important to note that when a task goes to the FAILED state, the partitions that it was responsible for are redistributed among the remaining RUNNING tasks. Consequently, if there is an error in the put method of the initial task, the same data may cause the same error in the newly assigned task, potentially leading to all tasks of the connector being stopped. In this case, you need to restart all FAILED tasks of the connector once the issue is resolved.
Moreover, if a worker leaves the cluster, the connectors/tasks associated with this worker enter the UNASSIGNED state for 5 minutes (default value of the scheduled.rebalance.max.delay.ms worker property). If the worker does not return after 5 minutes, the connectors/tasks are reassigned to new workers in the cluster.
If tasks are added or removed, the partitions can also be rebalanced and redistributed among the new number of tasks (partition rebalance).