ZooKeeper
  1. ZooKeeper
  2. ZOOKEEPER-635

Server supports listening on a specified network address

    Details

    • Type: New Feature New Feature
    • Status: Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 3.2.1
    • Fix Version/s: 3.3.0
    • Component/s: server
    • Labels:
      None
    • Hadoop Flags:
      Reviewed
    • Tags:
      server option address

      Description

      The issue in maililist is located:
      http://mail-archives.apache.org/mod_mbox/hadoop-zookeeper-user/200912.mbox/%3c4ac0d28c0912210242g58230a9ds1c55361561c70d61@mail.gmail.com%3e

      I have checked the server size code, seems no this option provided. This feature is useful when we have more than two network interfaces, one for Internet and others for intranet. We want to run ZooKeeper in our intranet and not be exposed to outside world.

      1. ZOOKEEPER-635.patch
        32 kB
        Patrick Hunt
      2. ZOOKEEPER-635.patch
        32 kB
        Patrick Hunt
      3. ZOOKEEPER-635.patch
        44 kB
        Patrick Hunt

        Issue Links

          Activity

          Hide
          Patrick Hunt added a comment -

          Would be great to include in 3.3.0, esp if someone is willing to create the patch?

          Show
          Patrick Hunt added a comment - Would be great to include in 3.3.0, esp if someone is willing to create the patch?
          Hide
          Patrick Hunt added a comment -

          this patch adds new clientPortBindAddress and clientPortBindHostname options for the config file.
          I updated the existing tests (port only) but I could not figure out a good (meaning reliable) way ot
          testing address/hostname, something that would work on any system regardless of network
          configuration (ip v4/6, hostname setup, resove.conf, etc...) If you have an idea go ahead and update,
          otw probably good to go ( I did test manually both options as well a default)

          be sure to verify the doc changes as well (and commit the updated docs obv)

          Show
          Patrick Hunt added a comment - this patch adds new clientPortBindAddress and clientPortBindHostname options for the config file. I updated the existing tests (port only) but I could not figure out a good (meaning reliable) way ot testing address/hostname, something that would work on any system regardless of network configuration (ip v4/6, hostname setup, resove.conf, etc...) If you have an idea go ahead and update, otw probably good to go ( I did test manually both options as well a default) be sure to verify the doc changes as well (and commit the updated docs obv)
          Hide
          Hadoop QA added a comment -

          +1 overall. Here are the results of testing the latest attachment
          http://issues.apache.org/jira/secure/attachment/12431049/ZOOKEEPER-635.patch
          against trunk revision 901510.

          +1 @author. The patch does not contain any @author tags.

          +1 tests included. The patch appears to include 33 new or modified tests.

          +1 javadoc. The javadoc tool did not generate any warning messages.

          +1 javac. The applied patch does not increase the total number of javac compiler warnings.

          +1 findbugs. The patch does not introduce any new Findbugs warnings.

          +1 release audit. The applied patch does not increase the total number of release audit warnings.

          +1 core tests. The patch passed core unit tests.

          +1 contrib tests. The patch passed contrib unit tests.

          Test results: http://hudson.zones.apache.org/hudson/job/Zookeeper-Patch-h7.grid.sp2.yahoo.net/46/testReport/
          Findbugs warnings: http://hudson.zones.apache.org/hudson/job/Zookeeper-Patch-h7.grid.sp2.yahoo.net/46/artifact/trunk/build/test/findbugs/newPatchFindbugsWarnings.html
          Console output: http://hudson.zones.apache.org/hudson/job/Zookeeper-Patch-h7.grid.sp2.yahoo.net/46/console

          This message is automatically generated.

          Show
          Hadoop QA added a comment - +1 overall. Here are the results of testing the latest attachment http://issues.apache.org/jira/secure/attachment/12431049/ZOOKEEPER-635.patch against trunk revision 901510. +1 @author. The patch does not contain any @author tags. +1 tests included. The patch appears to include 33 new or modified tests. +1 javadoc. The javadoc tool did not generate any warning messages. +1 javac. The applied patch does not increase the total number of javac compiler warnings. +1 findbugs. The patch does not introduce any new Findbugs warnings. +1 release audit. The applied patch does not increase the total number of release audit warnings. +1 core tests. The patch passed core unit tests. +1 contrib tests. The patch passed contrib unit tests. Test results: http://hudson.zones.apache.org/hudson/job/Zookeeper-Patch-h7.grid.sp2.yahoo.net/46/testReport/ Findbugs warnings: http://hudson.zones.apache.org/hudson/job/Zookeeper-Patch-h7.grid.sp2.yahoo.net/46/artifact/trunk/build/test/findbugs/newPatchFindbugsWarnings.html Console output: http://hudson.zones.apache.org/hudson/job/Zookeeper-Patch-h7.grid.sp2.yahoo.net/46/console This message is automatically generated.
          Hide
          Patrick Hunt added a comment -

          Added a note to the docs that this is new in 3.3

          Show
          Patrick Hunt added a comment - Added a note to the docs that this is new in 3.3
          Hide
          Hadoop QA added a comment -

          +1 overall. Here are the results of testing the latest attachment
          http://issues.apache.org/jira/secure/attachment/12431052/ZOOKEEPER-635.patch
          against trunk revision 901510.

          +1 @author. The patch does not contain any @author tags.

          +1 tests included. The patch appears to include 33 new or modified tests.

          +1 javadoc. The javadoc tool did not generate any warning messages.

          +1 javac. The applied patch does not increase the total number of javac compiler warnings.

          +1 findbugs. The patch does not introduce any new Findbugs warnings.

          +1 release audit. The applied patch does not increase the total number of release audit warnings.

          +1 core tests. The patch passed core unit tests.

          +1 contrib tests. The patch passed contrib unit tests.

          Test results: http://hudson.zones.apache.org/hudson/job/Zookeeper-Patch-h7.grid.sp2.yahoo.net/48/testReport/
          Findbugs warnings: http://hudson.zones.apache.org/hudson/job/Zookeeper-Patch-h7.grid.sp2.yahoo.net/48/artifact/trunk/build/test/findbugs/newPatchFindbugsWarnings.html
          Console output: http://hudson.zones.apache.org/hudson/job/Zookeeper-Patch-h7.grid.sp2.yahoo.net/48/console

          This message is automatically generated.

          Show
          Hadoop QA added a comment - +1 overall. Here are the results of testing the latest attachment http://issues.apache.org/jira/secure/attachment/12431052/ZOOKEEPER-635.patch against trunk revision 901510. +1 @author. The patch does not contain any @author tags. +1 tests included. The patch appears to include 33 new or modified tests. +1 javadoc. The javadoc tool did not generate any warning messages. +1 javac. The applied patch does not increase the total number of javac compiler warnings. +1 findbugs. The patch does not introduce any new Findbugs warnings. +1 release audit. The applied patch does not increase the total number of release audit warnings. +1 core tests. The patch passed core unit tests. +1 contrib tests. The patch passed contrib unit tests. Test results: http://hudson.zones.apache.org/hudson/job/Zookeeper-Patch-h7.grid.sp2.yahoo.net/48/testReport/ Findbugs warnings: http://hudson.zones.apache.org/hudson/job/Zookeeper-Patch-h7.grid.sp2.yahoo.net/48/artifact/trunk/build/test/findbugs/newPatchFindbugsWarnings.html Console output: http://hudson.zones.apache.org/hudson/job/Zookeeper-Patch-h7.grid.sp2.yahoo.net/48/console This message is automatically generated.
          Hide
          Benjamin Reed added a comment -

          do we really need both clientPortBindAddress and clientPortBindHostname? especially since they do the same thing...

          we need a test case for this. we should configure the server to bind to an interface address and attempt to connect to it using localhost.

          Show
          Benjamin Reed added a comment - do we really need both clientPortBindAddress and clientPortBindHostname? especially since they do the same thing... we need a test case for this. we should configure the server to bind to an interface address and attempt to connect to it using localhost.
          Hide
          Patrick Hunt added a comment -

          I wrote the docs first, then during impl noticed that the two funnel down to the same code. I thought about it a bit
          and convinced myself that having two variable made it more understandable to the user, so I didn't change it from
          my original approach. I could go either way though. What would you call it if there's just one? clientPortBindAddress
          and just spec in the docs that it's either ip addr or name?

          Re the testing I was concerned that I could not get reproduceable tests if I tried tying it to a particular interface. Do
          you know (think of) a bulletproof approach? Something that will work in all cases, incl ipv6 (esp where the hosts
          file might cause problems)

          Show
          Patrick Hunt added a comment - I wrote the docs first, then during impl noticed that the two funnel down to the same code. I thought about it a bit and convinced myself that having two variable made it more understandable to the user, so I didn't change it from my original approach. I could go either way though. What would you call it if there's just one? clientPortBindAddress and just spec in the docs that it's either ip addr or name? Re the testing I was concerned that I could not get reproduceable tests if I tried tying it to a particular interface. Do you know (think of) a bulletproof approach? Something that will work in all cases, incl ipv6 (esp where the hosts file might cause problems)
          Hide
          Benjamin Reed added a comment -

          i think clientPortBindAddress is good. it's kind of confusing to have two variables that do the same thing, especially since people are used to using ip addresses and hostnames interchangably.

          for the test i would use NetworkInterface.getInterfaces and use IP addresses.

          Show
          Benjamin Reed added a comment - i think clientPortBindAddress is good. it's kind of confusing to have two variables that do the same thing, especially since people are used to using ip addresses and hostnames interchangably. for the test i would use NetworkInterface.getInterfaces and use IP addresses.
          Hide
          Patrick Hunt added a comment -

          this patch is the same as the last except:

          1) removed the clientportbindhostname and move to just using the bind address
          2) added a new test (be sure to svn add it) that verifies binding to a specific address

          3) my machine has ipv6 addr for the lo, which the test uses. this was failing. I needed to fix the ZooKeeper client to allow ipv6 addresses (see ZOOKEEPER-667). Currently the ipv6 connect string is specified as ipv6:port where we look for the last :# and use that as the port. this should work fine but it means that the user must always specify ipv6:port, whereas for ipv4 you can just specify the ipv4address and the port will default to 2181, see 667 for more details on this.

          Show
          Patrick Hunt added a comment - this patch is the same as the last except: 1) removed the clientportbindhostname and move to just using the bind address 2) added a new test (be sure to svn add it) that verifies binding to a specific address 3) my machine has ipv6 addr for the lo, which the test uses. this was failing. I needed to fix the ZooKeeper client to allow ipv6 addresses (see ZOOKEEPER-667 ). Currently the ipv6 connect string is specified as ipv6:port where we look for the last :# and use that as the port. this should work fine but it means that the user must always specify ipv6:port, whereas for ipv4 you can just specify the ipv4address and the port will default to 2181, see 667 for more details on this.
          Hide
          Benjamin Reed added a comment -

          +1 looks good

          Show
          Benjamin Reed added a comment - +1 looks good
          Hide
          Hadoop QA added a comment -

          +1 overall. Here are the results of testing the latest attachment
          http://issues.apache.org/jira/secure/attachment/12435665/ZOOKEEPER-635.patch
          against trunk revision 912052.

          +1 @author. The patch does not contain any @author tags.

          +1 tests included. The patch appears to include 44 new or modified tests.

          +1 javadoc. The javadoc tool did not generate any warning messages.

          +1 javac. The applied patch does not increase the total number of javac compiler warnings.

          +1 findbugs. The patch does not introduce any new Findbugs warnings.

          +1 release audit. The applied patch does not increase the total number of release audit warnings.

          +1 core tests. The patch passed core unit tests.

          +1 contrib tests. The patch passed contrib unit tests.

          Test results: http://hudson.zones.apache.org/hudson/job/Zookeeper-Patch-h8.grid.sp2.yahoo.net/119/testReport/
          Findbugs warnings: http://hudson.zones.apache.org/hudson/job/Zookeeper-Patch-h8.grid.sp2.yahoo.net/119/artifact/trunk/build/test/findbugs/newPatchFindbugsWarnings.html
          Console output: http://hudson.zones.apache.org/hudson/job/Zookeeper-Patch-h8.grid.sp2.yahoo.net/119/console

          This message is automatically generated.

          Show
          Hadoop QA added a comment - +1 overall. Here are the results of testing the latest attachment http://issues.apache.org/jira/secure/attachment/12435665/ZOOKEEPER-635.patch against trunk revision 912052. +1 @author. The patch does not contain any @author tags. +1 tests included. The patch appears to include 44 new or modified tests. +1 javadoc. The javadoc tool did not generate any warning messages. +1 javac. The applied patch does not increase the total number of javac compiler warnings. +1 findbugs. The patch does not introduce any new Findbugs warnings. +1 release audit. The applied patch does not increase the total number of release audit warnings. +1 core tests. The patch passed core unit tests. +1 contrib tests. The patch passed contrib unit tests. Test results: http://hudson.zones.apache.org/hudson/job/Zookeeper-Patch-h8.grid.sp2.yahoo.net/119/testReport/ Findbugs warnings: http://hudson.zones.apache.org/hudson/job/Zookeeper-Patch-h8.grid.sp2.yahoo.net/119/artifact/trunk/build/test/findbugs/newPatchFindbugsWarnings.html Console output: http://hudson.zones.apache.org/hudson/job/Zookeeper-Patch-h8.grid.sp2.yahoo.net/119/console This message is automatically generated.
          Hide
          Benjamin Reed added a comment -

          thanx pat!

          Show
          Benjamin Reed added a comment - thanx pat!
          Hide
          Eugene Koontz added a comment -

          Works great for me. Thanks Patrick. One clarification for people wanting to use this.

          Perhaps the documentation could be made clearer on this.

          you must specify the port and the address separately like so:

          clientPortAddress=my.hostname.com
          clientPort=2181

          (that is, you can't do "clientPortAddress=my.hostname.com:2181")

          Show
          Eugene Koontz added a comment - Works great for me. Thanks Patrick. One clarification for people wanting to use this. Perhaps the documentation could be made clearer on this. you must specify the port and the address separately like so: clientPortAddress=my.hostname.com clientPort=2181 (that is, you can't do "clientPortAddress=my.hostname.com:2181")
          Hide
          Patrick Hunt added a comment -

          @eugene - enter a doc jira for your suggestion as this issue is already closed.

          Show
          Patrick Hunt added a comment - @eugene - enter a doc jira for your suggestion as this issue is already closed.
          Hide
          Eugene Koontz added a comment -
          Show
          Eugene Koontz added a comment - Hi Patrick, added doc jira here: https://issues.apache.org/jira/browse/ZOOKEEPER-1135

            People

            • Assignee:
              Patrick Hunt
              Reporter:
              Steve Chu
            • Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Development