Dear Folks,
With slurpd, copying a tree from one slave to another was like this: 1. stop slapd on both slaves. 2. netcat the directory across from one slave to the other. 3. stop slurpd on master 4. edit slurpd.status to make the time and replication number match by copying that for the source to that for the destination slave. 5. start everything back up.
My question with syncrepl is:
How do I copy the database for a tree from one consumer to another consumer (of the same producer) so that the newly copied replica knows where its replication should continue from?
Is the state for replication of the database stored in the contextCSN of the suffix entry?
If so, does that mean that with syncrepl, the above operation is reduced to the following three steps?
1. Stop slapd on both consumers. 2. Netcat the database from one to the other. 3. start both consumers.
Nick Urbanik wrote:
Dear Folks,
With slurpd, copying a tree from one slave to another was like this:
- stop slapd on both slaves.
- netcat the directory across from one slave to the other.
- stop slurpd on master
- edit slurpd.status to make the time and replication number match by copying that for the source to that for the destination slave.
- start everything back up.
My question with syncrepl is:
How do I copy the database for a tree from one consumer to another consumer (of the same producer) so that the newly copied replica knows where its replication should continue from?
Is the state for replication of the database stored in the contextCSN of the suffix entry?
If so, does that mean that with syncrepl, the above operation is reduced to the following three steps?
- Stop slapd on both consumers.
- Netcat the database from one to the other.
- start both consumers.
The procedures you described would only have worked in the past if all of the servers had identical architecture. The only supported means for copying databases is using slapcat and slapadd, which use LDIF and are architecture-independent. There is no need to stop the first consumer when running slapcat.
Dear Howard,
Thank you for taking the time to answer.
On 22/06/10 07:34 -0700, Howard Chu wrote:
Nick Urbanik wrote:
Dear Folks,
With slurpd, copying a tree from one slave to another was like this:
- stop slapd on both slaves.
- netcat the directory across from one slave to the other.
- stop slurpd on master
- edit slurpd.status to make the time and replication number match by copying that for the source to that for the destination slave.
- start everything back up.
My question with syncrepl is:
How do I copy the database for a tree from one consumer to another consumer (of the same producer) so that the newly copied replica knows where its replication should continue from?
Is the state for replication of the database stored in the contextCSN of the suffix entry?
If so, does that mean that with syncrepl, the above operation is reduced to the following three steps?
- Stop slapd on both consumers.
- Netcat the database from one to the other.
- start both consumers.
The procedures you described would only have worked in the past if all of the servers had identical architecture.
Yes, the slaves are in a cluster of eight, and are all the same architecture.
The only supported means for copying databases is using slapcat and slapadd, which use LDIF and are architecture-independent.
But in the case where the consumers are all the same architecture, do you see a problem with making binary copies of the database?
There is no need to stop the first consumer when running slapcat.
This puzzles me; with hundreds of updates happening per minute, some changes will be missed during the slapcat. Will syncrepl cope and make the new slave identical to the master?
I quote from http://www.openldap.org/doc/admin24/maintenance.html#Directory%20Backups
Slapcat can be run while slapd is active. However, one runs the risk of an inconsistent database- not from the point of slapd, but from the point of the applications using LDAP. For example, if a provisioning application performed tasks that consisted of several LDAP operations, and the slapcat took place concurrently with those operations, then there might be inconsistencies in the LDAP database from the point of view of that provisioning application and applications that depended on it. One must, therefore, be convinced something like that won't happen.
--On Wednesday, June 23, 2010 2:26 PM +1000 Nick Urbanik nick.urbanik@optusnet.com.au wrote:
There is no need to stop the first consumer when running slapcat.
This puzzles me; with hundreds of updates happening per minute, some changes will be missed during the slapcat. Will syncrepl cope and make the new slave identical to the master?
That is the point of how syncrepl operates.
--Quanah
--
Quanah Gibson-Mount Principal Software Engineer Zimbra, Inc -------------------- Zimbra :: the leader in open source messaging and collaboration
Nick Urbanik wrote:
Dear Howard,
Thank you for taking the time to answer.
On 22/06/10 07:34 -0700, Howard Chu wrote:
Nick Urbanik wrote:
Dear Folks,
With slurpd, copying a tree from one slave to another was like this:
- stop slapd on both slaves.
- netcat the directory across from one slave to the other.
- stop slurpd on master
- edit slurpd.status to make the time and replication number match by copying that for the source to that for the destination slave.
- start everything back up.
My question with syncrepl is:
How do I copy the database for a tree from one consumer to another consumer (of the same producer) so that the newly copied replica knows where its replication should continue from?
Is the state for replication of the database stored in the contextCSN of the suffix entry?
If so, does that mean that with syncrepl, the above operation is reduced to the following three steps?
- Stop slapd on both consumers.
- Netcat the database from one to the other.
- start both consumers.
The procedures you described would only have worked in the past if all of the servers had identical architecture.
Yes, the slaves are in a cluster of eight, and are all the same architecture.
The only supported means for copying databases is using slapcat and slapadd, which use LDIF and are architecture-independent.
But in the case where the consumers are all the same architecture, do you see a problem with making binary copies of the database?
There is no need to stop the first consumer when running slapcat.
This puzzles me; with hundreds of updates happening per minute, some changes will be missed during the slapcat. Will syncrepl cope and make the new slave identical to the master?
I quote from http://www.openldap.org/doc/admin24/maintenance.html#Directory%20Backups
Slapcat can be run while slapd is active. However, one runs the risk of an inconsistent database- not from the point of slapd, but from the point of the applications using LDAP. For example, if a provisioning application performed tasks that consisted of several LDAP operations, and the slapcat took place concurrently with those operations, then there might be inconsistencies in the LDAP database from the point of view of that provisioning application and applications that depended on it. One must, therefore, be convinced something like that won't happen.
The note here says you must convince yourself...
As already noted in other posts, the contextCSN is recorded in the suffix entry of the DB, and all replication state is based on that contextCSN. This is always the first entry that slapcat will output. As such, the contextCSN in this LDIF represents the state of that database when the slapcat began. It is possible for updates to occur while slapcat is running that will alter its output, of course. But when the consumer connects to the provider, it will sync up on everything based on the contextCSN.
--On Tuesday, June 22, 2010 12:24 PM +1000 Nick Urbanik nick.urbanik@optusnet.com.au wrote:
If so, does that mean that with syncrepl, the above operation is reduced to the following three steps?
- Stop slapd on both consumers.
- Netcat the database from one to the other.
- start both consumers.
The officially supported method is slapcat/slapadd. But as long as your architecture is the same, yes, the above steps are fine, although I use scp rather than netcat to copy the db. You failed to note running db_recover before copying the databases, which I would recommend (to force writing out any pending data in the BDB env).
--Quanah
--
Quanah Gibson-Mount Principal Software Engineer Zimbra, Inc -------------------- Zimbra :: the leader in open source messaging and collaboration
Dear Quanah,
Thank you again for your very helpful replies.
On 22/06/10 07:57 -0700, Quanah Gibson-Mount wrote:
--On Tuesday, June 22, 2010 12:24 PM +1000 Nick Urbanik nick.urbanik@optusnet.com.au wrote:
If so, does that mean that with syncrepl, the above operation is reduced to the following three steps?
- Stop slapd on both consumers.
- Netcat the database from one to the other.
- start both consumers.
The officially supported method is slapcat/slapadd. But as long as your architecture is the same, yes, the above steps are fine, although I use scp rather than netcat to copy the db.
When the database is many gigabytes in size, netcat is fast; I get impatient :-)
You failed to note running db_recover before copying the databases, which I would recommend (to force writing out any pending data in the BDB env).
Thank you very much for this! I was unaware of the need for this. I will investigate it further.
Nick,
I've done this a number of times - Dev on an 'in production' ldap infrastructure. I've managed to get the boxes out of sync a number of times.
1. Stop slapd. 2. Delete the contents of the db dir 3. Copy a db-config into it. 4. Startup slapd.
The full tree is replicated pretty quickly. Try it out, you'll see. It take less then half a minute to replicate a tree with approx 800 entries (very rough estimate) even on slaves in AZ and masters in WA.
- chris
Chris Jacobs, Systems Administrator Apollo Group | Apollo Marketing | Aptimus 2001 6th Ave Ste 3200 | Seattle, WA 98121 phone: 206.441.9100 x1245 | mobile: 206.601.3256 | fax: 206.441.9661 email: chris.jacobs@apollogrp.edu
----- Original Message ----- From: openldap-technical-bounces+chris.jacobs=apollogrp.edu@OpenLDAP.org openldap-technical-bounces+chris.jacobs=apollogrp.edu@OpenLDAP.org To: openldap-technical@openldap.org openldap-technical@openldap.org Sent: Mon Jun 21 19:24:05 2010 Subject: Copying trees from one consumer to another
Dear Folks,
With slurpd, copying a tree from one slave to another was like this: 1. stop slapd on both slaves. 2. netcat the directory across from one slave to the other. 3. stop slurpd on master 4. edit slurpd.status to make the time and replication number match by copying that for the source to that for the destination slave. 5. start everything back up.
My question with syncrepl is:
How do I copy the database for a tree from one consumer to another consumer (of the same producer) so that the newly copied replica knows where its replication should continue from?
Is the state for replication of the database stored in the contextCSN of the suffix entry?
If so, does that mean that with syncrepl, the above operation is reduced to the following three steps?
1. Stop slapd on both consumers. 2. Netcat the database from one to the other. 3. start both consumers. -- Nick Urbanik http://nicku.org 808-71011 nick.urbanik@optusnet.com.au GPG: 7FFA CDC7 5A77 0558 DC7A 790A 16DF EC5B BB9D 2C24 ID: BB9D2C24 I disclaim, therefore I am.
This message is private and confidential. If you have received it in error, please notify the sender and remove it from your system.
--On Tuesday, June 22, 2010 8:05 AM -0700 Chris Jacobs Chris.Jacobs@apollogrp.edu wrote:
Nick,
I've done this a number of times - Dev on an 'in production' ldap infrastructure. I've managed to get the boxes out of sync a number of times.
- Stop slapd.
- Delete the contents of the db dir
- Copy a db-config into it.
- Startup slapd.
The full tree is replicated pretty quickly. Try it out, you'll see. It take less then half a minute to replicate a tree with approx 800 entries (very rough estimate) even on slaves in AZ and masters in WA.
I'm sure it does work fine for such a tiny database. Get a large database (20 million, 200 million etc), it's not worth the time to do it that way.
--Quanah
--
Quanah Gibson-Mount Principal Software Engineer Zimbra, Inc -------------------- Zimbra :: the leader in open source messaging and collaboration
True, but then we don't know how big his set is.
- chris
Chris Jacobs, Systems Administrator Apollo Group | Apollo Marketing | Aptimus 2001 6th Ave Ste 3200 | Seattle, WA 98121 phone: 206.441.9100 x1245 | mobile: 206.601.3256 | fax: 206.441.9661 email: chris.jacobs@apollogrp.edu
----- Original Message ----- From: Quanah Gibson-Mount quanah@zimbra.com To: Chris Jacobs; 'nick.urbanik@optusnet.com.au' nick.urbanik@optusnet.com.au; 'openldap-technical@openldap.org' openldap-technical@openldap.org Sent: Tue Jun 22 19:23:01 2010 Subject: Re: Copying trees from one consumer to another
--On Tuesday, June 22, 2010 8:05 AM -0700 Chris Jacobs Chris.Jacobs@apollogrp.edu wrote:
Nick,
I've done this a number of times - Dev on an 'in production' ldap infrastructure. I've managed to get the boxes out of sync a number of times.
- Stop slapd.
- Delete the contents of the db dir
- Copy a db-config into it.
- Startup slapd.
The full tree is replicated pretty quickly. Try it out, you'll see. It take less then half a minute to replicate a tree with approx 800 entries (very rough estimate) even on slaves in AZ and masters in WA.
I'm sure it does work fine for such a tiny database. Get a large database (20 million, 200 million etc), it's not worth the time to do it that way.
--Quanah
--
Quanah Gibson-Mount Principal Software Engineer Zimbra, Inc -------------------- Zimbra :: the leader in open source messaging and collaboration
This message is private and confidential. If you have received it in error, please notify the sender and remove it from your system.
Dear Chris,
Thank you for taking the time to offer your experience.
On 22/06/10 08:05 -0700, Chris Jacobs wrote:
Nick,
I've done this a number of times - Dev on an 'in production' ldap infrastructure. I've managed to get the boxes out of sync a number of times.
- Stop slapd.
- Delete the contents of the db dir
- Copy a db-config into it.
- Startup slapd.
The full tree is replicated pretty quickly. Try it out, you'll see. It take less then half a minute to replicate a tree with approx 800 entries (very rough estimate) even on slaves in AZ and masters in WA.
Yes, I tried this out in our dev environment; took a couple of hours.
Most of our directories have in the order of a million entries, some many more: # zgrep '^dn:' 201006230300.gz | wc -l 3377876
Hi,
On 22/06/2010 04:24, Nick Urbanik wrote:
Dear Folks,
With slurpd, copying a tree from one slave to another was like this:
- stop slapd on both slaves.
- netcat the directory across from one slave to the other.
- stop slurpd on master
- edit slurpd.status to make the time and replication number match
by copying that for the source to that for the destination slave. 5. start everything back up.
My question with syncrepl is:
How do I copy the database for a tree from one consumer to another consumer (of the same producer) so that the newly copied replica knows where its replication should continue from?
In general, I avoid copying database files directly (I assume you're talking about the BDB files from a bdb/hdb backend).
However, it can be useful to copy over a LDIF file output by slapcat to speed up a consumer's initial synchronization with it's provider.
Is the state for replication of the database stored in the contextCSN of the suffix entry?
Yes.
If so, does that mean that with syncrepl, the above operation is reduced to the following three steps?
- Stop slapd on both consumers.
- Netcat the database from one to the other.
- start both consumers.
That would probably work, yes.
I would instead recommend doing a slapcat on one consumer, copying over the file to second consumer, slapadd, then starting that consumer.
Jonathan
--On Tuesday, June 22, 2010 5:11 PM +0200 Jonathan Clarke jonathan@phillipoux.net wrote:
I would instead recommend doing a slapcat on one consumer, copying over the file to second consumer, slapadd, then starting that consumer.
This depends a lot on the size of the DB. I work with some in excess of 60GB. The DB copy would be a lot quicker, period. It's all a matter of doing what is best for a given setup.
--Quanah
--
Quanah Gibson-Mount Principal Software Engineer Zimbra, Inc -------------------- Zimbra :: the leader in open source messaging and collaboration
openldap-technical@openldap.org