vert-x3 / issues

Apache License 2.0
37 stars 7 forks source link

EventBus ports, should all be in VertxOptions and should be documented how they work #45

Open apatrida opened 9 years ago

apatrida commented 9 years ago

For EventBus, you have the VertxOptions.setClusterPort() and setClusterHost() but it is not clearly documented how a port is selected without these (random port, what range, ...?) And for overriding the public published host/port for the cluster it changes to be system properties instead of VertxOptions

So, add setClusterPublicPort and setClusterPublicHost to VertxOptions and document these settings for how they work. Knowing about vertx.cluster.public.port and vertx.cluster.public.host doesn't appear in documentation for vert-x3. And that they override the other setClusterPort() and setClusterhost()

This is important for things like Docker where your internal port/host may not be the same as the public. We are doing a Docker+EC2 discovery (ECS) and it was not obvious where/how to find these properties and how they work.

purplefox commented 9 years ago

Hi Jason:

For EventBus, you have the VertxOptions.setClusterPort() and setClusterHost() but it is not clearly documented how a port is selected without these (random port, what range, ...?)

The default values for cluster host and cluster port are documented in the javadoc for VertxOptions:

http://vertx.io/docs/apidocs/io/vertx/core/VertxOptions.html

And for overriding the public published host/port for the cluster it changes to be system properties instead of VertxOptions

VertxOptions doesn't know anything about system properties. Are you referring to running from the command line? You should use -clusterHost and -clusterPort to specify cluster host and cluster port when doing this.

apatrida commented 9 years ago

@purplefox referring to VertxImpl line 159..166

                // Obtain system configured public host/port
                int publicPort = Integer.getInteger("vertx.cluster.public.port", -1);
                String publicHost = System.getProperty("vertx.cluster.public.host", null);

                // If using a wilcard port (0) then we ask the server for the actual port:
                int serverPort = publicPort == -1 ? server.actualPort() : publicPort;
                String serverHost = publicHost == null ? options.getClusterHost() : publicHost;
                ServerID serverID = new ServerID(serverPort, serverHost);

Not referring to running from the command-line, referring to any time that you need different public port/host than VertxOptions setClusterPort/setClusterHost.

purplefox commented 9 years ago

Hmm.. I actually don't know what "vertx.cluster.public.port" and "vertx.cluster.public.host" are supposed to do. I'm not sure how this code got added.

Will investigate.

purplefox commented 9 years ago

I agree however this should be in VertxOptions (once I've figured out why it's here in the first place!).

apatrida commented 9 years ago

They are needed for cases like this, AWS, etc. where the port+host you want to listen on, are not the same as other cluster nodes require to communicate with you. (private vs. public address when across VPC. docker host vs. docker container address/port)

apatrida commented 9 years ago

On documentation, it is helpful for people that have containers or firewalls to know how ports are allocated. So in the place it describes event bus, clustering, etc. A quick description of how ports are assigned is handy, before you have to find that VertxOptions has the special setting you are looking for, which doesn't describe if ports are chosen in a reliable way (i.e. ElasticSearch starts at 9200 and increments, 9300 and increments) or some random other method.