Hi Jared,

I like the idea of allowing communication with ZK on only the IP addresses
specified in the config file. This is useful when you are having a host with
multiple IP address and/or when you want to have traffic isolation. In our
setup, we will use this feature for traffic isolation. We have multiple
interfaces on the server, and we want to route certain type of traffic
through certain interfaces.

Why not have this feature for both FLE and leader-follower communication? I
would suggest to keep this optional (add a property) since most users would
prefer to have the ability to reach the servers from all interfaces.

-Vishal

On Thu, Aug 26, 2010 at 1:34 PM, Jared Cantwell <jared.cantw...@gmail.com>wrote:

> Hello,
>
> My project currently has the need to specify the local address that is used
> for leader communication (and not use the default of listening on all
> interfaces).  This is similar to the clientPortAddress parameter that was
> recently added.  After reviewing the code, we can't think of a reason why
> only the port would be used with the wildcard interface, when servers are
> already connecting specifically to that interface anyway.  Is binding to
> the
> wildcard interface for leader communication intentional?
>
> I believe the change would be straightforward-- one change for each leader
> port used.  Note: this doesn't account for all leader election algorithms,
> only the default.
>
> Index:
> src/java/main/org/apache/zookeeper/server/quorum/QuorumCnxManager.java
> ===================================================================
> ---
> src/java/main/org/apache/zookeeper/server/quorum/QuorumCnxManager.java
> (revision 989805)
> +++
> src/java/main/org/apache/zookeeper/server/quorum/QuorumCnxManager.java
> (working copy)
> @@ -434,7 +434,7 @@
>                     ss = ServerSocketChannel.open();
>                     int port =
> self.quorumPeers.get(self.getId()).electionAddr.getPort();
>                     ss.socket().setReuseAddress(true);
> -                    InetSocketAddress addr = new InetSocketAddress(port);
> +                    InetSocketAddress addr =
> self.quorumPeers.get(self.getId()).electionAddr;
>                     LOG.info("My election bind port: " + addr.toString());
>                     setName(addr.toString());
>                     ss.socket().bind(addr);
> Index: src/java/main/org/apache/zookeeper/server/quorum/Leader.java
> ===================================================================
> --- src/java/main/org/apache/zookeeper/server/quorum/Leader.java
> (revision 989805)
> +++ src/java/main/org/apache/zookeeper/server/quorum/Leader.java
>  (working
> copy)
> @@ -128,10 +128,11 @@
>     Leader(QuorumPeer self,LeaderZooKeeperServer zk) throws IOException {
>         this.self = self;
>         try {
> -            ss = new ServerSocket(self.getQuorumAddress().getPort());
> +            ss = new ServerSocket();
> +        ss.bind(self.getQuorumAddress());
>         } catch (BindException e) {
> -            LOG.error("Couldn't bind to port "
> -                    + self.getQuorumAddress().getPort(), e);
> +            LOG.error("Couldn't bind to address "
> +                    + self.getQuorumAddress().getAddress() + ":" +
> self.getQuorumAddress().getPort(), e);
>             throw e;
>         }
>         this.zk=zk;
>
>
> Does this seem like a reasonable change? Thoughts?
>
> ~Jared
>

Reply via email to