Goal is to create an /opt/zimbra/data/ldap/ldap.bak
Quote:
|
Originally Posted by script sub migrateLdap($) {
my ($migrateVersion) = @_;
if (main::isInstalled ("zimbra-ldap")) {
if($main::configStatus{"LdapMigrated$migrateVersion"} ne "CONFIGURED") {
if (-f "/opt/zimbra/data/ldap/ldap.bak") {
my $infile = "/opt/zimbra/data/ldap/ldap.bak";
my $outfile = "/opt/zimbra/data/ldap/ldap.60";
if ( -s $infile ) {
open(IN,"<$infile");
open(OUT,">$outfile");
while() {
if ($_ =~ /^zimbraPrefStandardClientAccessilbityMode:/) {next;}
if ($_ =~ /^objectClass: zimbraHsmGlobalConfig/) {next;}
if ($_ =~ /^objectClass: zimbraHsmServer/) {next;}
print OUT $_;
}
} else {
main:rogress("Valid backup file not found, exiting.\n");
return 1;
} |
A way to generate a LDIF output is a
slapcat:
Code:
openldap/sbin/slapcat -f /opt/zimbra/conf/slapd.conf -l /tmp/ldap.ldif
We even roll it into a easier utility:
Quote:
|
Originally Posted by zmslapcat ${zimbra_home}/openldap/sbin/slapcat -F ${zimbra_home}/data/ldap/config -b "" -l $DEST/ldap.bak.${D}
cp -f ${DEST}/ldap.bak.${D} ${DEST}/ldap.bak |
So run this:
Code:
su - zimbra
cd /opt/zimbra/libexec
./zmslapcat /opt/zimbra/data/ldap
Should produce a ldap.bak & ldap.bak.date in /opt/zimbra/data/ldap.
~~~
You don't need to restore but here's how you'd use slapadd:
Code:
/opt/zimbra/openldap/sbin/slapadd -f /opt/zimbra/conf/slapd.conf -l /tmp/ldap.ldif
That command would only work in 5.x since in 6.x OpenLDAP now allows for some on-the-fly configuration changes with zmlocalconfig via a cn=config backend instead of slapd.conf text files for preservation across upgrades.
So, if something went wrong it's better to run:
Code:
/opt/zimbra/openldap/sbin/slapadd -q -b "" -F /opt/zimbra/data/ldap/config/ -cv -l ldap.bak
Edit: You may have a good ldap.bak.timestamp that's not zero length (caused by running the installer multiple times) to use first rather than taking a new one.
Quote:
Originally Posted by mmorse Bug 43591 – ldap.bak issues on GNR upgrades
Quanah also pointed out that depending on when you create this ldap.bak (if your not using one that was created earlier like ldap.bak.timestamp) have to be using the 5.0 slapcat/sleepycatlibs for BDB differences with 6.0 to get a valid backup. |