]> git.sur5r.net Git - openldap/blob - doc/guide/admin/replication.sdf
Almost complete MirrorMode section. back-ldap proxy example to do.
[openldap] / doc / guide / admin / replication.sdf
1 # $OpenLDAP$
2 # Copyright 1999-2007 The OpenLDAP Foundation, All Rights Reserved.
3 # COPYING RESTRICTIONS APPLY, see COPYRIGHT.
4
5 H1: Replication
6
7 Replicated directories are a fundamental requirement for delivering a 
8 resilient enterprise deployment.
9
10 {{PRD:OpenLDAP}} has various configuration options for creating a replicated 
11 directory. The following sections will discuss these.
12
13 H2: Replication Strategies
14
15
16 H3: Push Based
17
18
19 H5: Replacing Slurpd
20
21 {{Slurpd}} replication has been deprecated in favor of Syncrepl replication and 
22 has been completely removed from OpenLDAP 2.4.
23
24 {{Why was it replaced?}}
25
26 The {{slurpd}} daemon was the original replication mechanism inherited from 
27 UMich's LDAP and operates in push mode: the master pushes changes to the 
28 slaves. It has been replaced for many reasons, in brief:
29
30  * It is not reliable
31  * It is extremely sensitive to the ordering of records in the replog
32  * It can easily go out of sync, at which point manual intervention is 
33    required to resync the slave database with the master directory
34  * It isn't very tolerant of unavailable servers. If a slave goes down 
35    for a long time, the replog may grow to a size that's too large for 
36    slurpd to process
37
38 {{What was it replaced with?}}
39
40 Syncrepl
41
42 {{Why is Syncrepl better?}}
43
44  * Syncrepl is self-synchronizing; you can start with a database in any 
45    state from totally empty to fully synced and it will automatically do 
46    the right thing to achieve and maintain synchronization
47  * Syncrepl can operate in either direction
48  * Data updates can be minimal or maximal
49
50 {{How do I implement a pushed based replication system using Syncrepl?}}
51
52 The easiest way is to point an LDAP backend ({{SECT: Backends}} and {{slapd-ldap(8)}}) 
53 to your slave directory and setup Syncrepl to point to your Master database.
54
55 REFERENCE test045/048 for better explanation of above.
56
57 If you imagine Syncrepl pulling down changes from the Master server, and then
58 pushing those changes out to your slave servers via {{slapd-ldap(8)}}. This is 
59 called proxy mode (elaborate/confirm?).
60
61 DIAGRAM HERE
62
63 BETTER EXAMPLE here from test045/048 for different push/multiproxy examples.
64
65 Here's an example:
66
67
68 >       include         ./schema/core.schema
69 >       include         ./schema/cosine.schema
70 >       include         ./schema/inetorgperson.schema
71 >       include         ./schema/openldap.schema
72 >       include         ./schema/nis.schema
73 >       
74 >       pidfile         /home/ghenry/openldap/ldap/tests/testrun/slapd.3.pid
75 >       argsfile        /home/ghenry/openldap/ldap/tests/testrun/slapd.3.args
76 >       
77 >       modulepath      ../servers/slapd/back-bdb/
78 >       moduleload      back_bdb.la
79 >       modulepath  ../servers/slapd/back-monitor/
80 >       moduleload  back_monitor.la
81 >       modulepath  ../servers/slapd/overlays/
82 >       moduleload  syncprov.la
83 >       modulepath  ../servers/slapd/back-ldap/
84 >       moduleload  back_ldap.la
85 >       
86 >       # We don't need any access to this DSA
87 >       restrict        all
88 >       
89 >       #######################################################################
90 >       # consumer proxy database definitions
91 >       #######################################################################
92 >       
93 >       database        ldap
94 >       suffix          "dc=example,dc=com"
95 >       rootdn          "cn=Whoever"
96 >       uri             ldap://localhost:9012/
97 >       
98 >       lastmod         on
99 >       
100 >       # HACK: use the RootDN of the monitor database as UpdateDN so ACLs apply
101 >       # without the need to write the UpdateDN before starting replication
102 >       acl-bind        bindmethod=simple
103 >                       binddn="cn=Monitor"
104 >                       credentials=monitor
105 >       
106 >       # HACK: use the RootDN of the monitor database as UpdateDN so ACLs apply
107 >       # without the need to write the UpdateDN before starting replication
108 >       syncrepl        rid=1
109 >                       provider=ldap://localhost:9011/
110 >                       binddn="cn=Manager,dc=example,dc=com"
111 >                       bindmethod=simple
112 >                       credentials=secret
113 >                       searchbase="dc=example,dc=com"
114 >                       filter="(objectClass=*)"
115 >                       attrs="*,structuralObjectClass,entryUUID,entryCSN,creatorsName,createTimestamp,modifiersName,modifyTimestamp"
116 >                       schemachecking=off
117 >                       scope=sub
118 >                       type=refreshAndPersist
119 >                       retry="5 5 300 5"
120 >       
121 >       overlay         syncprov
122 >       
123 >       database        monitor
124
125 DETAILED EXPLANATION OF ABOVE LIKE IN OTHER SECTIONS (line numbers?)
126
127
128 ANOTHER DIAGRAM HERE
129
130 As you can see, you can let your imagination go wild using Syncrepl and 
131 {{slapd-ldap(8)}} tailoring your replication to fit your specific network 
132 topology.
133
134 H3: Pull Based
135
136
137 H4: syncrepl replication
138
139
140 H4: delta-syncrepl replication
141
142
143 H2: Replication Types
144
145
146 H3: syncrepl replication
147
148
149 H3: delta-syncrepl replication
150
151
152 H3: N-Way Multi-Master
153
154 http://www.connexitor.com/blog/pivot/entry.php?id=105#body
155 http://www.openldap.org/lists/openldap-software/200702/msg00006.html
156 http://www.openldap.org/lists/openldap-software/200602/msg00064.html
157
158
159 H3: MirrorMode
160
161 MirrorMode is a hybrid configuration that provides all of the consistency
162 guarantees of single-master replication, while also providing the high
163 availability of multi-master. In MirrorMode two masters are set up to
164 replicate from each other (as a multi-master configuration) but an
165 external frontend is employed to direct all writes to only one of
166 the two servers. The second master will only be used for writes if
167 the first master crashes, at which point the frontend will switch to
168 directing all writes to the second master. When a crashed master is
169 repaired and restarted it will automatically catch up to any changes
170 on the running master and resync.
171
172 This is discussed in full in the {{SECT:MirrorMode}} section below
173
174 H2: LDAP Sync Replication
175
176 The {{TERM:LDAP Sync}} Replication engine, {{TERM:syncrepl}} for
177 short, is a consumer-side replication engine that enables the
178 consumer {{TERM:LDAP}} server to maintain a shadow copy of a
179 {{TERM:DIT}} fragment. A syncrepl engine resides at the consumer-side
180 as one of the {{slapd}}(8) threads. It creates and maintains a
181 consumer replica by connecting to the replication provider to perform
182 the initial DIT content load followed either by periodic content
183 polling or by timely updates upon content changes.
184
185 Syncrepl uses the LDAP Content Synchronization (or LDAP Sync for
186 short) protocol as the replica synchronization protocol.  It provides
187 a stateful replication which supports both pull-based and push-based
188 synchronization and does not mandate the use of a history store.
189
190 Syncrepl keeps track of the status of the replication content by
191 maintaining and exchanging synchronization cookies. Because the
192 syncrepl consumer and provider maintain their content status, the
193 consumer can poll the provider content to perform incremental
194 synchronization by asking for the entries required to make the
195 consumer replica up-to-date with the provider content. Syncrepl
196 also enables convenient management of replicas by maintaining replica
197 status.  The consumer replica can be constructed from a consumer-side
198 or a provider-side backup at any synchronization status. Syncrepl
199 can automatically resynchronize the consumer replica up-to-date
200 with the current provider content.
201
202 Syncrepl supports both pull-based and push-based synchronization.
203 In its basic refreshOnly synchronization mode, the provider uses
204 pull-based synchronization where the consumer servers need not be
205 tracked and no history information is maintained.  The information
206 required for the provider to process periodic polling requests is
207 contained in the synchronization cookie of the request itself.  To
208 optimize the pull-based synchronization, syncrepl utilizes the
209 present phase of the LDAP Sync protocol as well as its delete phase,
210 instead of falling back on frequent full reloads. To further optimize
211 the pull-based synchronization, the provider can maintain a per-scope
212 session log as a history store. In its refreshAndPersist mode of
213 synchronization, the provider uses a push-based synchronization.
214 The provider keeps track of the consumer servers that have requested
215 a persistent search and sends them necessary updates as the provider
216 replication content gets modified.
217
218 With syncrepl, a consumer server can create a replica without
219 changing the provider's configurations and without restarting the
220 provider server, if the consumer server has appropriate access
221 privileges for the DIT fragment to be replicated. The consumer
222 server can stop the replication also without the need for provider-side
223 changes and restart.
224
225 Syncrepl supports both partial and sparse replications.  The shadow
226 DIT fragment is defined by a general search criteria consisting of
227 base, scope, filter, and attribute list.  The replica content is
228 also subject to the access privileges of the bind identity of the
229 syncrepl replication connection.
230
231
232 H3: The LDAP Content Synchronization Protocol
233
234 The LDAP Sync protocol allows a client to maintain a synchronized
235 copy of a DIT fragment. The LDAP Sync operation is defined as a set
236 of controls and other protocol elements which extend the LDAP search
237 operation. This section introduces the LDAP Content Sync protocol
238 only briefly.  For more information, refer to {{REF:RFC4533}}.
239
240 The LDAP Sync protocol supports both polling and listening for
241 changes by defining two respective synchronization operations:
242 {{refreshOnly}} and {{refreshAndPersist}}.  Polling is implemented
243 by the {{refreshOnly}} operation.  The client copy is synchronized
244 to the server copy at the time of polling.  The server finishes the
245 search operation by returning {{SearchResultDone}} at the end of
246 the search operation as in the normal search.  The listening is
247 implemented by the {{refreshAndPersist}} operation.  Instead of
248 finishing the search after returning all entries currently matching
249 the search criteria, the synchronization search remains persistent
250 in the server. Subsequent updates to the synchronization content
251 in the server cause additional entry updates to be sent to the
252 client.
253
254 The {{refreshOnly}} operation and the refresh stage of the
255 {{refreshAndPersist}} operation can be performed with a present
256 phase or a delete phase.
257
258 In the present phase, the server sends the client the entries updated
259 within the search scope since the last synchronization. The server
260 sends all requested attributes, be it changed or not, of the updated
261 entries.  For each unchanged entry which remains in the scope, the
262 server sends a present message consisting only of the name of the
263 entry and the synchronization control representing state present.
264 The present message does not contain any attributes of the entry.
265 After the client receives all update and present entries, it can
266 reliably determine the new client copy by adding the entries added
267 to the server, by replacing the entries modified at the server, and
268 by deleting entries in the client copy which have not been updated
269 nor specified as being present at the server.
270
271 The transmission of the updated entries in the delete phase is the
272 same as in the present phase. The server sends all the requested
273 attributes of the entries updated within the search scope since the
274 last synchronization to the client. In the delete phase, however,
275 the server sends a delete message for each entry deleted from the
276 search scope, instead of sending present messages.  The delete
277 message consists only of the name of the entry and the synchronization
278 control representing state delete.  The new client copy can be
279 determined by adding, modifying, and removing entries according to
280 the synchronization control attached to the {{SearchResultEntry}}
281 message.
282
283 In the case that the LDAP Sync server maintains a history store and
284 can determine which entries are scoped out of the client copy since
285 the last synchronization time, the server can use the delete phase.
286 If the server does not maintain any history store, cannot determine
287 the scoped-out entries from the history store, or the history store
288 does not cover the outdated synchronization state of the client,
289 the server should use the present phase.  The use of the present
290 phase is much more efficient than a full content reload in terms
291 of the synchronization traffic.  To reduce the synchronization
292 traffic further, the LDAP Sync protocol also provides several
293 optimizations such as the transmission of the normalized {{EX:entryUUID}}s
294 and the transmission of multiple {{EX:entryUUIDs}} in a single
295 {{syncIdSet}} message.
296
297 At the end of the {{refreshOnly}} synchronization, the server sends
298 a synchronization cookie to the client as a state indicator of the
299 client copy after the synchronization is completed.  The client
300 will present the received cookie when it requests the next incremental
301 synchronization to the server.
302
303 When {{refreshAndPersist}} synchronization is used, the server sends
304 a synchronization cookie at the end of the refresh stage by sending
305 a Sync Info message with TRUE refreshDone.  It also sends a
306 synchronization cookie by attaching it to {{SearchResultEntry}}
307 generated in the persist stage of the synchronization search. During
308 the persist stage, the server can also send a Sync Info message
309 containing the synchronization cookie at any time the server wants
310 to update the client-side state indicator.  The server also updates
311 a synchronization indicator of the client at the end of the persist
312 stage.
313
314 In the LDAP Sync protocol, entries are uniquely identified by the
315 {{EX:entryUUID}} attribute value. It can function as a reliable
316 identifier of the entry. The DN of the entry, on the other hand,
317 can be changed over time and hence cannot be considered as the
318 reliable identifier.  The {{EX:entryUUID}} is attached to each
319 {{SearchResultEntry}} or {{SearchResultReference}} as a part of the
320 synchronization control.
321
322
323 H3: Syncrepl Details
324
325 The syncrepl engine utilizes both the {{refreshOnly}} and the
326 {{refreshAndPersist}} operations of the LDAP Sync protocol.  If a
327 syncrepl specification is included in a database definition,
328 {{slapd}}(8) launches a syncrepl engine as a {{slapd}}(8) thread
329 and schedules its execution. If the {{refreshOnly}} operation is
330 specified, the syncrepl engine will be rescheduled at the interval
331 time after a synchronization operation is completed.  If the
332 {{refreshAndPersist}} operation is specified, the engine will remain
333 active and process the persistent synchronization messages from the
334 provider.
335
336 The syncrepl engine utilizes both the present phase and the delete
337 phase of the refresh synchronization. It is possible to configure
338 a per-scope session log in the provider server which stores the
339 {{EX:entryUUID}}s of a finite number of entries deleted from a
340 replication content.  Multiple replicas of single provider content
341 share the same per-scope session log. The syncrepl engine uses the
342 delete phase if the session log is present and the state of the
343 consumer server is recent enough that no session log entries are
344 truncated after the last synchronization of the client.  The syncrepl
345 engine uses the present phase if no session log is configured for
346 the replication content or if the consumer replica is too outdated
347 to be covered by the session log.  The current design of the session
348 log store is memory based, so the information contained in the
349 session log is not persistent over multiple provider invocations.
350 It is not currently supported to access the session log store by
351 using LDAP operations. It is also not currently supported to impose
352 access control to the session log.
353
354 As a further optimization, even in the case the synchronization
355 search is not associated with any session log, no entries will be
356 transmitted to the consumer server when there has been no update
357 in the replication context.
358
359 The syncrepl engine, which is a consumer-side replication engine,
360 can work with any backends. The LDAP Sync provider can be configured
361 as an overlay on any backend, but works best with the {{back-bdb}}
362 or {{back-hdb}} backend.
363
364 The LDAP Sync provider maintains a {{EX:contextCSN}} for each
365 database as the current synchronization state indicator of the
366 provider content.  It is the largest {{EX:entryCSN}} in the provider
367 context such that no transactions for an entry having smaller
368 {{EX:entryCSN}} value remains outstanding.  The {{EX:contextCSN}}
369 could not just be set to the largest issued {{EX:entryCSN}} because
370 {{EX:entryCSN}} is obtained before a transaction starts and
371 transactions are not committed in the issue order.
372
373 The provider stores the {{EX:contextCSN}} of a context in the
374 {{EX:contextCSN}} attribute of the context suffix entry. The attribute
375 is not written to the database after every update operation though;
376 instead it is maintained primarily in memory. At database start
377 time the provider reads the last saved {{EX:contextCSN}} into memory
378 and uses the in-memory copy exclusively thereafter. By default,
379 changes to the {{EX:contextCSN}} as a result of database updates
380 will not be written to the database until the server is cleanly
381 shut down. A checkpoint facility exists to cause the contextCSN to
382 be written out more frequently if desired.
383
384 Note that at startup time, if the provider is unable to read a
385 {{EX:contextCSN}} from the suffix entry, it will scan the entire
386 database to determine the value, and this scan may take quite a
387 long time on a large database. When a {{EX:contextCSN}} value is
388 read, the database will still be scanned for any {{EX:entryCSN}}
389 values greater than it, to make sure the {{EX:contextCSN}} value
390 truly reflects the greatest committed {{EX:entryCSN}} in the database.
391 On databases which support inequality indexing, setting an eq index
392 on the {{EX:entryCSN}} attribute and configuring {{contextCSN}}
393 checkpoints will greatly speed up this scanning step.
394
395 If no {{EX:contextCSN}} can be determined by reading and scanning
396 the database, a new value will be generated. Also, if scanning the
397 database yielded a greater {{EX:entryCSN}} than was previously
398 recorded in the suffix entry's {{EX:contextCSN}} attribute, a
399 checkpoint will be immediately written with the new value.
400
401 The consumer also stores its replica state, which is the provider's
402 {{EX:contextCSN}} received as a synchronization cookie, in the
403 {{EX:contextCSN}} attribute of the suffix entry.  The replica state
404 maintained by a consumer server is used as the synchronization state
405 indicator when it performs subsequent incremental synchronization
406 with the provider server. It is also used as a provider-side
407 synchronization state indicator when it functions as a secondary
408 provider server in a cascading replication configuration.  Since
409 the consumer and provider state information are maintained in the
410 same location within their respective databases, any consumer can
411 be promoted to a provider (and vice versa) without any special
412 actions.
413
414 Because a general search filter can be used in the syncrepl
415 specification, some entries in the context may be omitted from the
416 synchronization content.  The syncrepl engine creates a glue entry
417 to fill in the holes in the replica context if any part of the
418 replica content is subordinate to the holes. The glue entries will
419 not be returned in the search result unless {{ManageDsaIT}} control
420 is provided.
421
422 Also as a consequence of the search filter used in the syncrepl
423 specification, it is possible for a modification to remove an entry
424 from the replication scope even though the entry has not been deleted
425 on the provider. Logically the entry must be deleted on the consumer
426 but in {{refreshOnly}} mode the provider cannot detect and propagate
427 this change without the use of the session log.
428
429
430 H3: Configuring Syncrepl
431
432 Because syncrepl is a consumer-side replication engine, the syncrepl
433 specification is defined in {{slapd.conf}}(5) of the consumer
434 server, not in the provider server's configuration file.  The initial
435 loading of the replica content can be performed either by starting
436 the syncrepl engine with no synchronization cookie or by populating
437 the consumer replica by adding an {{TERM:LDIF}} file dumped as a
438 backup at the provider.
439
440 When loading from a backup, it is not required to perform the initial
441 loading from the up-to-date backup of the provider content. The
442 syncrepl engine will automatically synchronize the initial consumer
443 replica to the current provider content. As a result, it is not
444 required to stop the provider server in order to avoid the replica
445 inconsistency caused by the updates to the provider content during
446 the content backup and loading process.
447
448 When replicating a large scale directory, especially in a bandwidth
449 constrained environment, it is advised to load the consumer replica
450 from a backup instead of performing a full initial load using
451 syncrepl.
452
453
454 H4: Set up the provider slapd
455
456 The provider is implemented as an overlay, so the overlay itself
457 must first be configured in {{slapd.conf}}(5) before it can be
458 used. The provider has only two configuration directives, for setting
459 checkpoints on the {{EX:contextCSN}} and for configuring the session
460 log.  Because the LDAP Sync search is subject to access control,
461 proper access control privileges should be set up for the replicated
462 content.
463
464 The {{EX:contextCSN}} checkpoint is configured by the
465
466 >       syncprov-checkpoint <ops> <minutes>
467
468 directive. Checkpoints are only tested after successful write
469 operations.  If {{<ops>}} operations or more than {{<minutes>}}
470 time has passed since the last checkpoint, a new checkpoint is
471 performed.
472
473 The session log is configured by the
474
475 >       syncprov-sessionlog <size>
476
477 directive, where {{<size>}} is the maximum number of session log
478 entries the session log can record. When a session log is configured,
479 it is automatically used for all LDAP Sync searches within the
480 database.
481
482 Note that using the session log requires searching on the {{entryUUID}}
483 attribute. Setting an eq index on this attribute will greatly benefit
484 the performance of the session log on the provider.
485
486 A more complete example of the {{slapd.conf}}(5) content is thus:
487
488 >       database bdb
489 >       suffix dc=Example,dc=com
490 >       rootdn dc=Example,dc=com
491 >       directory /var/ldap/db
492 >       index objectclass,entryCSN,entryUUID eq
493 >
494 >       overlay syncprov
495 >       syncprov-checkpoint 100 10
496 >       syncprov-sessionlog 100
497
498
499 H4: Set up the consumer slapd
500
501 The syncrepl replication is specified in the database section of
502 {{slapd.conf}}(5) for the replica context.  The syncrepl engine
503 is backend independent and the directive can be defined with any
504 database type.
505
506 >       database hdb
507 >       suffix dc=Example,dc=com
508 >       rootdn dc=Example,dc=com
509 >       directory /var/ldap/db
510 >       index objectclass,entryCSN,entryUUID eq
511 >
512 >       syncrepl rid=123
513 >               provider=ldap://provider.example.com:389
514 >               type=refreshOnly
515 >               interval=01:00:00:00
516 >               searchbase="dc=example,dc=com"
517 >               filter="(objectClass=organizationalPerson)"
518 >               scope=sub
519 >               attrs="cn,sn,ou,telephoneNumber,title,l"
520 >               schemachecking=off
521 >               bindmethod=simple
522 >               binddn="cn=syncuser,dc=example,dc=com"
523 >               credentials=secret
524
525 In this example, the consumer will connect to the provider {{slapd}}(8)
526 at port 389 of {{FILE:ldap://provider.example.com}} to perform a
527 polling ({{refreshOnly}}) mode of synchronization once a day.  It
528 will bind as {{EX:cn=syncuser,dc=example,dc=com}} using simple
529 authentication with password "secret".  Note that the access control
530 privilege of {{EX:cn=syncuser,dc=example,dc=com}} should be set
531 appropriately in the provider to retrieve the desired replication
532 content. Also the search limits must be high enough on the provider
533 to allow the syncuser to retrieve a complete copy of the requested
534 content.  The consumer uses the rootdn to write to its database so
535 it always has full permissions to write all content.
536
537 The synchronization search in the above example will search for the
538 entries whose objectClass is organizationalPerson in the entire
539 subtree rooted at {{EX:dc=example,dc=com}}. The requested attributes
540 are {{EX:cn}}, {{EX:sn}}, {{EX:ou}}, {{EX:telephoneNumber}},
541 {{EX:title}}, and {{EX:l}}. The schema checking is turned off, so
542 that the consumer {{slapd}}(8) will not enforce entry schema
543 checking when it process updates from the provider {{slapd}}(8).
544
545 For more detailed information on the syncrepl directive, see the
546 {{SECT:syncrepl}} section of {{SECT:The slapd Configuration File}}
547 chapter of this admin guide.
548
549
550 H4: Start the provider and the consumer slapd
551
552 The provider {{slapd}}(8) is not required to be restarted.
553 {{contextCSN}} is automatically generated as needed: it might be
554 originally contained in the {{TERM:LDIF}} file, generated by
555 {{slapadd}} (8), generated upon changes in the context, or generated
556 when the first LDAP Sync search arrives at the provider.  If an
557 LDIF file is being loaded which did not previously contain the
558 {{contextCSN}}, the {{-w}} option should be used with {{slapadd}}
559 (8) to cause it to be generated. This will allow the server to
560 startup a little quicker the first time it runs.
561
562 When starting a consumer {{slapd}}(8), it is possible to provide
563 a synchronization cookie as the {{-c cookie}} command line option
564 in order to start the synchronization from a specific state.  The
565 cookie is a comma separated list of name=value pairs. Currently
566 supported syncrepl cookie fields are {{csn=<csn>}} and {{rid=<rid>}}.
567 {{<csn>}} represents the current synchronization state of the
568 consumer replica.  {{<rid>}} identifies a consumer replica locally
569 within the consumer server. It is used to relate the cookie to the
570 syncrepl definition in {{slapd.conf}}(5) which has the matching
571 replica identifier.  The {{<rid>}} must have no more than 3 decimal
572 digits.  The command line cookie overrides the synchronization
573 cookie stored in the consumer replica database.
574
575
576 H2: N-Way Multi-Master
577
578
579 H2: MirrorMode
580
581 H3: Arguments for MirrorMode
582
583 * Provides a high-availability (HA) solution for directory writes (replicas handle reads)
584 * As long as one Master is operational, writes can safely be excepted
585 * Master nodes replicate from each other, so they are always up to date and
586 can be ready to take over (hot standby)
587 * Syncrepl also allows the master nodes to re-synchronize after any downtime
588 * Delta-Syncrepl can be used
589
590
591 H3: Arguments against MirrorMode
592
593 * MirrorMode is not what is termed as a Multi-Master solution. This is because 
594 writes have to go to one of the mirror nodes at a time
595 * MirrorMode can be termed as Active-Active Hot-Standby, therefor an external 
596 server (slapd in proxy mode) or device (hardware load balancer) to manage which 
597 master is currently active
598 * While syncrepl can recover from a completely empty database, slapadd is much 
599 faster
600 * Does not provide faster or more scalable write performance (neither could 
601   any Multi-Master solution)
602 * Backups are managed slightly differently
603 - If backing up the Berkeley database itself and periodically backing up the 
604 transaction log files, then the same member of the mirror pair needs to be 
605 used to collect logfiles until the next database backup is taken 
606 - To ensure that both databases are consistent, each database might have to be 
607 put in read-only mode while performing a slapcat. 
608 - When using slapcat, the generated LDIF files can be rather large. This can 
609 happen with a non-MirrorMode deployment also.
610
611 H3: MirrorMode Configuration
612
613 MirrorMode configuration is actually very easy. If you have ever setup a normal
614 slapd syncrepl provider, then the only change is the directive:
615
616 >       mirrormode  on
617
618 You also need to make you the {{rid}} of each mirror node pair is different and
619 that the {{provider}} syncrepl directive points to the other mirror pair.
620
621 H4: Mirror Node Configuration
622
623 This is the same as the {{SECT:Set up the provider slapd}} section, referencing
624 {{SECT:delta-syncrepl replication}} if using {{delta-syncrepl}}.
625
626 Here's a specific cut down example:
627
628 MirrorMode node 1:
629
630 >       # syncrepl directives\r
631 >       syncrepl      rid=1\r
632 >                     provider=ldap://ldap-rid2.example.com\r
633 >                     bindmethod=simple\r
634 >                     binddn="cn=mirrormode,dc=example,dc=com"\r
635 >                     credentials=mirrormode\r
636 >                     searchbase="dc=example,dc=com"\r
637 >                     schemachecking=on\r
638 >                     type=refreshAndPersist\r
639 >                     retry="60 +"\r
640 >       \r
641 >       mirrormode on
642
643 MirrorMode node 2:
644
645 >       # syncrepl directives\r
646 >       syncrepl      rid=2\r
647 >                     provider=ldap://ldap-rid1.example.com\r
648 >                     bindmethod=simple\r
649 >                     binddn="cn=mirrormode,dc=example,dc=com"\r
650 >                     credentials=mirrormode\r
651 >                     searchbase="dc=example,dc=com"\r
652 >                     schemachecking=on\r
653 >                     type=refreshAndPersist\r
654 >                     retry="60 +"\r
655 >       \r
656 >       mirrormode on
657
658 It's simple really; each MirrorMode node is setup {{B:exactly}} the same, except
659 that the {{B:provider}} directive is set to point to the other MirrorMode node.
660
661 H4: Failover Configuration
662
663 There are generally 2 choices for this; 1.  Hardware proxies/load-balancing or 
664 dedicated proxy software, 2. using a Back-LDAP proxy as a syncrepl provider
665
666 MORE HERE and a nice PICTURE
667
668
669 H4: Normal Consumer Configuration
670
671 This is exactly the same as the {{SECT:Set up the consumer slapd}} section. It
672 can either setup in normal {{SECT:syncrepl replication}} mode, or in 
673 {{SECT:delta-syncrepl replication}} mode.
674
675 H3: MirrorMode Summary
676
677 Hopefully you will now have a directory architecture that provides all of the 
678 consistency guarantees of single-master replication, whilst also providing the 
679 high availability of multi-master replication.
680
681