[SPAM] Re: CONNECTING FROM A SERVERS POOL
Alberto Luengo Cabanillas (Pexego)
alberto at pexego.es
Mon Mar 29 20:03:45 CEST 2010
Yeargan, Yancey wrote:
> I think it is as simple as using multiple URL values separated with
> spaces. For example:
> ldap.initalize("url1 url2 url3")
> The underlying LDAP code will automatically try each URL until one
> succeeds or they all fail.
Hi Yeargan. Thanks for the quick reply but that's not exactly the
problem we're facing. The point that if you initialize url1, url2 and
url3, with url1 down, the followup queries will be against url2. That's
a correct behaviour, but if while you're keeping up that connection,
this url2 server goes down, you'll get an exception, instead of trying
to reconnect to next available server (url1 or url3), supposing, of
course, that they have an equivalent structure.
So, when this happens, we're initializing another LDAPObject with
remaining URIs this way:
self = new_object (or self._l = new_object?)
, but this still fails, any suggestion?
> On Mar 29, 2010, at 9:41 AM, Alberto Luengo Cabanillas (Pexego) wrote:
>> Hi all! Me and a workmate are currently working in an approach of
>> connecting to different LDAP servers (each one is a replica of
>> another) because of fault tolerancy purposes.
>> So, first thing we did was modifying the *__init__* method of
>> SimpleLDAPObject class (ldapobject.py file) adding a new attribute
>> "pool" which contains the list of servers passed as param in
>> *initialize* method as a string. So, attribute .*_l *changes to:
>> self._l =
>> Then, in *_ldap_call *we introduced a /while/ loop surrounding all
>> code with a boolean condition set to False. When *"func"* call fails
>> raising a "SERVER_DOWN" exception, we remove URI from pool and create
>> a new ReconnectLDAPObject instance with self._l attribute pointing to
>> next LDAP URI in pool.
>> The problem we're actually facing is that when *func *calls raises a
>> SERVER_DOWN exception (with, for example, a *search_s* operation) the
>> code behaviour is correct when URI is wrong, but when LDAP URI is
>> right the func calls stills raises an exception...Is this because of
>> what is explained in the beginning of ReconnectLDAPObject class (that
>> synchronous methods like search_s() automatically tries to reconnect
>> when LDAP server is down)?.
>> Are we pointing in the right direction?
>> Thanks a lot in advance.
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the python-ldap