Problem running Kafka Distributed as a service

We use Confluent Cloud with and external VM to run our 3rd party connectors.
Starting the connect-distributed from the command line is no problem. But when I try to set it up as service using confluent-kafka-connect.service

Description=Apache Kafka Connect - distributed

ExecStart=/usr/bin/connect-distributed /etc/kafka/


I see the following error in journalctl

WARN [AdminClient clientId=adminclient-1] Connection to node -1 (localhost/ could not be established. Broker may not be available. (org.apache.kafka.clients.NetworkClient:796)

I have no idea why this error appears.

Any help would be appreciated.

seems as your distributed connect cluser tries to connect to localhost.

my understanding is that your brokers are in confluent cloud?

1 Like

Yes, if you’re using Confluent Cloud you need to amend /etc/kafka/ to include the correct broker details per the documentation.


Yes, we use Confluent Cloud with on-prem Workers due to the fact that we use 3rd party connectors.

That is what I have been using and it works when I start it from the command line
(e.g. ./bin/connect-distributed ./etc/
The only difference is that I commented out the consumer. section as these VM’s only run producer connectors.

So it works from the command line but not when trying to use it as a service.


I would re-enable the consumer section.
Kafka Connect is also a consumer from the internal topics that it uses to store and fetch connector configuration, offsets, status, etc.


I have made that change and also double checked the permissions on the properties file. But no luck. Still the same error when trying to start the confluent-Kafka-connect service.
And again, running it from the command line, no problem.



Well I think I found a work around. The problem was that if you run it from the command line the process will stop when you close the connection to the VM (Linux machine).
But when you start /bin/connect-distributed without any parameters, it comes back with:
USAGE: /usr/bin/connect-distributed [-daemon]

So I tried to include the command -daemon and this seems to work to push the worker to the background and am able to close the terminal window without halting the process.

Might be worth to include this in the documentation as the -daemon parameter is nowhere discussed.

Thank you again for trying to help and the quick responses. Really appreciate it.


This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.