Hello friend, when normal condition of Zimbra email server is running and live, of course we must have data backups. Backup data in the /opt/zimbra directory with the rsync method is one of them. This post will describe about zimbra ldap export import.
But this rsync method has a deficiency, commonly is user account that is not updated if there is add or change. Therefore, this zimbra backup needs updated from the latest ldap data.
Zimbra LDAP backup is also needed when the zimbra "ldap" service failed to start because the LDAP database is corrupt. Fortunately zimbra ships with a utility to export the configuration and main databases as /opt/zimbra/libexec/zmslapcat. Let started.
Zimbra LDAP Data Export
Preparing LDAP Export
Note : All syntax execute as Zimbra User dan save directory to /opt/zimbra/backup/ and Zimbra Version is 8.x. And It is safe to run zmslapcat while the LDAP server is running.
Type this command to execute ldap main database export.
/opt/zimbra/libexec/zmslapcat /opt/zimbra/backupNext ldap config database export.
/opt/zimbra/libexec/zmslapcat -c /opt/zimbra/backupThe last step export accesslog database export (8.0.2 and later):
/opt/zimbra/libexec/zmslapcat -a /opt/zimbra/backupPreparing LDAP Import
Note : - All data currently in ldap will be deleted if we import from the latest data. - You must have a valid LDIF data export to use for import. - If you delete the current database off of the disk, there will be no way to recover it from that system.
As the Zimbra user:
- Stop slapd
[zimbra@mail backup]$ ldap stop
slapd not runningAt first, clean up the old LDAP DB.
cd /opt/zimbra/data/ldap
mv mdb mdb.old
mkdir -p mdb/dbNext, clean up the Configuration old LDP DB.
cd /opt/zimbra/data/ldap
mv config config.bak
mkdir configAnd last, Access Log.
cd /opt/zimbra/data/ldap
mv accesslog accesslog.old
mkdir -p accesslog/dbImporting The Ldap Data
- Import new config LDAP.
[zimbra@mail ldap]$ /opt/zimbra/libexec/zmslapadd -c /dir-bak/ldap-conf-20210827/ldap-config.bak
_#################### 100.00% eta none elapsed none fast!
Closing DB…
[zimbra@mail ldap]$Import new data LDAP.
[zimbra@mail ldap]$ /opt/zimbra/libexec/zmslapadd /dir-bak/ldap-data-20210827/ldap.bak
_#################### 100.00% eta none elapsed none fast!
Closing DB…I am not restore accesslog LDAP, because i dont have that file result of dumped LDAP.
And the last, is starting ldap service.
ldap startOr you can restart all zimbra service.
zmcontrol stop && zmcontrol start
That is simple post about zimbra ldap export import. May be it’s helpful, please feel free to leave a comment if you have any questions and I’ll appreciate it.
Credit: Wiki Zimbra