Re: Restarting a single zookeeper Server on the same port within the process

2009-10-22 Thread Patrick Hunt

Siddharth Raghavan wrote:

I need to restart a single zookeeper server node on the same port within
my unit tests. 


Are you testing c or java client?



I tried stopping the server, having a delay and restarting it on the
same port. But the server doesn't startup. When I re-start on a
different port, it starts up correctly. 


You may be running into this:
http://hea-www.harvard.edu/~fine/Tech/addrinuse.html

Take a look at the zk tests, we do this in some cases and it works for 
us so you should be able to do similar.


See RecoveryTest.java or TestClient.cc for java and c respectively. Ring 
us back if you still have questions.


Patrick


Re: Restarting a single zookeeper Server on the same port within the process

2009-10-22 Thread Ted Dunning
It isn't exactly an answer to your question, but sometimes you can start the
server with a @BeforeClass setup and then use a @Before setup to delete
everything before each test.  This doesn't avoid your problem, but it does
minimize it because you don't have to restart servers s often.

On Thu, Oct 22, 2009 at 5:29 PM, Mahadev Konar wrote:

> Hi Siddharth,
>  Usually the time of releasing the port is dependent on the OS. So you can
> try sleeping a few more seconds to see if the port has been released or it
> .. Or just poll on the port to see if its in use or not There isnt an
> easier way to restart on the same port.
>
>
> mahadev
>
>
> On 10/22/09 4:52 PM, "Siddharth Raghavan" 
> wrote:
>
> > Hello,
> >
> >
> >
> > I need to restart a single zookeeper server node on the same port within
> > my unit tests.
> >
> >
> >
> > I tried stopping the server, having a delay and restarting it on the
> > same port. But the server doesn't startup. When I re-start on a
> > different port, it starts up correctly.
> >
> >
> >
> > Can you let me know how I can make this one work.
> >
> >
> >
> > Thank you.
> >
> >
> >
> > Regards,
> >
> > Siddharth
> >
> >
> >
>
>


-- 
Ted Dunning, CTO
DeepDyve


Re: Restarting a single zookeeper Server on the same port within the process

2009-10-22 Thread Mahadev Konar
Hi Siddharth,
  Usually the time of releasing the port is dependent on the OS. So you can
try sleeping a few more seconds to see if the port has been released or it
.. Or just poll on the port to see if its in use or not There isnt an
easier way to restart on the same port.


mahadev


On 10/22/09 4:52 PM, "Siddharth Raghavan" 
wrote:

> Hello,
> 
>  
> 
> I need to restart a single zookeeper server node on the same port within
> my unit tests. 
> 
>  
> 
> I tried stopping the server, having a delay and restarting it on the
> same port. But the server doesn't startup. When I re-start on a
> different port, it starts up correctly.
> 
>  
> 
> Can you let me know how I can make this one work.
> 
>  
> 
> Thank you. 
> 
>  
> 
> Regards,
> 
> Siddharth
> 
>  
>