Yury Zavarin > Ubic-Service-ZooKeeper-0.02 > lib/Ubic/Service/ZooKeeper.pm~

Download:
Ubic-Service-ZooKeeper-0.02.tar.gz

Annotate this POD

Website

View/Report Bugs
Source  

SYNOPSIS ^

  use Ubic::Service::ZooKeeper;
  return Ubic::Service::ZooKeeper->new({
      clientPort => 2181,
      dataDir    => '/var/lib/zookeeper',
      tickTime   => 2000,
      initLimit  => 10,
      syncLimit  => 5,
      servers    => {
          1 => { server => "host1:2888:3888" },
          2 => { server => "host2:2888:3888" },
          3 => { server => "host3:2888:3888" },
      },
      myid => 1,

      ubic_log => '/var/log/zookeeper/ubic.log',
      stdout   => '/var/log/zookeeper/stdout.log',
      stderr   => '/var/log/zookeeper/stderr.log',
      user     => 'zookeeper',
      gen_cfg  => '/etc/zookeeper/conf/zoo.cfg',
      pidfile  => '/tmp/zookeeper.pid',

      java_cp => '/usr/share/java/jline.jar:/usr/share/java/log4j-1.2.jar:' .
                 '/usr/share/java/xercesImpl.jar:' .
                 '/usr/share/java/xmlParserAPIs.jar:/usr/share/java/zookeeper.jar',
});

DESCRIPTION ^

This module intends for running/shutdown ZooKeeper as a Ubic service. It accepts all config options of ZooKeeper (and some other options), generates config and myid file and run it.

METHODS ^

Typically you need to use only new() method, but you can find below description of some another methods also.

new($params)

Creates new ZooKeeper service. $params is hashref with different ZooKeeper and Ubic params.

ZooKeeper config params: clientPort (default is 2181), dataDir (default is /var/lib/zookeeper), tickTime (default is 2000), dataLogDir, globalOutstandingLimit, preAllocSize, snapCount, traceFile, maxClientCnxns, clientPortAddress, minSessionTimeout, maxSessionTimeout, electionAlg, initLimit, leaderServer, servers, groups, syncLimit, cnxTimeout, forceSync, skipACL.

You can find description for all of this params on http://zookeeper.apache.org/doc/trunk/zookeeperAdmin.html#sc_configuration.

Two exceptions here.

The first is a servers param. It combines server.x and weight.x params from ZooKeeper config. servers is a hashref where key is a number of server and the values is a hashref with keys server and weight.

The second is a groups param. It is a hashref, where the key is a number of group and the value is arrayref with server numbers in this group.

All of these params are optional.

Remain params are:

myid (optional)

Id of the current server in ZooKeeper cluster. Based on this value Ubic::Service::Zookeeper will create myid file in dataDir.

Default is 1.

status (optional)

Coderef for checking ZooKeeper status. Takes current instance of Ubic::Service::ZooKeeper as a first param.

Default implemetation uses ruok ZooKeeper command.

user (optional)

User name that will be used as real and effective user identifier during exec of ZooKeeper.

ubic_log (optional)

Path to ubic log.

stdout (optional)

Path to stdout log.

ZooKeeper supports custom logging setup, so in most cases this param is meaningless.

stderr (optional)

Path to stderr log.

pidfile (optional)

Pidfile for Ubic::Daemon module.

If not specified it is a /tmp/zookeeper.<clientPort>.pid.

gen_cfg (optional)

Generated ZooKeeper config file name.

If not specified it is a /tmp/zoo.<clientPort>.cfg.

java (optional)

Path to java binary. Default is just "java", so your PATH should be setted properly in default case.

java_cp (optional)

Java classpath. See ZooKeeper administration guide for more information.

It should be something like this: /usr/share/java/jline.jar:/usr/share/java/log4j-1.2.jar:/usr/share/java/xercesImpl.jar:/usr/share/java/xmlParserAPIs.jar:/usr/share/java/zookeeper.jar

jmx_enable (optional)

Enable JMX. Default is 1

jmx_local_only (optional)

Enable JMX only locally. Default is 0.

zoo_log_dir (optional)

Where zookeeper will place own logs. Default is var/log/zookeeper.

zoo_log4j_prop (optional)

Log4j properties for ZooKeeper. Default is INFO,ROLLINGFILE.

zoo_main_class (optional)

Main ZooKeeper class. Default is org.apache.zookeeper.server.quorum.QuorumPeerMain. Typically you don't need to redefine this param.

java_opts (optional)

Some additional options that you want to pass to java.

create_cfg_file()

Generates .cfg file basing on constuctor params.

create_myid_file()

Generates myid file basing on myid and dataDir params in constructor.

pidfile()

Get pidfile name.

SEE ALSO ^

http://zookeeper.apache.org/doc/trunk/zookeeperAdmin.html

Ubic

syntax highlighting: