Importing LDAP data from provider to replica: Difference between revisions
m (Quanah moved page Importing LDAP data from provider to replica 8.0 to Importing LDAP data from provider to replica without leaving a redirect) |
No edit summary |
||
Line 5: | Line 5: | ||
== Using mdb_copy to reset the replica db== | == Using mdb_copy to reset the replica db== | ||
Using this process, we take a direct copy of the MDB database and transfer it to the replica. This avoids long downtime due to reloading the DB from scratch. | |||
=== On the ZCS LDAP Provider=== | |||
Copy the current MDB database to a file safe for transfering: | |||
# su - zimbra | |||
$ mkdir -p /tmp/mdb-transfer | |||
$ cd data/ldap/mdb | |||
$ mdb_copy db /tmp/mdb-transfer | |||
===On the ZCS LDAP replica === | |||
Move the old database aside, using the current date to mark the out of sync database. | |||
# su - zimbra | |||
$ ldap stop | |||
$ cd /opt/zimbra/data/ldap | |||
$ mv mdb mdb.2013-03-07 | |||
Copy the data.mdb file from the provider to the replica (This example assumes that the hostname of the provider is ''provider.domain.com''). | |||
$ mkdir -p mdb/db | |||
$ cd mdb/db | |||
$ scp zimbra@provider.domain.com:/tmp/mdb-transfer/data.mdb . | |||
$ ldap start | |||
Then start the ldap service and run a test query. | |||
$ ldap start | |||
$ zmprov -l getAllServers | |||
== Using slapcat/slapadd to reload the replica db== | == Using slapcat/slapadd to reload the replica db== | ||
===On the ZCS LDAP | Using this process, we export the database to a text file format (LDIF) and then reload the DB from scratch. For large databases (6 million users+), this can take a significant amount of time. | ||
Export an ldif of the | ===On the ZCS LDAP Provider=== | ||
Export an ldif of the provider ldap database. | |||
# su - zimbra | # su - zimbra | ||
$ ~/libexec/zmslapcat /tmp | $ ~/libexec/zmslapcat /tmp | ||
===On the ZCS LDAP replica=== | ===On the ZCS LDAP replica=== | ||
Copy the file ldap.bak from the | Copy the file ldap.bak from the provider to the replica (this example assumes that the hostname of the provider is ''provider.domain.com''). | ||
# su - zimbra | # su - zimbra | ||
$ scp zimbra@ | $ scp zimbra@provider.domain.com:/tmp/ldap.bak /tmp/ldap-provider.ldif | ||
Stop the ldap service. | Stop the ldap service. | ||
Line 24: | Line 51: | ||
$ mkdir -p /opt/zimbra/data/ldap/mdb/db | $ mkdir -p /opt/zimbra/data/ldap/mdb/db | ||
$ cd | $ cd | ||
$ ./libexec/zmslapadd /tmp/ldap- | $ ./libexec/zmslapadd /tmp/ldap-provider.ldif | ||
Then start the ldap service and run a test query. | Then start the ldap service and run a test query. |
Revision as of 19:21, 7 March 2013
Article Information |
---|
This article applies to the following ZCS versions. |
Copying a Provider database to the Replica
If an ldap replica is not in sync with the provider, it is possible to manually load all of the data from the provider into the replica. There are two methods of doing this. Either using slapcat/slapadd, or using mdb_copy.
Using mdb_copy to reset the replica db
Using this process, we take a direct copy of the MDB database and transfer it to the replica. This avoids long downtime due to reloading the DB from scratch.
On the ZCS LDAP Provider
Copy the current MDB database to a file safe for transfering:
# su - zimbra $ mkdir -p /tmp/mdb-transfer $ cd data/ldap/mdb $ mdb_copy db /tmp/mdb-transfer
On the ZCS LDAP replica
Move the old database aside, using the current date to mark the out of sync database.
# su - zimbra $ ldap stop $ cd /opt/zimbra/data/ldap $ mv mdb mdb.2013-03-07
Copy the data.mdb file from the provider to the replica (This example assumes that the hostname of the provider is provider.domain.com).
$ mkdir -p mdb/db $ cd mdb/db $ scp zimbra@provider.domain.com:/tmp/mdb-transfer/data.mdb . $ ldap start
Then start the ldap service and run a test query.
$ ldap start $ zmprov -l getAllServers
Using slapcat/slapadd to reload the replica db
Using this process, we export the database to a text file format (LDIF) and then reload the DB from scratch. For large databases (6 million users+), this can take a significant amount of time.
On the ZCS LDAP Provider
Export an ldif of the provider ldap database.
# su - zimbra $ ~/libexec/zmslapcat /tmp
On the ZCS LDAP replica
Copy the file ldap.bak from the provider to the replica (this example assumes that the hostname of the provider is provider.domain.com).
# su - zimbra $ scp zimbra@provider.domain.com:/tmp/ldap.bak /tmp/ldap-provider.ldif
Stop the ldap service.
$ ldap stop
As zimbra, move aside the existing ldap data (for this example, the data directory is renamed with the current date (2007-12-07) and state (out-of-sync) of the data), and create a new empty data directory.
$ cd /opt/zimbra/data/ldap $ mv mdb mdb.2007-12-07-out-of-sync $ mkdir -p /opt/zimbra/data/ldap/mdb/db $ cd $ ./libexec/zmslapadd /tmp/ldap-provider.ldif
Then start the ldap service and run a test query.
$ ldap start $ zmprov -l getAllServers
Related Articles
- slapcat manual page at openldap.org
- slapadd manual page at openldap.org