[ 
https://issues.apache.org/jira/browse/CURATOR-360?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15707304#comment-15707304
 ] 

ASF GitHub Bot commented on CURATOR-360:
----------------------------------------

Github user IMS94 commented on the issue:

    https://github.com/apache/curator/pull/175
  
    Yes. If we are to provide unit tests, we must be aware of the network 
interfaces in the host machine.I manually tested whether all are fine when I 
wanted to run a zookeeper cluster to test my clustering implementation through 
a LAN and it worked fine.
    
    ```
            List<InstanceSpec> specs = new ArrayList<>();
            List<Integer> ports = new ArrayList<>();
    
            int port = 30155, electionPort = 31155, quorumPort = 32155;
    
            for (int i = 0; i < 3; i++) {
                InstanceSpec spec = new InstanceSpec(null, port, electionPort, 
quorumPort,
                        true, i, 10000, 100, null, "0.0.0.0");
                logger.info("Zookeeper-{} : port : {}, election port : {}, 
quorum port : {}", i, port, electionPort, quorumPort);
    
                specs.add(spec);
                ports.add(port);
    
                port++;
                electionPort++;
                quorumPort++;
            }
    
            logger.info("Connect string ports : {}", ports);
            TestingCluster cluster = new TestingCluster(specs);
    
            try {
                cluster.start();
                Runtime.getRuntime().addShutdownHook(new Thread(() -> {
                    try {
                        logger.debug("Stopping cluster");
                        cluster.stop();
                    } catch (IOException e) {
                        logger.error("Error when stopping cluster", e);
                    }
                }));
            } catch (Exception e) {
                logger.error("Error when starting zookeeper cluster", e);
                throw e;
            }
            logger.info("Cluster started with ports : {}", ports);
    ```
    Here, I had used "0.0.0.0" to open ports on all interfaces. I tried with my 
IPv4 address assigned by my LAN and confirmed that I can access these ports 
through network


> Allow Zookeeper servers in TestingCluster to listen on network interfaces 
> other than localhost
> ----------------------------------------------------------------------------------------------
>
>                 Key: CURATOR-360
>                 URL: https://issues.apache.org/jira/browse/CURATOR-360
>             Project: Apache Curator
>          Issue Type: Improvement
>          Components: Tests
>            Reporter: Imesha Sudasingha
>            Priority: Minor
>              Labels: test-framework
>
> Currently, when we create a TestingCluster, all the TestingServers will be 
> bound to the local interface (127.0.0.1). This becomes a constraint if we 
> want to run a TestingCluster which can be used for testing over a network 
> (say LAN).
> In order to address that we can add a hostname to be provided optionally in 
> the InstanceSpec.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to