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/backup
Next ldap config database export.
/opt/zimbra/libexec/zmslapcat -c /opt/zimbra/backup
The last step export accesslog database export (8.0.2 and later):
/opt/zimbra/libexec/zmslapcat -a /opt/zimbra/backup
Preparing 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 running
At first, clean up the old LDAP DB.
cd /opt/zimbra/data/ldap
mv mdb mdb.old
mkdir -p mdb/db
Next, clean up the Configuration old LDP DB.
cd /opt/zimbra/data/ldap
mv config config.bak
mkdir config
And last, Access Log.
cd /opt/zimbra/data/ldap
mv accesslog accesslog.old
mkdir -p accesslog/db
Importing 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 start
Or 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