habibzain Just husband, father and enthusiastic men about System Administration. Love to write short article about it. Perhaps can help and be useful for others.

Easy Export Import Zimbra Ldap Config and Data

1 min read

zimbra ldap export import

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.

See also  PFlogsumm - Daily Report Postfix Monitoring on CentOS 6

And the last, is starting ldap service.

ldap start

Or you can restart all zimbra service.

zmcontrol stop && zmcontrol start
zimbra ldap export import
Zimbra ‘zmcontrol restart’

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


habibzain Just husband, father and enthusiastic men about System Administration. Love to write short article about it. Perhaps can help and be useful for others.

Zimbra Relay Amazon SES

Zimbra is a widely used collaboration platform that provides robust email services. When it comes to improving email deliverability and ensuring the security of...
habibzain
1 min read

Install Zimbra 10 Ubuntu 20.04 from Scratch

Zimbra 10 may have had specific installation requirements, and there might be updates or changes beyond that point. Here is simple guide how to...
habibzain
4 min read

Zimbra Cannot start TLS: handshake failure

The Zimbra log show error message “Cannot start TLS handshake” typically indicates an issue with establishing a secure TLS (Transport Layer Security) connection. This...
habibzain
1 min read

Leave a Reply

Your email address will not be published. Required fields are marked *

Never miss good article from us, get weekly updates in your inbox