[Date Prev][Date Next] [Chronological] [Thread] [Top]

Re: syncrepl style client library functions



Hi Lee

Did you ever create/programme your client? And if yes, care to share the results?

I would be interested in your results to do some provisioning magic with the help of syncrepl and perl.

Many thanks in advance for any help.

Kind regards, Michael


Rich Megginson wrote:
lee_jensen@sento.com wrote:

On Wed, 2005-03-09 at 13:50 -0700, Richard Megginson wrote:


lee_jensen@sento.com wrote:



Hello,

I am currently using syncrepl to replicate to a slave ldap server. I am
impressed with the refresh and persist functionality and would like to
write a client application that performs certain actions when ldap
updates are made. Ideally this client would not poll the server but
could use a refresh and persist style search to recieve notification
when updates are made from the master.

A couple questions,

1) Is this possible?




It should be.



Can anyone provide any more information on this? Are the syncrepl calls
just a generic client interface that anyone can use or is it some kind
of undocumented protocol that should only be used by the replication
engine?


I'm not sure about the slurpd protocol, but if you're talking about this
http://www.ietf.org/internet-drafts/draft-zeilenga-ldup-sync-06.txt
then that is the documentation - just plain old LDAP + some controls.



2) Are there any known client libraries specifically for scripting
languages (PHP,Perl,Python) A c library is also acceptable but requires
more work.




I would suggest Net::LDAP as it allows you the flexibility to define your own controls based on their ASN.1 definitions.



I've looked at the docs on CPAN for Net::LDAP and can't find any way to
call a generic function I'm assuming in this case refreshAndPersist??
Can anyone provide more information preferably some code examples?


No, there is no "function" called refreshAndPersist. You basically construct a Sync Request Control using the Net::LDAP::Controls module and send that along with a plain old LDAP search request. Then you just read the search results along with the controls returned.



2) If I can use this kind of functionality from a scripting language and
a library is available how can I implement functionality like syncrepl
such that if the script dies it can reconnect and get changes made since
the script died as well as persist in recieving future updates. Also if
the LDAP server dies can I keep the client alive and poll the server
till it comes back up. Are these native library calls or do they need to
be implemented in some other way. (I realize this is many questions in
one, sorry)




You have to make sure you save the cookie sent from the server frequently and in a secure place, so you can pass this to the server the next time to only get the delta updates.

If the LDAP server dies you should get back some sort of error like LDAP_SERVER_DOWN, and you will get a similar error if you attempt to reconnect while the server is down. So yes, you could poll trying to reconnect until you get LDAP_SUCCESS.



This makes sense...



Thanks for your help,

Lee









-- stepping stone GmbH Pappelweg 41 CH-3013 Bern

Telefon: +41 31 332 53 63
www.stepping-stone.ch
michael.eichenberger@stepping-stone.ch