zookeeper-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Patrick Hunt <ph...@apache.org>
Subject Re: Embedding ZK in another application
Date Thu, 29 Apr 2010 18:33:34 GMT
On 04/29/2010 11:22 AM, Chad Harrington wrote:
> On Thu, Apr 29, 2010 at 8:49 AM, Patrick Hunt<phunt@apache.org>  wrote:
>
>> This is not foolproof however. We found that in general this would work,
>> however there were some infrequent cases where a restarted server would fail
>> to initialize due to the following issue:
>> "it is possible for the process to complete before the kernel has released
>> the associated network resource, and this port cannot be bound to another
>> process until the kernel has decided that it is done."
>>
>> more detail here:
>> http://hea-www.harvard.edu/~fine/Tech/addrinuse.html
>>
>> as a result we ended up changing the test code to start each test with new
>> quorum/election port numbers. This fixed the problem for us but would not be
>> a solution in your case.
>>
>> Patrick
>
>
> I am not an expert at all on this, but I have used SO_REUSEADDR in other
> situations to avoid the address in use problem.  Would that help here?
>

Hi Chad, seems like it should, but according to the link

"Oddly, using SO_REUSEADDR can actually lead to more difficult "address 
already in use" errors."

See the "strategies for avoidance" section. I'm no expert on this 
particular issue either, so if someone knows for sure speak up.

We already do this btw, this is from the server... (not sure if we cover 
all cases though):
   ss.socket().setReuseAddress(true);

Patrick

> Chad Harrington
> chad.harrington@gmail.com
>
>>
>>
>> On 04/29/2010 07:13 AM, Vishal K wrote:
>>
>>> Hi Ted,
>>>
>>> We want the application that embeds the ZK server to be running even after
>>> the ZK server is shutdown. So we don't want to restart the application.
>>> Also, we prefer not to use zkServer.sh/zkServer.cmd because these are OS
>>> dependent (our application will run on Win as well as Linux). Instead, we
>>> thought that calling QuorumPeerMain.initializeAndRun() and
>>> QuorumPeerMain.shutdown() will suffice to start and shutdown a ZK server
>>> and
>>> we won't have to worry about checking the OS.
>>>
>>> Is there way to cleanly shutdown the ZK server (by invoking ZK server API)
>>> when it is embedded in the application without actually restarting the
>>> application process?
>>> Thanks.
>>> On Thu, Apr 29, 2010 at 1:54 AM, Ted Dunning<ted.dunning@gmail.com>
>>>   wrote:
>>>
>>>   Hmmm.... it isn't quite clear what you mean by restart without
>>>> restarting.
>>>>
>>>> Why is killing the server and restarting it not an option?
>>>>
>>>> It is common to do a rolling restart on a ZK cluster.  Just restart one
>>>> server at a time.  This is often used during system upgrades.
>>>>
>>>> On Wed, Apr 28, 2010 at 8:22 PM, Vishal K<vishalmlst@gmail.com>   wrote:
>>>>
>>>>
>>>>> What is a good way to restart a ZK server (standalone and quorum)
>>>>> without
>>>>> having to restart it?
>>>>>
>>>>> Currently, I have ZK server embedded in another java application.
>>>>>
>>>>
>>>>
>>>
>

Mime
View raw message