Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

why broadcast-address default value is hostname not ip #1245

Closed
barnettZQG opened this issue Apr 14, 2020 · 3 comments
Closed

why broadcast-address default value is hostname not ip #1245

barnettZQG opened this issue Apr 14, 2020 · 3 comments
Labels

Comments

@barnettZQG
Copy link

in my case, deploy nsq to kubernetes, hostname cannot be accessed by other services, but register IP it's no problem.

I can redo the docker image to solve this problem by getting the IP address and assigning the broadcast-address parameter before starting NSQD.

@ploxiln
Copy link
Member

ploxiln commented Apr 14, 2020

If you need to use ip addresses, you should specify the --broadcast-address={{ip_addr}} along with the rest of the command-line flags, or in the config file, generated by your deploy/cluster system.

The default is the hostname because the hostname should generally work for reaching the server. It might even have different "internal" and "external" addresses that resolve differently depending on where the consumer is, but always works for that consumer. It was designed in a more server-centric time, when you would typically run one instance of nsqd on each server.

@barnettZQG
Copy link
Author

docker-entrypoints.sh

#!/bin/sh

if [ "$1" = "sh" ];then
    sh
else
    exec /nsqd --lookupd-tcp-address=127.0.0.1:4160 --broadcast-address="${POD_IP}"
fi

@mreiferson
Copy link
Member

ping #1073

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants