# Containerized Connect listeners vs rest.advertised

**URL:** <https://forum.confluent.io/t/containerized-connect-listeners-vs-rest-advertised/5197>\
**Category:** Kafka Connect\
**Created:** [3 June 2022 02:09 UTC](https://forum.confluent.io/t/containerized-connect-listeners-vs-rest-advertised/5197 "2022-06-03T02:09:57Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![mattimo](https://avatars.discourse-cdn.com/v4/letter/m/8edcca/32.png) [@mattimo](https://forum.confluent.io/u/mattimo)\
**Post date:** [3 June 2022 02:09 UTC](https://forum.confluent.io/t/containerized-connect-listeners-vs-rest-advertised/5197/1 "2022-06-03T02:09:57Z")

</div>

Im attempting to run a Kafka Connect container on Heroku, inside a private space.

Im hoping for help setting:  
`CONNECT_LISTENERS, CONNECT_REST_PORT, CONNECT_REST_ADVERTISED_HOST_NAME, CONNECT_REST_ADVERTISED_PORT`.

From my understanding:  
`CONNECT_LISTENERS` - this is the **external** endpoint for Kafka REST… thus `CONNECT_LISTENERS="http://myapp.herokuapp.com:$PORT}`

`CONNECT_REST_PORT` - If the process doesn’t bind to the servers port [Heroku dynos] within 60s, the dyno reboots. So `CONNECT_REST_PORT=${PORT}`

`CONNECT_REST_ADVERTISED_LISTENER="HTTP"` - This is http as heroku routes via http

Here comes the issue… Ive tried a variety of configs for the following…

`CONNECT_REST_ADVERTISED_HOST_NAME` - From the docs, this is the _ **internal** hostname/ip_ - so with (private space DNS discovery)[[Private Spaces DNS Service Discovery | Heroku Dev Center](https://devcenter.heroku.com/articles/dyno-dns-service-discovery#usage)], I can get an **internal** hostname of the form `http://web.myapp.app.localspace:` and with a private space, I can use a static port - say 5000.

The issue is, my REST API fails to bind…

```auto
2022-06-03T02:08:22.869326+00:00 app[web.1]: [2022-06-03 02:08:22,869] INFO jetty-9.4.43.v20210629; built: 2021-06-30T11:07:22.254Z; git: 526006ecfa3af7f1a27ef3a288e2bef7ea9dd7e8; jvm 11.0.13+8-LTS (org.eclipse.jetty.server.Server)
2022-06-03T02:08:22.894502+00:00 app[web.1]: [2022-06-03 02:08:22,891] ERROR Stopping due to error (org.apache.kafka.connect.cli.ConnectDistributed)
2022-06-03T02:08:22.894503+00:00 app[web.1]: org.apache.kafka.connect.errors.ConnectException: Unable to initialize REST server
2022-06-03T02:08:22.894503+00:00 app[web.1]: at org.apache.kafka.connect.runtime.rest.RestServer.initializeServer(RestServer.java:216)
2022-06-03T02:08:22.894504+00:00 app[web.1]: at org.apache.kafka.connect.cli.ConnectDistributed.startConnect(ConnectDistributed.java:101)
2022-06-03T02:08:22.894504+00:00 app[web.1]: at org.apache.kafka.connect.cli.ConnectDistributed.main(ConnectDistributed.java:80)
2022-06-03T02:08:22.894505+00:00 app[web.1]: Caused by: java.io.IOException: Failed to bind to myapp.herokuapp.com/52.202.52.153:33635
2022-06-03T02:08:22.894505+00:00 app[web.1]: at org.eclipse.jetty.server.ServerConnector.openAcceptChannel(ServerConnector.java:349)
2022-06-03T02:08:22.894506+00:00 app[web.1]: at org.eclipse.jetty.server.ServerConnector.open(ServerConnector.java:310)
2022-06-03T02:08:22.894506+00:00 app[web.1]: at org.eclipse.jetty.server.AbstractNetworkConnector.doStart(AbstractNetworkConnector.java:80)
2022-06-03T02:08:22.894507+00:00 app[web.1]: at org.eclipse.jetty.server.ServerConnector.doStart(ServerConnector.java:234)
2022-06-03T02:08:22.894507+00:00 app[web.1]: at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:73)
2022-06-03T02:08:22.894507+00:00 app[web.1]: at org.eclipse.jetty.server.Server.doStart(Server.java:401)
2022-06-03T02:08:22.894508+00:00 app[web.1]: at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:73)
2022-06-03T02:08:22.894508+00:00 app[web.1]: at org.apache.kafka.connect.runtime.rest.RestServer.initializeServer(RestServer.java:214)
2022-06-03T02:08:22.894509+00:00 app[web.1]: ... 2 more
2022-06-03T02:08:22.894509+00:00 app[web.1]: Caused by: java.net.BindException: Cannot assign requested address
2022-06-03T02:08:22.894510+00:00 app[web.1]: at java.base/sun.nio.ch.Net.bind0(Native Method)
2022-06-03T02:08:22.894510+00:00 app[web.1]: at java.base/sun.nio.ch.Net.bind(Net.java:455)
2022-06-03T02:08:22.894510+00:00 app[web.1]: at java.base/sun.nio.ch.Net.bind(Net.java:447)
2022-06-03T02:08:22.894511+00:00 app[web.1]: at java.base/sun.nio.ch.ServerSocketChannelImpl.bind(ServerSocketChannelImpl.java:227)
2022-06-03T02:08:22.894511+00:00 app[web.1]: at java.base/sun.nio.ch.ServerSocketAdaptor.bind(ServerSocketAdaptor.java:80)
2022-06-03T02:08:22.894512+00:00 app[web.1]: at org.eclipse.jetty.server.ServerConnector.openAcceptChannel(ServerConnector.java:344)
2022-06-03T02:08:22.894512+00:00 app[web.1]: ... 9 more
2022-06-03T02:08:27.675168+00:00 heroku[web.1]: Error R10 (Boo

```

What’s the correct differentiation between `CONNECT_LISTENERS` and `CONNECT_REST_ADVERTISED_HOST_NAME` for managed instances? I can configure as I wish, my ssl handshake completes, I can ping my kafka instance… but I cannot for the life of me stand up kafka connect

---

<div class="post-metadata">

**Author:** ![mmuehlbeyer](https://sea1.discourse-cdn.com/flex019/user_avatar/forum.confluent.io/mmuehlbeyer/32/1088_2.png) [@mmuehlbeyer](https://forum.confluent.io/u/mmuehlbeyer)\
**Post date:** [3 June 2022 06:39 UTC](https://forum.confluent.io/t/containerized-connect-listeners-vs-rest-advertised/5197/2 "2022-06-03T06:39:59Z")

</div>

hi @mattimo

welcome to the forum 🙂

**CONNECT\_LISTENERS:**  
defines the URIs the api will listen on  
will to bind to all interfaces if set to 0.0.0.0

e.g. `CONNECT_LISTENERS: 'http://0.0.0.0:8083'`

**CONNECT\_REST\_ADVERTISED\_HOST\_NAME**  
the hostname that will be given out to other workers to connect to.  
should be set to resolvable hostname

hth,  
michael

---

<div class="post-metadata">

**Author:** ![mattimo](https://avatars.discourse-cdn.com/v4/letter/m/8edcca/32.png) [@mattimo](https://forum.confluent.io/u/mattimo)\
**Post date:** [3 June 2022 22:37 UTC](https://forum.confluent.io/t/containerized-connect-listeners-vs-rest-advertised/5197/3 "2022-06-03T22:37:43Z")

</div>

Hi @mmuehlbeyer , thanks for the response. I know what these values _should_ be from the confluent/apache docs, but my question is on deeper prod configuration…

Can I get your thoughts on this example config?  
**CONNECT\_LISTENERS** - List of **external** hostname/ip:port where Kafaka REST listens on… this would be the URI I use to get a list of connectors, post a new connector, delete a connector, etc… So this would be `http://myapp.herokuapp.com:${PORT}`…?

**CONNECT\_REST\_ADVERTISED\_HOST\_NAME** - **internal** hostname of the connect worker. Im in a Private Space and can use [[Private Spaces DNS Service Discovery | Heroku Dev Center](https://devcenter.heroku.com/articles/dyno-dns-service-discovery#binding-to-the-private-network)]([https://DNS](https://DNS) Service Discovery) to allow dyno-to-dyno communication [worker-to-worker].

After enabling this feature and binding my app to a static port (e.g. 5000) and `HEROKU_PRIVATE_IP`, my app is reachable via **internal** traffic at:  
`http://web.myapp.app.localspace:5000/`

1. Should `CONNECT_LISTENERS` also contain the `CONNECT_REST_ADVERTISED_HOST_NAME:`CONNECT\_REST\_ADVERTISED\_PORT`?
2. My app binds successfully with `CONNECT_LISTENERS="HTTP://0.0.0.0:${PORT}`, but all other combinations of external or internal hostname/ip:port I’ve tried cause my app to fail…

Can you provide a prod example here?

---

<div class="post-metadata">

**Author:** ![mattimo](https://avatars.discourse-cdn.com/v4/letter/m/8edcca/32.png) [@mattimo](https://forum.confluent.io/u/mattimo)\
**Post date:** [6 June 2022 21:47 UTC](https://forum.confluent.io/t/containerized-connect-listeners-vs-rest-advertised/5197/4 "2022-06-06T21:47:50Z")

</div>

If anyone finds this, I solved by taking advantage of static port available in private spaces:

```auto
CONNECT_REST_ADVERTISED_HOST_NAME="${HEROKU_DNS_DYNO_NAME}"
CONNECT_LISTENERS="HTTP://0.0.0.0:${PORT},HTTP://0.0.0.0:8000"
CONNECT_REST_PORT="${PORT}"
CONNECT_REST_ADVERTISED_PORT=8000

```

---

<div class="post-metadata">

**Author:** ![mmuehlbeyer](https://sea1.discourse-cdn.com/flex019/user_avatar/forum.confluent.io/mmuehlbeyer/32/1088_2.png) [@mmuehlbeyer](https://forum.confluent.io/u/mmuehlbeyer)\
**Post date:** [7 June 2022 12:42 UTC](https://forum.confluent.io/t/containerized-connect-listeners-vs-rest-advertised/5197/5 "2022-06-07T12:42:14Z")

</div>

hey @mattimo

just for curiosity which docker image version did you use?

best,  
michael

---

<div class="post-metadata">

**Author:** ![mattimo](https://avatars.discourse-cdn.com/v4/letter/m/8edcca/32.png) [@mattimo](https://forum.confluent.io/u/mattimo)\
**Post date:** [7 June 2022 19:28 UTC](https://forum.confluent.io/t/containerized-connect-listeners-vs-rest-advertised/5197/6 "2022-06-07T19:28:21Z")

</div>

@mmuehlbeyer I used `confluentinc/cp-kafka-connect-base:6.1.4` and extended the image from there. I plan to post a public repo & walk-through soon - this was quite difficult to get up-and-running on Heroku, inside a Private Space… Happy to send the repo over once I do, I think it would benefit people who come across in the future… this was quite a headache to set up correctly (Heroku docs are very sparse)

Would you mind taking a look at my recent post [Debezium SQLServer connector failed SSL handshake](https://forum.confluent.io/t/debezium-sqlserver-connector-failed-ssl-handshake/5230)? I’m very close to finally setting this up…

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex019/uploads/confluentcommunity/original/1X/c49438c90c9df282e9996fdf6971be890c71b65a.svg) [@system](https://forum.confluent.io/u/system)\
**Post date:** [7 July 2022 19:29 UTC](https://forum.confluent.io/t/containerized-connect-listeners-vs-rest-advertised/5197/7 "2022-07-07T19:29:16Z")

</div>

Closed on 7 July 2022 19:29 UTC

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