Importing LDAP data from master to replica: Difference between revisions
No edit summary |
No edit summary |
||
Line 5: | Line 5: | ||
# su - zimbra | # su - zimbra | ||
$ ldap stop | $ ldap stop | ||
$ ~/openldap/sbin/slapcat -b | $ ~/openldap/sbin/slapcat -b "" -f ~/conf/slapd.conf -l /tmp/ldap-master.ldif | ||
$ ldap start | $ ldap start | ||
==On the ZCS node where the ldap replica is running== | ==On the ZCS node where the ldap replica is running== | ||
Copy the file ldap-master.ldif from the master to the replica (this example assumes that the hostname of the master is | Copy the file ldap-master.ldif from the master to the replica (this example assumes that the hostname of the master is "master.domain.com"). | ||
# su - zimbra | # su - zimbra | ||
$ scp root@master.domain.com:/tmp/ldap-master.ldif /tmp/ | $ scp root@master.domain.com:/tmp/ldap-master.ldif /tmp/ | ||
Line 16: | Line 16: | ||
$ ldap stop | $ ldap stop | ||
As root, move aside the existing ldap data (for this example, the data directory is renamed with the current date ( | As root, 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. Consult the [[Performance_Tuning_Guidelines_for_Large_Deployments#Configuring_the_BDB_subsystem_to_increase_LDAP_server_performance|LDAP section]] of the performance tuning guide for tips on configuring the DB_CONFIG file if necessary. | ||
$ exit | $ exit | ||
# mv /opt/zimbra/openldap-data /opt/zimbra/openldap-data.2007-12-07-out-of-sync | # mv /opt/zimbra/openldap-data /opt/zimbra/openldap-data.2007-12-07-out-of-sync | ||
# mkdir /opt/zimbra/openldap-data | # mkdir -p /opt/zimbra/openldap-data/logs | ||
# chown zimbra:zimbra /opt/zimbra/openldap-data | # chown zimbra:zimbra /opt/zimbra/openldap-data | ||
# cp /opt/zimbra/openldap-data.2007-12-07-out-of-sync/DB_CONFIG /opt/zimbra/openldap-data/ | # cp /opt/zimbra/openldap-data.2007-12-07-out-of-sync/DB_CONFIG /opt/zimbra/openldap-data/ | ||
Line 25: | Line 25: | ||
As the zimbra user, import the ldap master data. This may take minutes (or even hours), depending on the amount of data and the settings in DB_CONFIG. | As the zimbra user, import the ldap master data. This may take minutes (or even hours), depending on the amount of data and the settings in DB_CONFIG. | ||
# su - zimbra | # su - zimbra | ||
$ ~/openldap/sbin/slapadd -b | $ ~/openldap/sbin/slapadd -b "" -f ~/conf/slapd.conf -l /tmp/ldap-master.ldif | ||
Then start the ldap service and run a test query. | Then start the ldap service and run a test query. | ||
Line 32: | Line 32: | ||
==Related Articles== | ==Related Articles== | ||
[[LDAP]] | [[LDAP]] | ||
[[Promoting_Replica_to_LDAP_Master|Promoting Replica to LDAP Master]] | [[Promoting_Replica_to_LDAP_Master|Promoting Replica to LDAP Master]] | ||
[[Performance_Tuning_Guidelines_for_Large_Deployments|Performance Tuning Guidelines for Large Deployments]] | [[Performance_Tuning_Guidelines_for_Large_Deployments|Performance Tuning Guidelines for Large Deployments]] | ||
[http://man-wiki.net/index.php/8:slapcat slapcat manual page] at man-wiki.net | [http://man-wiki.net/index.php/8:slapcat slapcat manual page] at man-wiki.net | ||
[http://man-wiki.net/index.php/8:slapadd slapadd manual page] at man-wiki.net | [http://man-wiki.net/index.php/8:slapadd slapadd manual page] at man-wiki.net | ||
Revision as of 19:12, 6 June 2008
If an ldap replica is not in sync with the master, it is possible to manually load all of the data from the master into the replica.
On the ZCS node where the ldap master is running
Export an ldif of the master ldap database.
# su - zimbra $ ldap stop $ ~/openldap/sbin/slapcat -b "" -f ~/conf/slapd.conf -l /tmp/ldap-master.ldif $ ldap start
On the ZCS node where the ldap replica is running
Copy the file ldap-master.ldif from the master to the replica (this example assumes that the hostname of the master is "master.domain.com").
# su - zimbra $ scp root@master.domain.com:/tmp/ldap-master.ldif /tmp/
Stop the ldap service.
$ ldap stop
As root, 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. Consult the LDAP section of the performance tuning guide for tips on configuring the DB_CONFIG file if necessary.
$ exit # mv /opt/zimbra/openldap-data /opt/zimbra/openldap-data.2007-12-07-out-of-sync # mkdir -p /opt/zimbra/openldap-data/logs # chown zimbra:zimbra /opt/zimbra/openldap-data # cp /opt/zimbra/openldap-data.2007-12-07-out-of-sync/DB_CONFIG /opt/zimbra/openldap-data/
As the zimbra user, import the ldap master data. This may take minutes (or even hours), depending on the amount of data and the settings in DB_CONFIG.
# su - zimbra $ ~/openldap/sbin/slapadd -b "" -f ~/conf/slapd.conf -l /tmp/ldap-master.ldif
Then start the ldap service and run a test query.
$ ldap start $ zmprov --ldap getAllServers
Related Articles
LDAP Promoting Replica to LDAP Master Performance Tuning Guidelines for Large Deployments
slapcat manual page at man-wiki.net slapadd manual page at man-wiki.net