Unable to initialize REST server (Address already is use)

Iam using landoop/fast-data-dev image for practicing and I am facing the same issue. I am totally stuck.

  • Operating System: ubuntu-20.04.1-desktop-amd64
  • Docker version: 20.10.7
  • landoop/fast-data-dev image tag: 3.3 (the leatest)
  • Kafka version: 3.3.1-L0

docker compose file

  kafka-cluster:
    image: landoop/fast-data-dev:latest
    environment:
      ADV_HOST: 127.0.0.1         
      RUNTESTS: 0                 
    ports:
      - 2181:2181                
      - 3030:3030                
      - 8081-8083:8081-8083       
      - 9581-9585:9581-9585       
      - 9092:9092
  1. I used my compose file to create the cluster.
ahmed@ubuntu-desktop:~/kafka/kafka-connect$ docker-compose up kafka-cluster
Creating kafka-connect_kafka-cluster_1 ... done
Attaching to kafka-connect_kafka-cluster_1
kafka-cluster_1  | Setting advertised host to 127.0.0.1.
kafka-cluster_1  | Starting services.
kafka-cluster_1  | This is Lenses.io’s fast-data-dev. Kafka 3.3.1-L0 (Lenses.io's Kafka Distribution).
kafka-cluster_1  | You may visit http://127.0.0.1:3030 in about a minute.
kafka-cluster_1  | 2023-02-28 00:04:04,881 INFO Included extra file "/etc/supervisord.d/01-zookeeper.conf" during parsing
kafka-cluster_1  | 2023-02-28 00:04:04,881 INFO Included extra file "/etc/supervisord.d/02-broker.conf" during parsing
kafka-cluster_1  | 2023-02-28 00:04:04,881 INFO Included extra file "/etc/supervisord.d/03-schema-registry.conf" during parsing
kafka-cluster_1  | 2023-02-28 00:04:04,881 INFO Included extra file "/etc/supervisord.d/04-rest-proxy.conf" during parsing
kafka-cluster_1  | 2023-02-28 00:04:04,881 INFO Included extra file "/etc/supervisord.d/05-connect-distributed.conf" during parsing
kafka-cluster_1  | 2023-02-28 00:04:04,881 INFO Included extra file "/etc/supervisord.d/06-caddy.conf" during parsing
kafka-cluster_1  | 2023-02-28 00:04:04,881 INFO Included extra file "/etc/supervisord.d/08-logs-to-kafka.conf" during parsing
kafka-cluster_1  | 2023-02-28 00:04:04,881 INFO Included extra file "/etc/supervisord.d/99-supervisord-sample-data.conf" during parsing
kafka-cluster_1  | 2023-02-28 00:04:04,881 INFO Set uid to user 0 succeeded
kafka-cluster_1  | 2023-02-28 00:04:04,885 INFO RPC interface 'supervisor' initialized
kafka-cluster_1  | 2023-02-28 00:04:04,885 CRIT Server 'unix_http_server' running without any HTTP authentication checking
kafka-cluster_1  | 2023-02-28 00:04:04,886 INFO supervisord started with pid 7
kafka-cluster_1  | 2023-02-28 00:04:05,888 INFO spawned: 'broker' with pid 182
kafka-cluster_1  | 2023-02-28 00:04:05,891 INFO spawned: 'caddy' with pid 183
kafka-cluster_1  | 2023-02-28 00:04:05,894 INFO spawned: 'connect-distributed' with pid 184
kafka-cluster_1  | 2023-02-28 00:04:05,896 INFO spawned: 'logs-to-kafka' with pid 186
kafka-cluster_1  | 2023-02-28 00:04:05,899 INFO spawned: 'rest-proxy' with pid 192
kafka-cluster_1  | 2023-02-28 00:04:05,903 INFO spawned: 'sample-data' with pid 197
kafka-cluster_1  | 2023-02-28 00:04:05,905 INFO spawned: 'schema-registry' with pid 198
kafka-cluster_1  | 2023-02-28 00:04:05,908 INFO spawned: 'zookeeper' with pid 200
kafka-cluster_1  | 2023-02-28 00:04:06,905 INFO success: broker entered RUNNING state, process has stayed up for > than 1 seconds (startsecs)
kafka-cluster_1  | 2023-02-28 00:04:06,906 INFO success: caddy entered RUNNING state, process has stayed up for > than 1 seconds (startsecs)
kafka-cluster_1  | 2023-02-28 00:04:06,906 INFO success: connect-distributed entered RUNNING state, process has stayed up for > than 1 seconds (startsecs)
kafka-cluster_1  | 2023-02-28 00:04:06,907 INFO success: logs-to-kafka entered RUNNING state, process has stayed up for > than 1 seconds (startsecs)
kafka-cluster_1  | 2023-02-28 00:04:06,907 INFO success: rest-proxy entered RUNNING state, process has stayed up for > than 1 seconds (startsecs)
kafka-cluster_1  | 2023-02-28 00:04:06,907 INFO success: sample-data entered RUNNING state, process has stayed up for > than 1 seconds (startsecs)
kafka-cluster_1  | 2023-02-28 00:04:06,908 INFO success: schema-registry entered RUNNING state, process has stayed up for > than 1 seconds (startsecs)
kafka-cluster_1  | 2023-02-28 00:04:06,908 INFO success: zookeeper entered RUNNING state, process has stayed up for > than 1 seconds (startsecs)
kafka-cluster_1  | 2023-02-28 00:05:21,755 INFO exited: logs-to-kafka (exit status 0; expected)
kafka-cluster_1  | 2023-02-28 00:05:54,430 INFO exited: sample-data (exit status 0; expected)
  1. I got in the container and created my topic succesfully then saw in UI.
  2. after that I rechecked the port and I found it used by docker:

Futher information

my worker file

bootstrap.servers=127.0.0.1:9092
key.converter=org.apache.kafka.connect.json.JsonConverter
key.converter.schemas.enable=false
value.converter=org.apache.kafka.connect.json.JsonConverter
value.converter.schemas.enable=false
internal.key.converter=org.apache.kafka.connect.json.JsonConverter
internal.key.converter.schemas.enable=false
internal.value.converter=org.apache.kafka.connect.json.JsonConverter
internal.value.converter.schemas.enable=false
rest.port=8086
rest.host.name=127.0.0.1
offset.storage.file.filename=standalone.offsets
offset.flush.interval.ms=10000

my Standalone connector file

name=file-stream-demo-standalone
connector.class=org.apache.kafka.connect.file.FileStreamSourceConnector
tasks.max=1
file=demo-file.txt
topic=demo-1-standalone

when I used the following CLI I got the below error:
connect-standalone worker.properties file-stream-demo-standalone.properties

ERROR Stopping due to error (org.apache.kafka.connect.cli.ConnectStandalone:126)
org.apache.kafka.connect.errors.ConnectException: Unable to initialize REST server
at org.apache.kafka.connect.runtime.rest.RestServer.initializeServer(RestServer.java:203)
at org.apache.kafka.connect.cli.ConnectStandalone.main(ConnectStandalone.java:86)
Caused by: java.io.IOException: Failed to bind to 0.0.0.0/0.0.0.0:8083
at org.eclipse.jetty.server.ServerConnector.openAcceptChannel(ServerConnector.java:349)
at org.eclipse.jetty.server.ServerConnector.open(ServerConnector.java:310)
at org.eclipse.jetty.server.AbstractNetworkConnector.doStart(AbstractNetworkConnector.java:80)
at org.eclipse.jetty.server.ServerConnector.doStart(ServerConnector.java:234)
at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:73)
at org.eclipse.jetty.server.Server.doStart(Server.java:401)
at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:73)
at org.apache.kafka.connect.runtime.rest.RestServer.initializeServer(RestServer.java:201)
… 1 more
Caused by: java.net.BindException: Address already in use
at java.base/sun.nio.ch.Net.bind0(Native Method)
at java.base/sun.nio.ch.Net.bind(Net.java:459)
at java.base/sun.nio.ch.Net.bind(Net.java:448)
at java.base/sun.nio.ch.ServerSocketChannelImpl.bind(ServerSocketChannelImpl.java:227)
at java.base/sun.nio.ch.ServerSocketAdaptor.bind(ServerSocketAdaptor.java:80)
at org.eclipse.jetty.server.ServerConnector.openAcceptChannel(ServerConnector.java:344)

hey @repotec

according to the landoop docs a connect cluster is started in distributed mode:

no need to run a connect separately.

best,
michael

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