This is an automated email from the ASF dual-hosted git repository.

sijie pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/bookkeeper.git


The following commit(s) were added to refs/heads/master by this push:
     new 54ce173  Added zookeeper host configuration. Closes #1960
54ce173 is described below

commit 54ce17312f53c9b2a1ac3ea83303a7bebebc0a31
Author: Hugo Abreu <[email protected]>
AuthorDate: Fri Jun 21 04:22:33 2019 +0100

    Added zookeeper host configuration. Closes #1960
    
    Descriptions of the changes in this PR:
    Added host IP binding to sandbox.
    
    ### Motivation
    Allowing running the sandbox inside guest machines and be accessible by all 
system (including other guest machines). When binding 127.0.0.1 other guest 
machines will experience an error. By allowing to bind the correct IP the 
namespace will be available and correctly configured for other hosts.
    
    ### Changes
    Added a new argument to the _dlog_ tool allowing to define the host IP to 
bind ZooKeeper and DistributedLog namespace.
    
    Master Issue: #1960
    
    
    
    
    Reviewers: Enrico Olivelli <[email protected]>, Sijie Guo 
<[email protected]>
    
    This closes #2081 from hugomiguelabreu/master, closes #1960
---
 .../java/org/apache/distributedlog/LocalDLMEmulator.java  | 15 ++++++++++++---
 1 file changed, 12 insertions(+), 3 deletions(-)

diff --git 
a/stream/distributedlog/core/src/main/java/org/apache/distributedlog/LocalDLMEmulator.java
 
b/stream/distributedlog/core/src/main/java/org/apache/distributedlog/LocalDLMEmulator.java
index dc014f1..61bc231 100644
--- 
a/stream/distributedlog/core/src/main/java/org/apache/distributedlog/LocalDLMEmulator.java
+++ 
b/stream/distributedlog/core/src/main/java/org/apache/distributedlog/LocalDLMEmulator.java
@@ -308,13 +308,22 @@ public class LocalDLMEmulator {
     public static void main(String[] args) throws Exception {
         try {
             if (args.length < 1) {
-                System.out.println("Usage: LocalDLEmulator <zk_port>");
+                System.out.println("Usage: LocalDLEmulator [<zk_host>] 
<zk_port>");
                 System.exit(-1);
             }
 
-            final int zkPort = Integer.parseInt(args[0]);
+            String zkHost = DEFAULT_ZK_HOST;
+            int zkPort = DEFAULT_ZK_PORT;
+            if (args.length == 1) {
+                zkPort = Integer.parseInt(args[0]);
+            } else {
+                zkHost = args[0];
+                zkPort = Integer.parseInt(args[1]);
+            }
+
             final File zkDir = IOUtils.createTempDir("distrlog", "zookeeper");
             final LocalDLMEmulator localDlm = LocalDLMEmulator.newBuilder()
+                .zkHost(zkHost)
                 .zkPort(zkPort)
                 .build();
 
@@ -334,7 +343,7 @@ public class LocalDLMEmulator {
 
             System.out.println(String.format(
                 "DistributedLog Sandbox is running now. You could access 
distributedlog://%s:%s",
-                DEFAULT_ZK_HOST,
+                zkHost,
                 zkPort));
         } catch (Exception ex) {
             System.out.println("Exception occurred running emulator " + ex);

Reply via email to