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

Re: Corrupt LDAP DB ...

On Thursday 27 October 2005 18:26, Robert Larson wrote:
> On Thursday 27 October 2005 07:52 am, C.Lee Taylor wrote:
> > Greetings ...
> ...
> > 	For quite some time, we seem to be getting corrupt LDAP DB.  LDAP just
> > stops working and we can't restarted.  Have done slap slapindex -v -c,
> > but that just hangs.
> I have experienced this problem before.  It was an ldap server I had
> running in UML (UserModeLinux) under Gentoo.  The problem was not related
> to openldap at all though.  I believe it was with the UML server.  A crash
> would result in corrupt database files that were inaccessible in the way
> that you describe.

Sure, but Berkeley DB's transaction support allows you to recover the 
database. However, if it is not recovered before slapd starts up (prior to 
2.3), the transactions aren't rolled forward, and you lose some data, and 
maybe even corrupt the database.

> > 	So, currently, we restart all the LDAP servers in readonly mode, dump
> > the DB and restart LDAP in normal mode.  If a server falls overs, we
> > rsync a readonly DB over the broke LDAP and start working again.
> My hack was to create a cron job that would backup the ldap database
> nightly, then I wrote a small script to rm -r /var/lib/openldap-data,
> slapadd <backup file>, chown ldap -R /var/lib/openldap-data,
> /etc/init.d/slapd start...  This was not a production server, so I could
> get away with not putting effort into it.

Sure, but the hack is not necessary. Either ensure database recovery is run 
whenever it is likely that recover is necessary (some people do it in 
rc.local, or you could do it in the section that runs when slapd is started, 
but not restarted), or upgrade to 2.3 (which will recover the database itself 
when it finds that recovery is required).

A number of distributions ensure this is done for you ...

> My point isn't necessarily that you are not alone, but rather, the issue in
> my case seemed to be resultant of the server itself crashing or causing
> problems, not openldap.

The database can survive the server crash the right steps are in place to 
recover it.

> Perhaps these servers share similar problems 
> external to openldap, and the result is corrupting your databases.

No. A database/directory server should be able to survive a system failure, 
OpenLDAP can.

Buchan Milne
ISP Systems Specialist

Attachment: pgp6EV8167Dm1.pgp
Description: PGP signature