LDAP data import export: Difference between revisions

No edit summary
 
(24 intermediate revisions by 6 users not shown)
Line 1: Line 1:
{{ZC}}{{Article Infobox|{{admin}}|{{ZCS 6.0}}||}}=Zimbra OpenLDAP Server=
{{BC|Certified}}
 
__FORCETOC__
== Data export ==
<div class="col-md-12 ibox-content">
=Zimbra OpenLDAP Server=
{{KB|{{ZC}}|{{ZCS 8.0}}|{{ZCS 7.0}}|}}
{{WIP}}


Zimbra ships with a utility to export the configuration and main databases as '''/opt/zimbra/libexec/zmslapcat'''.  It takes a destination directory as an argument for where to store the exported data.  A timestamped export of the database will be created.  It is safe to run '''zmslapcat''' while the LDAP server is running.
Zimbra ships with a utility to export the configuration and main databases as '''/opt/zimbra/libexec/zmslapcat'''.  It takes a destination directory as an argument for where to store the exported data.  A timestamped export of the database will be created.  It is safe to run '''zmslapcat''' while the LDAP server is running.
Line 11: Line 14:
   /opt/zimbra/libexec/zmslapcat -c /tmp
   /opt/zimbra/libexec/zmslapcat -c /tmp


Example of an accesslog database export (8.0.2 and later):
/opt/zimbra/libexec/zmslapcat -a /tmp


== Data import ==
== Data import ==
Line 17: Line 22:


=== Preparing for data import ===
=== Preparing for data import ===
As the Zimbra user:
 
* Stop slapd: ldap stop
'''As the Zimbra user:'''
* Clean up the old database and move it to a new location
 
   cd /opt/zimbra/data/hdb/db
* Stop slapd
  ldap stop
 
* ZCS 6 and 7: Clean up the old database and move it to a new location
   cd /opt/zimbra/data/ldap/hdb/db
   /opt/zimbra/bdb/bin/db_recover
   /opt/zimbra/bdb/bin/db_recover
   cd ../..
   cd ../..
   mv hdb hdb.old
   mv hdb hdb.old
* Create the new directory structure and restore database tuning
 
* ZCS 8 and later: Clean up the old database and move it to a new location
  cd /opt/zimbra/data/ldap
  mv mdb mdb.old
 
* ZCS 6 and 7: Create the new directory structure and restore database tuning
   mkdir -p hdb/db
   mkdir -p hdb/db
   mkdir -p hdb/logs
   mkdir -p hdb/logs
   cd hdb/db
   cd hdb/db
   cp ../../hdb.old/DB_CONFIG .
   cp ../../hdb.old/db/DB_CONFIG .
{{Article_Footer|ZCS 6.0|10/15/2010}}
 
* ZCS 8 and later: Create the new directory structure:
  mkdir -p mdb/db
 
* WARNING: ONLY REMOVE AND RELOAD THE CONFIG DB IF ABSOLUTELY NECESSARY.  Reloading the config db should rarely be necessary (unless you customized the config). To do so though and only if necessary, you would need to clear the config/ directory and import the config data:
  cd /opt/zimbra/data/ldap
  mv config config.bak
  mkdir config
 
* ZCS 8 and later: Reloading the accesslog DB would only apply to a master or multi-master scenario.  If necessary:
  cd /opt/zimbra/data/ldap
  mv accesslog accesslog.old
  mkdir -p accesslog/db


=== Importing the LDAP data ===
=== Importing the LDAP data ===
As the Zibmra user:
'''As the Zimbra user:'''
* Import the data via the slapadd command.  The last argument is the full path to the data export file:
* WARNING: ONLY REMOVE AND RELOAD THE CONFIG DB IF ABSOLUTELY NECESSARY.  If the config data had been removed (if /opt/zimbra/data/ldap/config is empty), import the LDAP config data:
  /opt/zimbra/openldap/sbin/slapadd -q -b '' -F /opt/zimbra/data/ldap/config -l /tmp/ldap.bak
 
Prior to ZCS 8.0.2:
<pre>
/opt/zimbra/openldap/sbin/slapadd -q -n 0 -F /opt/zimbra/data/ldap/config -cv -l /tmp/ldap-config.bak
</pre>
 
ZCS 8.0.2 or later:
<pre>
/opt/zimbra/libexec/zmslapadd -c /tmp/ldap-config.bak
</pre>
 
* Import the production LDAP database.  The last argument is the full path to the data export file:
 
Prior to ZCS 8.0.2:
<pre>
/opt/zimbra/openldap/sbin/slapadd -q -b "" -F /opt/zimbra/data/ldap/config -l /tmp/ldap.bak
</pre>
 
ZCS 8.0.2 or later:
<pre>
/opt/zimbra/libexec/zmslapadd /tmp/ldap.bak
</pre>
 
* Import the accesslog LDAP database via the '''zmslapadd''' command.  The last argument is the full path to the export:
 
ZCS 8.0.2 or later:
<pre>
/opt/zimbra/libexec/zmslapadd -a /tmp/ldap-accesslog.bak
</pre>
 
It may be helpful to review [http://wiki.zimbra.com/wiki/OpenLDAP_Performance_Tuning_6.0 OpenLDAP Performance Tuning Wiki] first to see if there are adjustments to the DB_CONFIG file that are desired prior to import.


{{Article_Footer|ZCS 8.0, ZCS 7.0, ZCS 6.0|10/15/2010}}
[[Category:LDAP]]
[[Category:LDAP]]
[[Category:Performance and Tuning]]
[[Category:Performance and Tuning]]
[[Category:ZCS 8.0]]
[[Category:ZCS 7.0]]
[[Category:ZCS 6.0]]
[[Category:ZCS 6.0]]

Latest revision as of 21:56, 15 December 2015

Zimbra OpenLDAP Server

   KB 3859        Last updated on 2015-12-15  




0.00
(0 votes)


Zimbra ships with a utility to export the configuration and main databases as /opt/zimbra/libexec/zmslapcat. It takes a destination directory as an argument for where to store the exported data. A timestamped export of the database will be created. It is safe to run zmslapcat while the LDAP server is running.

Example of main database export:

 /opt/zimbra/libexec/zmslapcat /tmp

Example of configuration database export:

 /opt/zimbra/libexec/zmslapcat -c /tmp

Example of an accesslog database export (8.0.2 and later):

/opt/zimbra/libexec/zmslapcat -a /tmp

Data import

To import data, the existing database will need to be deleted. 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.

Preparing for data import

As the Zimbra user:

  • Stop slapd
 ldap stop
  • ZCS 6 and 7: Clean up the old database and move it to a new location
 cd /opt/zimbra/data/ldap/hdb/db
 /opt/zimbra/bdb/bin/db_recover
 cd ../..
 mv hdb hdb.old
  • ZCS 8 and later: Clean up the old database and move it to a new location
 cd /opt/zimbra/data/ldap
 mv mdb mdb.old
  • ZCS 6 and 7: Create the new directory structure and restore database tuning
 mkdir -p hdb/db
 mkdir -p hdb/logs
 cd hdb/db
 cp ../../hdb.old/db/DB_CONFIG .
  • ZCS 8 and later: Create the new directory structure:
 mkdir -p mdb/db
  • WARNING: ONLY REMOVE AND RELOAD THE CONFIG DB IF ABSOLUTELY NECESSARY. Reloading the config db should rarely be necessary (unless you customized the config). To do so though and only if necessary, you would need to clear the config/ directory and import the config data:
 cd /opt/zimbra/data/ldap
 mv config config.bak
 mkdir config
  • ZCS 8 and later: Reloading the accesslog DB would only apply to a master or multi-master scenario. If necessary:
 cd /opt/zimbra/data/ldap
 mv accesslog accesslog.old
 mkdir -p accesslog/db

Importing the LDAP data

As the Zimbra user:

  • WARNING: ONLY REMOVE AND RELOAD THE CONFIG DB IF ABSOLUTELY NECESSARY. If the config data had been removed (if /opt/zimbra/data/ldap/config is empty), import the LDAP config data:

Prior to ZCS 8.0.2:

/opt/zimbra/openldap/sbin/slapadd -q -n 0 -F /opt/zimbra/data/ldap/config -cv -l /tmp/ldap-config.bak

ZCS 8.0.2 or later:

/opt/zimbra/libexec/zmslapadd -c /tmp/ldap-config.bak
  • Import the production LDAP database. The last argument is the full path to the data export file:

Prior to ZCS 8.0.2:

/opt/zimbra/openldap/sbin/slapadd -q -b "" -F /opt/zimbra/data/ldap/config -l /tmp/ldap.bak

ZCS 8.0.2 or later:

/opt/zimbra/libexec/zmslapadd /tmp/ldap.bak
  • Import the accesslog LDAP database via the zmslapadd command. The last argument is the full path to the export:

ZCS 8.0.2 or later:

/opt/zimbra/libexec/zmslapadd -a /tmp/ldap-accesslog.bak

It may be helpful to review OpenLDAP Performance Tuning Wiki first to see if there are adjustments to the DB_CONFIG file that are desired prior to import.

Verified Against: ZCS 8.0, ZCS 7.0, ZCS 6.0 Date Created: 10/15/2010
Article ID: https://wiki.zimbra.com/index.php?title=LDAP_data_import_export Date Modified: 2015-12-15



Try Zimbra

Try Zimbra Collaboration with a 60-day free trial.
Get it now »

Want to get involved?

You can contribute in the Community, Wiki, Code, or development of Zimlets.
Find out more. »

Looking for a Video?

Visit our YouTube channel to get the latest webinars, technology news, product overviews, and so much more.
Go to the YouTube channel »

Jump to: navigation, search