Permalink
Browse files

cleanup the docs a bit, fix starting port numbers

  • Loading branch information...
1 parent 14b622f commit ec14f3eb6b85ff984b9226d22994dded5f8403c6 @phunt committed Oct 13, 2009
Showing with 40 additions and 35 deletions.
  1. +26 −21 README.textile
  2. +14 −14 zkconf.py
View
@@ -24,39 +24,44 @@ cheetah compile *.tmpl
h2. Usage
-zkconf.py [options] zookeeper_dir output_dir
-
-Where zookeeper_dir is the location of your ZooKeeper trunk (zkconf copies the jars/confs from this directory into the output_dir to make your life easier). And output_dir is the directory to which we will output the generated files (assumption is that this is a non-existent directory - ie zkconf will create it)
-
-example of typical use; 9 server quorum:
-
-bq. zkconf.py --count 9 ~/zookeeper_trunk test9servers
-
-bq. zkconf.py --servers "host1.com,host2.com,168.1.1.1" ~/zookeeper_trunk test3servers
-
-example of using weights/groups (only for flex quorum, not typical); 9 servers with 3 groups
-
-bq. zkconf.py -c 9 --weights="1,1,1,1,1,0,0,0,0" --groups="1:2:3:4:5,6:7,8:9" ~/dev/workspace/gitzk testflexquroum
+<pre>
+Usage: zkconf.py [options] zookeeper_dir output_dir
Options:
-h, --help show this help message and exit
-c COUNT, --count=COUNT
- ensemble size
+ ensemble size (default 3)
--servers=SERVERS explicit list of comma separated server names
(alternative to --count)
--clientportstart=CLIENTPORTSTART
- first client port
+ first client port (default 2181)
--quorumportstart=QUORUMPORTSTART
- first quorum port
+ first quorum port (default 3181)
--electionportstart=ELECTIONPORTSTART
- first election port
+ first election port (default 4181)
--weights=WEIGHTS comma separated list of weights for each server (flex
- quorum only)
- --groups=GROUPS comma separated list of groups (flex quorum only)
+ quorum only, default off)
+ --groups=GROUPS comma separated list of groups (flex quorum only,
+ default off)
--maxClientCnxns=MAXCLIENTCNXNS
- maxClientCnxns of server config
+ maxClientCnxns of server config (default unspecified,
+ ZK default)
--electionAlg=ELECTIONALG
- electionAlg of server config
+ electionAlg of server config (default unspecified, ZK
+ default - FLE)
+</pre>
+
+Where zookeeper_dir is the location of your ZooKeeper trunk (zkconf copies the jars/confs from this directory into the output_dir to make your life easier). And output_dir is the directory to which we will output the generated files (assumption is that this is a non-existent directory - ie zkconf will create it)
+
+example of typical use; 9 server quorum:
+
+bq. zkconf.py --count 9 ~/zookeeper_trunk test9servers
+
+bq. zkconf.py --servers "host1.com,host2.com,168.1.1.1" ~/zookeeper_trunk test3servers
+
+example of using weights/groups (only for flex quorum, not typical); 9 servers with 3 groups
+
+bq. zkconf.py -c 9 --weights="1,1,1,1,1,0,0,0,0" --groups="1:2:3:4:5,6:7,8:9" ~/dev/workspace/gitzk testflexquroum
Running localhost (default) starts client:quorum:election ports as 2181:3181:4181 respectively. Running non-localhost (--servers) starts client:quorum:elections ports for all hosts as 2181:3181:4181.
View
@@ -31,23 +31,23 @@
usage = "usage: %prog [options] zookeeper_dir output_dir"
parser = OptionParser(usage=usage)
parser.add_option("-c", "--count", dest="count", type="int",
- default=3, help="ensemble size")
+ default=3, help="ensemble size (default 3)")
parser.add_option("", "--servers", dest="servers",
default="localhost", help="explicit list of comma separated server names (alternative to --count)")
parser.add_option("", "--clientportstart", dest="clientportstart", type="int",
- default=2180, help="first client port")
+ default=2181, help="first client port (default 2181)")
parser.add_option("", "--quorumportstart", dest="quorumportstart", type="int",
- default=3180, help="first quorum port")
+ default=3181, help="first quorum port (default 3181)")
parser.add_option("", "--electionportstart", dest="electionportstart", type="int",
- default=4180, help="first election port")
+ default=4181, help="first election port (default 4181)")
parser.add_option("", "--weights", dest="weights",
- default="1", help="comma separated list of weights for each server (flex quorum only)")
+ default="1", help="comma separated list of weights for each server (flex quorum only, default off)")
parser.add_option("", "--groups", dest="groups",
- default="1", help="comma separated list of groups (flex quorum only)")
+ default="1", help="comma separated list of groups (flex quorum only, default off)")
parser.add_option("", "--maxClientCnxns", dest="maxclientcnxns", type='int',
- default=10, help="maxClientCnxns of server config")
+ default=10, help="maxClientCnxns of server config (default unspecified, ZK default)")
parser.add_option("", "--electionAlg", dest="electionalg", type='int',
- default=3, help="electionAlg of server config")
+ default=3, help="electionAlg of server config (default unspecified, ZK default - FLE)")
(options, args) = parser.parse_args()
@@ -57,16 +57,16 @@
if options.servers != "localhost" :
options.servers = options.servers.split(",")
for i in xrange(1, len(options.servers) + 1) :
- options.clientports.append(options.clientportstart + 1);
- options.quorumports.append(options.quorumportstart + 1);
- options.electionports.append(options.electionportstart + 1);
+ options.clientports.append(options.clientportstart);
+ options.quorumports.append(options.quorumportstart);
+ options.electionports.append(options.electionportstart);
else :
options.servers = []
for i in xrange(options.count) :
options.servers.append('localhost');
- options.clientports.append(options.clientportstart + i + 1);
- options.quorumports.append(options.quorumportstart + i + 1);
- options.electionports.append(options.electionportstart + i + 1);
+ options.clientports.append(options.clientportstart + i);
+ options.quorumports.append(options.quorumportstart + i);
+ options.electionports.append(options.electionportstart + i);
if options.weights != "1" :
options.weights = options.weights.split(",")

0 comments on commit ec14f3e

Please sign in to comment.