Home | About | Sematext search-lucene.com search-hadoop.com
 Search Hadoop and all its subprojects:

Switch to Threaded View
Zookeeper, mail # user - Running an ensemble in one JVM


Copy link to this message
-
Re: Running an ensemble in one JVM
César Álvarez Núñez 2011-10-19, 08:42
Yes it is.

Just use "org.apache.zookeeper.test.QuorumUtil" methods; but you need to
checkout Zookeeper from its repository and compile it since distribution
does not include 'test artifacts' (
https://issues.apache.org/jira/browse/ZOOKEEPER-1101).

You will also need to apply the following patches:

   - https://issues.apache.org/jira/browse/ZOOKEEPER-1172 > It allows to
   specify an StatisHostProvider where server addresses are not shuffled; so
   you know in advance which server the client is connected to and shutdown it
   to force a Disconnected event.
   - https://issues.apache.org/jira/browse/ZOOKEEPER-1214 > It fix a bug
   that prevented to work with the ensemble in one jvm.

Regrettably, the above patches are not committed yet and where generated
from zookeeper-trunk; so for the time being you need to use zookeeper-trunk
instead of latest release (3.3.3).

I've successfully simulated Disconnected, SyncConnected and Expired events;
so let me know if you need more help.

BR,
/César.
On Wed, Oct 19, 2011 at 8:42 AM, Gunnar Wagenknecht
<[EMAIL PROTECTED]>wrote:

> Hi,
>
> Is it possible to run an ensemble in one JVM?
>
> I'd like to write some unit tests for our application in order to test
> the robustness of my application regarding connection loss, connection
> recovery and session expiration with an ensemble setup.
>
> I did start several quorum peers in the same JVM but I noticed some
> strange warning messages in the console. Thus, I'm wondering if that
> scenario is possible at all. I haven't look at the code yet in detail if
> there are some static references which would prevent that.
>
> For now, I'm starting three separate processes. Each process opens a
> command window so that I can see the process output. However, this
> requires some setup for running the tests and there are a few other
> issues. Thus, I'm looking for alternatives.
>
> How do you write tests with an ensemble?
>
> -Gunnar
>
> --
> Gunnar Wagenknecht
> [EMAIL PROTECTED]
> http://wagenknecht.org/
>
>