OpenLDAP fails to stop ,but seems to start Ok but then status shows as slapd stopped
Our LDAP server has been behaving erratically lately
1.It fails to stop when you issue command service ldap restart but it "seems" to starts OK 2.However after running command service ldap status (right after youve run the service ldap restart command) it shows slapd is stopped. However bizarrely LDAP authentication works OK in this environment , despite this error. We are running openldap 2.3.43 on RHel 5.3. We have an LDAP main provider(server) which serves the various LDAP servers(replicas) in various other environments. All the other LDAP replicas ,including the main provider are OK and not experiencing this problem (or showing this error) except for this one environment. I have looked in the ldap.log file and the only errors worth mentioning are Jun 25 22:11:14 myldapserver slapd[11593]: daemon IPv6 socket() errno=7 Jun25 22:11:15 myldapserver slapd[11598]: bdb(cn=accesslog):file id2entry.bdb (meta pgno =0) has LSN [1}[900784] Jun25 22:11:15 myldapserver slapd[11598]: bdb(cn=accesslog):end of log is [1][956] Jun25 22:11:15 myldapserver slapd[11598]: bdb(cn=accesslog):/var/log/ldap/accesslog/id2entry.bdb:unexpected file or format Jun25 22:11:15 myldapserver slapd[11598]: bdb_db_opendb_open(cn=accesslog):/var/log/ldap/accesslog/id2entry.bdb) failed: Invalid argument (22) Jun25 22:11:15 myldapserver slapd[11598]: bdb(cn=accesslog):Unknown locker ID :0 Jun25 22:11:15 myldapserver slapd[11598]: Jun25 22:11:15 myldapserver slapd[11598]: backend_startup_one: bi_db_open failed! (22) Jun25 22:11:15 myldapserver slapd[11598]: bd_db_close: alock close failed! Jun 25 22:11:15 myldapserver slapd[11598]: slapd stopped. Jun 25 22:11:15 myldapserver slapd[11598]: connections_destroy: nothing to destroy. I have trawled through various forums but no useful help or solutions suggested Your help would be greatly appreciated. |
Hi,
From the logs posted, looks like slapd is not starting because your database is corrupted. If you have a backup, use it to restore the database. Or try with db_recover to fix the database. Regards |
Bathory,thanks a million for your help this is is what i suspected and i have googled a lot and tried a few commands to recover databases but no joy.
can you please give details as to how you want me to recover the database please i mean steps or commands i will try to google it too.Thanks |
Hi,
I guess you don't have a valid backup of the database. In this case you may try one of the following 2 ways to recover/restore the database 1. The easiest way is to use db_recover to see if you can recover the corrupted database: Go into /var/lib/ldap (or where openldap keeps its data) and run: Code:
db_recover -v 2. If this is a replica, you can use slapcat to take a backup from another replica (or the master) and use it to restore the corrupted database. E.g. run from a working replica: Code:
slapcat -v -f /etc/openldap/slapd.conf -l backup.ldif Then in the problematic server (re)move everything from /var/lib/ldap, except DB_CONFIG, transfer the backup ldif from the previous step and run: Code:
slapadd -v -c -l /path/to/backup.ldif -f /etc/openldap/slapd.conf |
All times are GMT -5. The time now is 02:42 AM. |