Hi Jaikiran, maybe this would help. I use Kafka inside VirtualBox, with no DNS and potentially changing IP when guest is started. So, in my Kafka startup script that runs on boot, I just replace the advertised.host.name with the current external IP (it runs after network is up):
sed -i "/^advertised.host.name/c\advertised.host.name=`hostname -I`" $KAFKA_HOME/config/server.properties nohup kafka-server-start.sh $KAFKA_HOME/config/server.properties >/dev/null Does that work for you? Ofir Manor Co-Founder & CTO | Equalum Mobile: +972-54-7801286 | Email: ofir.ma...@equalum.io On Wed, Jan 20, 2016 at 3:20 PM, Jaikiran Pai <jai.forums2...@gmail.com> wrote: > We are using Kafka 0.9.0 on our dev setups. We see that the Kafka > configurations currently expose a way to configure the host.name and/or > advertised.host.name which state: > > # Hostname the broker will bind to. If not set, the server will bind to > all interfaces > #host.name= > > # Hostname the broker will advertise to producers and consumers. If not > set, it uses the > # value for "host.name" if configured. Otherwise, it will use the value > returned from > # java.net.InetAddress.getCanonicalHostName(). > #advertised.host.name=<hostname routable by clients> > > The problem for us is that for our system where we use Kafka, we don't use > a DNS server and the IP allocation/assignment to the machine is via DHCP. > As a result we don't have a set DNS name nor know the IP address before > hand. However, we do know the network interface name to which we want the > Kafka server to be using. Would it be possible add a feature where the > config property could expose something like a advertised.host.interface > which takes the name of the network interface which the Kafka server will > use? Internally the implementation could then use any of the IP addresses > returned by > http://docs.oracle.com/javase/7/docs/api/java/net/NetworkInterface.html#getInterfaceAddresses%28%29 > after looking up the NetworkInterface by name > http://docs.oracle.com/javase/7/docs/api/java/net/NetworkInterface.html#getByName%28java.lang.String%29 > > > > Is this something that could be added as an enhancement? > > -Jaikiran > >