Automatically restarting failed Kafka Connectors and Connect Tasks

curl --user "<USERNAME:PASSWORD>" -s https://<SERVER_NAME>:8083/connectors| jq '.[]'| \
xargs -I{connector_name} curl --user "<USERNAME:PASSWORD>" -s https://<SERVER_NAME>:8083/connectors/{connector_name}"/status"| \
jq -c -M '[.name,.connector.state]|join(":|:")'| column -s : -t| sed 's/\"//g'| sort

sink-elastic-orders-00 | RUNNING | RUNNING
ora-ba1-aerospike-testing-2 | RUNNING | FAILED
curl -X POST --user "<USERNAME:PASSWORD>" https://<SERVER_NAME>:8083/connectors/ora-ba1-aerospike-testing-2/tasks/0/restart
curl --user "<USERNAME:PASSWORD>" -s https://<SERVER_NAME>:8083/connectors"| \
jq '.[]'| \
xargs -I{connector_name} curl -s "http://localhost:8083/connectors/"{connector_name}"/status"| \
jq -c -M '[.name,.connector.state,.tasks[].state]|join(":|:")'| \
column -s : -t| sed 's/\"//g'| sort

sink-elastic-orders-00 | RUNNING | RUNNING
ora-ba1-aerospike-testing-2 | RUNNING | RUNNING
SERVER_NAME={{ inventory_hostname }}
USERNAME={{ kafka_user }}
PASSWORD={{ kafka_password }}
*/5 * * * * /app/connectors/connector_auto_start.sh 2>&1 >> /app/connectors/connector_auto_start.log
/app/connectors/connector_auto_start.log{
weekly
copytruncate
create 644 root root
dateext
rotate 4
compress
missingok
}

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store