Re: Question about rest interface

2010-09-30 Thread Andrei Savu
The latest version of the rest gateway, now available in trunk, works
the way you want it.

I had the same problem you have while working on the code. There is
also a simple start/stop script available (src/contrib/rest/rest.sh).

You should checkout the trunk [1] or [2]. Runt "ant jar" in the root
folder and "ant tar" in src/contrib/rest. After running these steps
you will find in build/contrib/rest/ a .tar.gz archive that contains
everything you need to run a standalone REST gateway for ZooKeeper.

The config file should be pretty much self explanatory but if you need
more help let me know.

The version in the trunk is now session aware and you can use it even
to implement things like leader election (you can find some python
examples in  src/contrib/rest/src/python).

I'm planning to add more features to it, things like ACLs and session
authentication but unfortunately I haven't got the time. I should be
able to do this in the near future.

[1] http://hadoop.apache.org/zookeeper/version_control.html
[2] http://github.com/apache/zookeeper

On Thu, Sep 30, 2010 at 7:01 PM, Patrick Hunt  wrote:
> Hi Marc, you should checkout the REST interface that's on the svn trunk, it
> includes new functionality and numerous fixes that might be interesting to
> you, this will be part of 3.4.0. CCing Andrei who worked on this as part of
> his GSOC project this summer.
> If you look at this file:
> src/contrib/rest/src/java/org/apache/zookeeper/server/jersey/RestMain.java
> you'll see how we start the server. Looks like we need an option to run as a
> process w/o assuming interactive use. It should be pretty easy for someone
> to patch this (if you do please consider submitting a patch via our JIRA
> process, others would find it interesting). With the current code you might
> get away with something like "java  < /dev/null" -- basically turn off
> stdin.
> Patrick
> On Wed, Sep 29, 2010 at 3:09 PM, marc slayton  wrote:
>>
>> Hey all --
>>
>> Having a great time with Zookeeper and recently started testing
>> the RESTful interface in src/contrib.
>>
>> 'ant runrestserver' creates a test instance attached to stdin
>> which works well but any input kills it. How does one configure
>> Jersey to run for real i.e. not attached to my terminal's
>> stdin?
>>
>> I've tried altering log4j settings without much luck.
>>
>> If there are example setup docs for Linux, could somebody point
>> me there? FWIW, I'm running zookeeper-3.3.1 with openjdk-1.6.
>>
>> Cheers, and thanks in advance --
>>
>>
>>
>



-- 
Andrei Savu -- http://www.andreisavu.ro/


Re: election recipe

2010-09-04 Thread Andrei Savu
You should also be careful how you handle connection loss events. The
leader should suspend itself and re-run the election process when the
connection is reestablished.

On Sat, Sep 4, 2010 at 8:37 AM, Mahadev Konar  wrote:
> Hi Eric,
>  As Ted and you yourself mentioned its mostly to avoid herd affect.  A herd
> affect would usually mean 1000¹s of client notified of some change and would
> try creating the same node on notification.  With just 10¹s of clients you
> don¹t need to worry abt this herd effect at all.
>
> Thanks
> mahadev
>
>
> On 9/2/10 3:40 PM, "Ted Dunning"  wrote:
>
>> You are correct that this simpler recipe will work for smaller populations
>> and correct that the complications are to avoid the herd effect.
>>
>>
>>
>> On Thu, Sep 2, 2010 at 12:55 PM, Eric van Orsouw
>> wrote:
>>
>>> Hi there,
>>>
>>>
>>>
>>> I would like to use zookeeper to implement an election scheme.
>>>
>>> There is a recipe on the homepage, but it is relatively complex.
>>>
>>> I was wondering what was wrong with the following pseudo code;
>>>
>>>
>>>
>>> forever {
>>>
>>>    zookeeper.create -e /election 
>>>
>>>    if creation succeeded then {
>>>
>>>        // do the leader thing
>>>
>>>    } else {
>>>
>>>        // wait for change in /election using watcher mechanism
>>>
>>>    }
>>>
>>> }
>>>
>>>
>>>
>>> My assumption is that the recipe is more elaborate to the eliminate the
>>> flood of requests if the leader falls away.
>>>
>>> But if there are only a handful of leader-candidates ,than that should not
>>> be a problem.
>>>
>>>
>>>
>>> Is this correct, or am I missing out on something.
>>>
>>>
>>>
>>> Thanks,
>>>
>>> Eric
>>>
>>>
>>>
>>>
>>
>
>



-- 
Andrei Savu -- http://www.andreisavu.ro/


Re: ZK monitoring

2010-08-17 Thread Andrei Savu
You should also take a look at ZOOKEEPER-744 [1] and ZOOKEEPER-799 [2]

The archive from 799 contains ready to be used scripts for monitoring
ZooKeeper using Ganglia, Nagios and Cacti.

Let me know if you need more help.

[1] https://issues.apache.org/jira/browse/ZOOKEEPER-744
[2] https://issues.apache.org/jira/browse/ZOOKEEPER-799

On Tue, Aug 17, 2010 at 9:50 PM, Jun Rao  wrote:
> Hi,
>
> Is there a way to see the current leader and a list of followers from a
> single node in the ZK quorum? It seems that ZK monitoring (JMX, 4-letter
> commands) only provides info local to a node.
>
> Thanks,
>
> Jun
>



-- Andrei Savu


Re: ZK monitoring

2010-08-17 Thread Andrei Savu
It's not possible. You need to query all the servers in order to know
who is the current leader.

It should be pretty simple to implement this by parsing the output
from the 'stat' 4-letter command.

On Tue, Aug 17, 2010 at 9:50 PM, Jun Rao  wrote:
> Hi,
>
> Is there a way to see the current leader and a list of followers from a
> single node in the ZK quorum? It seems that ZK monitoring (JMX, 4-letter
> commands) only provides info local to a node.
>
> Thanks,
>
> Jun
>



-- Andrei Savu


Re: building client tools

2010-07-13 Thread Andrei Savu
Hi,

In this case I think you have to install libcppunit (should work using
apt-get). I believe that should be enough but I don't really remember
what else I've installed the first time I compiled the c client.

Let me know what else was needed. I would like to submit a patch to
update the README file in order to avoid this problem in the future.

Thanks.

On Tue, Jul 13, 2010 at 8:09 PM, Martin Waite  wrote:
> Hi,
>
> I am trying to build the c client on debian lenny for zookeeper 3.3.1.
>
> autoreconf -if
> configure.ac:33: warning: macro `AM_PATH_CPPUNIT' not found in library
> configure.ac:33: warning: macro `AM_PATH_CPPUNIT' not found in library
> configure.ac:33: error: possibly undefined macro: AM_PATH_CPPUNIT
>      If this token and others are legitimate, please use m4_pattern_allow.
>      See the Autoconf documentation.
> autoreconf: /usr/bin/autoconf failed with exit status: 1
>
> I probably need to install some required tools.   Is there a list of what
> tools are needed to build this please ?
>
> regards,
> Martin
>



-- 
Andrei Savu - http://andreisavu.ro/


ZooKeeper Monitoring using Ganglia, Cacti and Nagios

2010-06-24 Thread Andrei Savu
Hi,

I've just finished writing and testing a set of scripts and recipes
for ZooKeeper monitoring using Cacti, Nagios and Ganglia.

You can find the repository on Github:
http://github.com/andreisavu/zookeeper-monitoring

I want to submit this on JIRA as a contrib but before doing this I
would really like to get more feedback from you. Let me know if I
should provide more detailed install instructions.

Thanks,
Andrei

-- 
Andrei Savu

http://www.andreisavu.ro/


Re: Starting zookeeper in replicated mode

2010-06-21 Thread Andrei Savu
As Luka Stojanovic suggested you need to a a file called
/var/zookeeper/myid on each node:

$ echo 1,2 ... 6 > /var/zookeeper/myid

I want to make a few more comments related to your setup and to your questions:

- there is no configured master node in a zookeeper cluster. the
leader is automatically elected at runtime
- you can write and read from any node at any time

> Am I supposed to have an instance of ZooKeeper on each node started before 
> running in replication mode?
- you start the cluster by starting one node at a time

> Should I have each node that will be running ZK listed in the config file?
- yes. you need to have all nodes running ZK listed in the config file.

> Should I be using an IP address to point to a server instead of a hostname?
- it doesn't really make difference if you use hostnames or IP addresses.

I hope this will help you.

Andrei

On Mon, Jun 21, 2010 at 10:04 PM, Erik Test  wrote:
> Hi All,
>
> I'm having a problem with installing zookeeper on a cluster with 6 nodes in
> replicated mode. I was able to install and run zookeeper in standalone mode
> but I'm unable to run zookeeper in replicated mode.
>
> I've added a list of servers in zoo.cfg as suggested by the ZooKeeper
> Getting Started Guide but I get these logs displayed to screen:
>
> *[r...@master1 bin]# ./zkServer.sh start
> JMX enabled by default
> Using config: /root/zookeeper-3.2.2/bin/../conf/zoo.cfg
> Starting zookeeper ...
> STARTED
> [r...@master1 bin]# 2010-06-21 12:25:23,738 - INFO
> [main:quorumpeercon...@80] - Reading configuration from:
> /root/zookeeper-3.2.2/bin/../conf/zoo.cfg
> 2010-06-21 12:25:23,743 - INFO  [main:quorumpeercon...@232] - Defaulting to
> majority quorums
> 2010-06-21 12:25:23,745 - FATAL [main:quorumpeerm...@82] - Invalid config,
> exiting abnormally
> org.apache.zookeeper.server.quorum.QuorumPeerConfig$ConfigException: Error
> processing /root/zookeeper-3.2.2/bin/../conf/zoo.cfg
>        at
> org.apache.zookeeper.server.quorum.QuorumPeerConfig.parse(QuorumPeerConfig.java:100)
>        at
> org.apache.zookeeper.server.quorum.QuorumPeerMain.initializeAndRun(QuorumPeerMain.java:98)
>        at
> org.apache.zookeeper.server.quorum.QuorumPeerMain.main(QuorumPeerMain.java:75)
> Caused by: java.lang.IllegalArgumentException: /var/zookeeper/myid file is
> missing
>        at
> org.apache.zookeeper.server.quorum.QuorumPeerConfig.parseProperties(QuorumPeerConfig.java:238)
>        at
> org.apache.zookeeper.server.quorum.QuorumPeerConfig.parse(QuorumPeerConfig.java:96)
>        ... 2 more
> Invalid config, exiting abnormally*
>
> And here is my config file:
> *
> # The number of milliseconds of each tick
> tickTime=2000
> # The number of ticks that the initial
> # synchronization phase can take
> initLimit=5
> # The number of ticks that can pass between
> # sending a request and getting an acknowledgement
> syncLimit=2
> # the directory where the snapshot is stored.
> dataDir=/var/zookeeper
> # the port at which the clients will connect
> clientPort=2181
> server.1=master1:2888:3888
> server.2=slave2:2888:3888
> server.3=slave3:2888:3888
> *
> I'm a little confused as to why this doesn't work and I haven't had any luck
> finding answers to some questions I have.
>
> Am I supposed to have an instance of ZooKeeper on each node started before
> running in replication mode? Should I have each node that will be running ZK
> listed in the config file? Should I be using an IP address to point to a
> server instead of a hostname?
>
> Thanks for your time.
> Erik
>



-- 
Andrei Savu

http://www.andreisavu.ro/


GSoC 2010: ZooKeeper Monitoring Recipes and Web-based Administrative Interface

2010-05-06 Thread Andrei Savu
Hi all,

My name is Andrei and I am on of the GSoC accepted students. My mentor
is Patrick Hunt.

My objective in the next 4 months is to write tools and recipes for
monitoring and to implement a web-based administrative interface.

I have created a wiki page for this project:
 - http://wiki.apache.org/hadoop/ZooKeeper/GSoCMonitoringAndWebInterface

I would really like to know your specific requirements for monitoring
and zookeeper administration.

Regards

-- 
Savu Andrei

Website: http://www.andreisavu.ro/