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

nsqd: docker networking, broadcast TCP and HTTP ports #1073

Closed
heat opened this issue Aug 21, 2018 · 7 comments
Closed

nsqd: docker networking, broadcast TCP and HTTP ports #1073

heat opened this issue Aug 21, 2018 · 7 comments

Comments

@heat
Copy link

heat commented Aug 21, 2018

Hi folks, sory about my bad english.
I'm trying get up nsq services at containerum, at containerum the public port to services and container are random. With nsqlookupd and nsqadmin it's easy not a big trouble.
But when we try to run nsqd it's registrer ther right broadcast url but the follow ports that nsqd register is that expose in container and not the service port random assigned with the service.

  |Name   | Port       | Protocol  | Link                    |   
  | http  | 24455:4150 | TCP       | x2.containerum.io:24455 |  
  | https | 14384:4151 | TCP       | x2.containerum.io:14384 |

In admin I got this link to node x2.containerum.io:4151 but it should be x2.containerum.io:14384.
I appreciate your time

@ploxiln
Copy link
Member

ploxiln commented Aug 21, 2018

This is not currently possible.

nsqd tells nsqlookupd how this nsqd can be reached like so:

		ci["version"] = version.Binary
		ci["tcp_port"] = n.RealTCPAddr().Port
		ci["http_port"] = n.RealHTTPAddr().Port
		ci["hostname"] = hostname
		ci["broadcast_address"] = n.getOpts().BroadcastAddress

		cmd, err := nsq.Identify(ci)

So you can use the -broadcast-address option to give nsqd a different hostname or ip address to give to nsqlookupd and thus to other clients (and nsqadmin). But you can't specify different ports than the actual ports that nsqd listens on.

I use --net=host when running nsqd in a docker container. Alternatively, you could pick random ports, but pass them through as the same ports, and configure nsqd to listen on those particular random ports.

@heat
Copy link
Author

heat commented Aug 21, 2018

Thank you @ploxiln .
I my service docker containerum isn't possible to especify --net.

Alternatively, you could pick random ports, but pass them through as the same ports

This will be my next shot, but could I open a PR that adds two arguments -broadcast-tcp-port and -broadcast-http-port as a optional params ? Or we could add some doc in docker session about how to
configure port foward?

edit:

the above use case is when we want to use nsq with internet. I missmatch the concept that nsq is to run inside a private network. If our consumer and production apps have to run in a docker cluster the apps needs to be in same network.

@ploxiln
Copy link
Member

ploxiln commented Aug 30, 2018

I'm not really opposed to either idea:

  • add a section to the docs about this case with container cluster networking and ports
  • add -broadcast-tcp-port and -broadcast-http-port

@mreiferson mreiferson changed the title Identify nsqd with broadcast ports nsqd: broadcast TCP and HTTP ports Sep 9, 2018
@mreiferson mreiferson changed the title nsqd: broadcast TCP and HTTP ports nsqd: docker networking, broadcast TCP and HTTP ports Jan 5, 2019
@mreiferson mreiferson added the docs label Jan 5, 2019
@cloudzhou
Copy link

@ploxiln face the same question
so any pr?

@sidvenu
Copy link

sidvenu commented Nov 12, 2020

I'm not sure why this feature is not given priority yet, considering this can help simplify distributed deployments on systems. @ploxiln is anyone working on this PR right now? If not, can someone from my organisation work on this feature?

@ploxiln
Copy link
Member

ploxiln commented Nov 12, 2020

No one is currently working on this. If you're thinking of just adding those two flag options, go ahead 👍

For documentation updates, it may require some thought about where it fits best. (The website docs source are in https://github.com/nsqio/nsqio.github.io)

@ploxiln
Copy link
Member

ploxiln commented Nov 19, 2020

done in #1297

@ploxiln ploxiln closed this as completed Nov 19, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants