Minoru Osuka created ZOOKEEPER-2350:
---------------------------------------

             Summary: Script that provide a way to build the ensemble with ease.
                 Key: ZOOKEEPER-2350
                 URL: https://issues.apache.org/jira/browse/ZOOKEEPER-2350
             Project: ZooKeeper
          Issue Type: New Feature
          Components: scripts
    Affects Versions: 3.5.0
            Reporter: Minoru Osuka
            Priority: Minor


Starting with 3.5.0, ZooKeeper has already supported a very convenient dynamic 
reconfiguration. However, the procedure is slightly complicated. So I propose 
adding a script to build ensemble with ease.

Usage:
{noformat}
$ ./bin/zkEnsemble.sh help
usage: ./bin/zkEnsemble.sh {start|stop|status} <parameters>
  Commadns:
    start                   Start a node of ensemble.
      Parameters:
        --seed              Specify the IP address and port of an existing 
ensemble node that required for 2nd and subsequent nodes.
                            This is not required for the 1st node. (Example: 
127.0.0.1:2181)
        --ip                Normally, you do not need to specify because it is 
automatically detected.
                            If it seems the wrong IP address is found 
automatically, you can over ride the IP address with this option.
        --clientport        The port is used to client connections (2181 by 
default).
        --peerport          The port is used to talk to each other (2888 by 
default).
                            If omitted, it will use the minimum port number 
that is available between 2888 to 3142.
        --electionport      The port is used to leader election (3888 by 
default).
                            If omitted, it will use the minimum port number 
that is available between 3888 to 4142.
        --role              The role of node, it can be participant or observer 
(participant by default).
        --clientip          The IP address for client connections (0.0.0.0 by 
default).
                            If omitted, it will use the minimum port number 
that is available between 2181 to 2435.
        --confdir           Specify a base conf directory 
(/Users/mosuka/git/zookeeper/conf by default).
        --datadir           Specify a base data directory (/tmp/zookeeper by 
default).
        --foreground        Start node in foreground.

    stop                    Stop a node of ensemble.
      Parameters:
        --ip                Normally, you do not need to specify because it is 
automatically detected.
                            If it seems the wrong IP address is found 
automatically, you can over ride the IP address with this option.
        --clientport        The port is used to client connections (2181 by 
default).

    status                  Show ensemble nodes.
      Parameters:
        --seed              Specify the IP address and port of a existing 
ensemble node (Example: 127.0.0.1:2181).

    help                    Display this message.
{noformat}

Example:
1. Start a 1st node of ensemble on host1(192.168.33.11)
{noformat}
$ ./bin/zkEnsemble.sh start
ZooKeeper JMX enabled by default
Using config: /Users/minoru/zookeeper/zookeeper-3.5.0/conf/server.1.cfg
Starting zookeeper ... STARTED
{noformat}

2. Start a 2nd node of ensemble on host2(192.168.33.12).
{noformat}
$ ./bin/zkEnsemble.sh start --seed=192.168.33.11:2181
ZooKeeper JMX enabled by default
Using config: /Users/minoru/zookeeper/zookeeper-3.5.0/conf/server.2.cfg
Starting zookeeper ... STARTED
{noformat}

3. Start a 3rd node of ensemble on host3(192.168.33.13).
{noformat}
$ ./bin/zkEnsemble.sh start --seed=192.168.33.11:2181
ZooKeeper JMX enabled by default
Using config: /Users/minoru/zookeeper/zookeeper-3.5.0/conf/server.3.cfg
Starting zookeeper ... STARTED
{noformat}

4. Show ensemble nodes on host1(192.168.33.11).
{noformat}
$ ./bin/zkEnsemble.sh status --seed=192.168.33.11:2181
server.1=192.168.33.11:2888:3888:participant;0.0.0.0:2181
server.2=192.168.33.12:2888:3888:participant;0.0.0.0:2181
server.3=192.168.33.13:2888:3888:participant;0.0.0.0:2181
{noformat}

5. Stop a 2nd node of ensemble on host2(192.168.33.12).
{noformat}
$ ./bin/zkEnsemble.sh stop
Using config: /Users/minoru/zookeeper/zookeeper-3.5.0/conf/server.2.cfg
Stopping zookeeper ... STOPPED
{noformat}

6. Show ensemble nodes on host1(192.168.33.11).
{noformat}
$ ./bin/zkEnsemble.sh status --seed=192.168.33.11:2181
server.1=192.168.33.11:2888:3888:participant;0.0.0.0:2181
server.3=192.168.33.13:2888:3888:participant;0.0.0.0:2181
{noformat}

7. Start a 2nd node of ensemble on host2(192.168.33.12).
{noformat}
$ ./bin/zkEnsemble.sh start --seed=192.168.33.11:2181
ZooKeeper JMX enabled by default
Using config: /Users/minoru/zookeeper/zookeeper-3.5.0/conf/server.2.cfg
Starting zookeeper ... STARTED
{noformat}

8. Show ensemble nodes on host1(192.168.33.11).
{noformat}
$ ./bin/zkEnsemble.sh status --seed=192.168.33.11:2181
server.1=192.168.33.11:2888:3888:participant;0.0.0.0:2181
server.2=192.168.33.12:2888:3888:participant;0.0.0.0:2181
server.3=192.168.33.13:2888:3888:participant;0.0.0.0:2181
{noformat}



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

Reply via email to