All,
I got one question, when doing openldap restore, in our script, we tried to remove the openldap/data directory, then restore the backup openldap files.
but since we have other data added in openldap database after backup. then if we doing backup, it will remove the data newly added after backup.
I tried to sldapadd with "-c" option, but the sldapadd command retrun value is 1. so we can't know if this is a error because of existing entry or some other error.
Do you have any idea how to handle this case? ignore the existing entry when doing sldapadd.
Thanks,
Eric.
--On Monday, March 24, 2014 2:54 PM +0800 xiaoming zhao ericxiaomingzhao@hotmail.com wrote:
All,
I got one question, when doing openldap restore, in our script, we tried to remove the openldap/data directory, then restore the backup openldap files.
but since we have other data added in openldap database after backup. then if we doing backup, it will remove the data newly added after backup.
Stop slapd, take a new slapcat, then restore...
--Quanah
--
Quanah Gibson-Mount Architect - Server Zimbra, Inc. -------------------- Zimbra :: the leader in open source messaging and collaboration
quanah,
Thanks for your reponse. maybe I didn't specify case clearly.
we backup the files. then we have to do full installation of the sytem (with new release), in this new installation, we had new data created in openldap during the installation. then we manually restore the data with sldapadd, and the new data creaetd during the full installation was lost because of the old backup file don't include these new data created during full installation.
We tried to with "-c" option to run slapadd, but it still return error result:
like the following code. the slapadd report some entries already exist, then the final result of slapadd is 1 (failure).
slapadd -c .....
if [ $? != 0 ]; then
// print error and exit.
fi
Is it possible that we ingore the existing entry and slapadd return 0 or some meanful result finally?
Thanks,
Eric.
Date: Mon, 24 Mar 2014 10:16:51 -0700 From: quanah@zimbra.com To: ericxiaomingzhao@hotmail.com; openldap-technical@openldap.org Subject: Re: question about openldap restore with command sldapadd
--On Monday, March 24, 2014 2:54 PM +0800 xiaoming zhao ericxiaomingzhao@hotmail.com wrote:
All,
I got one question, when doing openldap restore, in our script, we tried to remove the openldap/data directory, then restore the backup openldap files.
but since we have other data added in openldap database after backup. then if we doing backup, it will remove the data newly added after backup.
Stop slapd, take a new slapcat, then restore...
--Quanah
--
Quanah Gibson-Mount Architect - Server Zimbra, Inc.
Zimbra :: the leader in open source messaging and collaboration
--On Tuesday, March 25, 2014 1:30 PM +0800 xiaoming zhao ericxiaomingzhao@hotmail.com wrote:
quanah,
Thanks for your reponse. maybe I didn't specify case clearly.
we backup the files. then we have to do full installation of the sytem (with new release), in this new installation, we had new data created in openldap during the installation. then we manually restore the data with sldapadd, and the new data creaetd during the full installation was lost because of the old backup file don't include these new data created during full installation.
Sounds like you should restore the backup file as part of the new full installation as one of the first steps. That's what we do with Zimbra.
--Quanah
--
Quanah Gibson-Mount Architect - Server Zimbra, Inc. -------------------- Zimbra :: the leader in open source messaging and collaboration
Quanah,
All,
So openldap can't skip to add the entry if there is already an existing entry? in other database, the insert operation will check the entry exists or not. if exist, do nothing. if not exist, then insert it. there are other operation like insertupdate.
do we have any option to skip the existing entry?
Thanks,
Eric.
Date: Tue, 25 Mar 2014 10:28:21 -0700 From: quanah@zimbra.com To: ericxiaomingzhao@hotmail.com; openldap-technical@openldap.org Subject: RE: question about openldap restore with command sldapadd
--On Tuesday, March 25, 2014 1:30 PM +0800 xiaoming zhao ericxiaomingzhao@hotmail.com wrote:
quanah,
Thanks for your reponse. maybe I didn't specify case clearly.
we backup the files. then we have to do full installation of the sytem (with new release), in this new installation, we had new data created in openldap during the installation. then we manually restore the data with sldapadd, and the new data creaetd during the full installation was lost because of the old backup file don't include these new data created during full installation.
Sounds like you should restore the backup file as part of the new full installation as one of the first steps. That's what we do with Zimbra.
--Quanah
--
Quanah Gibson-Mount Architect - Server Zimbra, Inc.
Zimbra :: the leader in open source messaging and collaboration
--On Wednesday, March 26, 2014 10:03 AM +0800 xiaoming zhao ericxiaomingzhao@hotmail.com wrote:
Quanah, All,
So openldap can't skip to add the entry if there is already an existing entry? in other database, the insert operation will check the entry exists or not. if exist, do nothing. if not exist, then insert it. there are other operation like insertupdate.
do we have any option to skip the existing entry?
slapadd is a tool used for BULK RESTORATION of the ENTIRE DB. You can skip using -c, but it will skip ALL errors. You are *not* using the right tool for what you are attempting to do.
If you want to do something else, try the ldapdiff utility (http://www.openldap.org/faq/data/cache/612.html) and use that to diff your current db and your backup, and then use ldapadd to add the missing entries.
--Quanah
--
Quanah Gibson-Mount Architect - Server Zimbra, Inc. -------------------- Zimbra :: the leader in open source messaging and collaboration
Quanah,
Thanks for your response! I got it.
but why openldap will not skip the insert when the entry already existed. I found some code in openldap already handle like this, anyway, it could take some effort.
rc = mdb_cursor_put( mc, &key, data, MDB_NODUPDATA|MDB_APPEND|MDB_MULTIPLE ); if ( rc ) { if ( rc == MDB_KEYEXIST ) { rc = 0; continue; } rc = -1; break; }
Thanks,
Eric.
Date: Tue, 25 Mar 2014 18:17:44 -0700 From: quanah@zimbra.com To: ericxiaomingzhao@hotmail.com; openldap-technical@openldap.org Subject: RE: question about openldap restore with command sldapadd
--On Wednesday, March 26, 2014 10:03 AM +0800 xiaoming zhao ericxiaomingzhao@hotmail.com wrote:
Quanah, All,
So openldap can't skip to add the entry if there is already an existing entry? in other database, the insert operation will check the entry exists or not. if exist, do nothing. if not exist, then insert it. there are other operation like insertupdate.
do we have any option to skip the existing entry?
slapadd is a tool used for BULK RESTORATION of the ENTIRE DB. You can skip using -c, but it will skip ALL errors. You are *not* using the right tool for what you are attempting to do.
If you want to do something else, try the ldapdiff utility (http://www.openldap.org/faq/data/cache/612.html) and use that to diff your current db and your backup, and then use ldapadd to add the missing entries.
--Quanah
--
Quanah Gibson-Mount Architect - Server Zimbra, Inc.
Zimbra :: the leader in open source messaging and collaboration
openldap-technical@openldap.org