~ubuntu-branches/ubuntu/maverick/openldap/maverick-proposed

« back to all changes in this revision

Viewing changes to doc/guide/admin/replication.sdf

  • Committer: Bazaar Package Importer
  • Author(s): Mathias Gug, Steve Langasek, Mathias Gug
  • Date: 2009-02-18 18:44:00 UTC
  • mfrom: (1.1.2 upstream) (0.1.2 lenny)
  • Revision ID: james.westby@ubuntu.com-20090218184400-zw4mjse9eywt5566
Tags: 2.4.14-0ubuntu1
[ Steve Langasek ]
* New upstream version
  - Fixes a bug with the pcache overlay not returning cached entries
    (closes: #497697)
  - Update evolution-ntlm patch to apply to current Makefiles.
  - (tentatively) drop gnutls-ciphers, since this bug was reported to be
    fixed upstream in 2.4.8.  The fix applied in 2.4.8 didn't match the
    patch from the bug report, so this should be watched for regressions.
* Build against db4.7 instead of db4.2 at last!  Closes: #421946.
* Build with --disable-ndb, to avoid a misbuild when libmysqlclient is
  installed in the build environment.
* New patch, no-crlcheck-for-gnutls, to fix a build failure when using
  --with-tls=gnutls.

[ Mathias Gug ]
* Merge from debian unstable, remaining changes:
  - debian/apparmor-profile: add AppArmor profile
  - debian/slapd.postinst: Reload AA profile on configuration
  - updated debian/slapd.README.Debian for note on AppArmor
  - debian/control: Recommends apparmor >= 2.1+1075-0ubuntu6
  - debian/control: Conflicts with apparmor-profiles << 2.1+1075-0ubuntu4
    to make sure that if earlier version of apparmour-profiles gets
    installed it won't overwrite our profile.
  - Modify Maintainer value to match the DebianMaintainerField
    speficication.
  - follow ApparmorProfileMigration and force apparmor compalin mode on 
    some upgrades (LP: #203529)
  - debian/slapd.dirs: add etc/apparmor.d/force-complain
  - debian/slapd.preinst: create symlink for force-complain on pre-feisty
    upgrades, upgrades where apparmor-profiles profile is unchanged (ie
    non-enforcing) and upgrades where apparmor profile does not exist.
  - debian/slapd.postrm: remove symlink in force-complain/ on purge
  - debian/patches/fix-ucred-libc due to changes how newer glibc handle
    the ucred struct now.
  - debian/control:
    - Build-depend on libltdl7-dev rather then libltdl3-dev.
  - debian/patches/autogen.sh:
    - Call libtoolize with the --install option to install config.{guess,sub}
      files.
  - Don't use local statement in config script as it fails if /bin/sh
    points to bash (LP: #286063).
  - Disable the testsuite on hppa. Allows building of packages on this
    architecture again, once this package is in the archive.
    LP: #288908.
  - debian/slapd.postinst, debian/slapd.script-common: set correct ownership
    and permissions on /var/lib/ldap, /etc/ldap/slapd.d (group readable) and
    /var/run/slapd (world readable). (LP: #257667).
  - debian/patches/nssov-build, debian/rules: 
    Build and package the nss overlay.
    debian/schema/misc.ldif: add ldif file for the misc schema, which defines
    rfc822MailMember (required by the nss overlay).
  - debian/{control,rules}: enable PIE hardening
  - Use cn=config as the default configuration backend instead of 
    slapd.conf. Migrate slapd.conf  file to /etc/ldap/slapd.d/ on upgrade
    asking the end user to enter a new password to control the access to the
    cn=config tree.
* debian/patches/corrupt-contextCSN: The contextCSN can get corrupted at
  times. (ITS: #5947)

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
# $OpenLDAP: pkg/openldap-guide/admin/replication.sdf,v 1.32.2.16 2008/07/10 00:58:19 quanah Exp $
2
 
# Copyright 1999-2008 The OpenLDAP Foundation, All Rights Reserved.
 
1
# $OpenLDAP: pkg/openldap-guide/admin/replication.sdf,v 1.32.2.23 2009/01/22 00:00:47 kurt Exp $
 
2
# Copyright 1999-2009 The OpenLDAP Foundation, All Rights Reserved.
3
3
# COPYING RESTRICTIONS APPLY, see COPYRIGHT.
4
4
 
5
5
H1: Replication
8
8
resilient enterprise deployment.
9
9
 
10
10
{{PRD:OpenLDAP}} has various configuration options for creating a replicated 
11
 
directory. The following sections will discuss these.
12
 
 
13
 
H2: Push Based
14
 
 
15
 
 
16
 
H3: Replacing Slurpd
17
 
 
18
 
{{Slurpd}} replication has been deprecated in favor of Syncrepl replication and 
19
 
has been completely removed from OpenLDAP 2.4.
20
 
 
21
 
{{Why was it replaced?}}
22
 
 
23
 
The {{slurpd}} daemon was the original replication mechanism inherited from 
24
 
UMich's LDAP and operates in push mode: the master pushes changes to the 
25
 
slaves. It has been replaced for many reasons, in brief:
26
 
 
27
 
 * It is not reliable
28
 
 * It is extremely sensitive to the ordering of records in the replog
29
 
 * It can easily go out of sync, at which point manual intervention is 
30
 
   required to resync the slave database with the master directory
31
 
 * It isn't very tolerant of unavailable servers. If a slave goes down 
32
 
   for a long time, the replog may grow to a size that's too large for 
33
 
   slurpd to process
34
 
 
35
 
{{What was it replaced with?}}
36
 
 
37
 
Syncrepl
38
 
 
39
 
{{Why is Syncrepl better?}}
40
 
 
41
 
 * Syncrepl is self-synchronizing; you can start with a database in any 
42
 
   state from totally empty to fully synced and it will automatically do 
43
 
   the right thing to achieve and maintain synchronization
44
 
 * Syncrepl can operate in either direction
45
 
 * Data updates can be minimal or maximal
46
 
 
47
 
{{How do I implement a pushed based replication system using Syncrepl?}}
48
 
 
49
 
The easiest way is to point an LDAP backend ({{SECT: Backends}} and {{slapd-ldap(8)}}) 
50
 
to your slave directory and setup Syncrepl to point to your Master database.
51
 
 
52
 
If you imagine Syncrepl pulling down changes from the Master server, and then
53
 
pushing those changes out to your slave servers via {{slapd-ldap(8)}}. This is 
54
 
called Syncrepl Proxy Mode. You can also use Syncrepl Multi-proxy mode:
55
 
 
56
 
!import "push-based-complete.png"; align="center"; title="Syncrepl Proxy Mode"
57
 
FT[align="Center"] Figure X.Y: Replacing slurpd
58
 
 
59
 
The following example is for a self-contained push-based replication solution:
60
 
 
61
 
>       #######################################################################
62
 
>       # Standard OpenLDAP Master/Provider
63
 
>       #######################################################################
64
 
>       
65
 
>       include     /usr/local/etc/openldap/schema/core.schema
66
 
>       include     /usr/local/etc/openldap/schema/cosine.schema
67
 
>       include     /usr/local/etc/openldap/schema/nis.schema
68
 
>       include     /usr/local/etc/openldap/schema/inetorgperson.schema
69
 
>       
70
 
>       include     /usr/local/etc/openldap/slapd.acl
71
 
>       
72
 
>       modulepath  /usr/local/libexec/openldap
73
 
>       moduleload  back_hdb.la
74
 
>       moduleload  syncprov.la
75
 
>       moduleload  back_monitor.la
76
 
>       moduleload  back_ldap.la
77
 
>       
78
 
>       pidfile     /usr/local/var/slapd.pid
79
 
>       argsfile    /usr/local/var/slapd.args
80
 
>       
81
 
>       loglevel    sync stats
82
 
>       
83
 
>       database    hdb
84
 
>       suffix      "dc=suretecsystems,dc=com"
85
 
>       directory   /usr/local/var/openldap-data
86
 
>       
87
 
>       checkpoint      1024 5
88
 
>       cachesize       10000
89
 
>       idlcachesize    10000
90
 
>       
91
 
>       index       objectClass eq
92
 
>       # rest of indexes
93
 
>       index       default     sub
94
 
>       
95
 
>       rootdn          "cn=admin,dc=suretecsystems,dc=com"
96
 
>       rootpw          testing 
97
 
>       
98
 
>       # syncprov specific indexing
99
 
>       index entryCSN eq
100
 
>       index entryUUID eq
101
 
>       
102
 
>       # syncrepl Provider for primary db
103
 
>       overlay syncprov
104
 
>       syncprov-checkpoint 1000 60
105
 
>       
106
 
>       # Let the replica DN have limitless searches
107
 
>       limits dn.exact="cn=replicator,dc=suretecsystems,dc=com" time.soft=unlimited time.hard=unlimited size.soft=unlimited size.hard=unlimited
108
 
>       
109
 
>       database    monitor
110
 
>       
111
 
>       database    config
112
 
>       rootpw          testing
113
 
>       
114
 
>       ##############################################################################
115
 
>       # Consumer Proxy that pulls in data via Syncrepl and pushes out via slapd-ldap
116
 
>       ##############################################################################
117
 
>       
118
 
>       database        ldap
119
 
>       # ignore conflicts with other databases, as we need to push out to same suffix
120
 
>       hidden              on
121
 
>       suffix          "dc=suretecsystems,dc=com"
122
 
>       rootdn          "cn=slapd-ldap"
123
 
>       uri             ldap://localhost:9012/
124
 
>       
125
 
>       lastmod         on
126
 
>               
127
 
>       # We don't need any access to this DSA
128
 
>       restrict        all
129
 
>       
130
 
>       acl-bind        bindmethod=simple
131
 
>                       binddn="cn=replicator,dc=suretecsystems,dc=com"
132
 
>                       credentials=testing
133
 
>       
134
 
>       syncrepl        rid=001
135
 
>                       provider=ldap://localhost:9011/
136
 
>                       binddn="cn=replicator,dc=suretecsystems,dc=com"
137
 
>                       bindmethod=simple
138
 
>                       credentials=testing
139
 
>                       searchbase="dc=suretecsystems,dc=com"
140
 
>                       type=refreshAndPersist
141
 
>                       retry="5 5 300 5"
142
 
>       
143
 
>       overlay         syncprov
144
 
 
145
 
A replica configuration for this type of setup could be:
146
 
 
147
 
>       #######################################################################
148
 
>       # Standard OpenLDAP Slave without Syncrepl
149
 
>       #######################################################################
150
 
>       
151
 
>       include     /usr/local/etc/openldap/schema/core.schema
152
 
>       include     /usr/local/etc/openldap/schema/cosine.schema
153
 
>       include     /usr/local/etc/openldap/schema/nis.schema
154
 
>       include     /usr/local/etc/openldap/schema/inetorgperson.schema
155
 
>       
156
 
>       include     /usr/local/etc/openldap/slapd.acl
157
 
>       
158
 
>       modulepath  /usr/local/libexec/openldap
159
 
>       moduleload  back_hdb.la
160
 
>       moduleload  syncprov.la
161
 
>       moduleload  back_monitor.la
162
 
>       moduleload  back_ldap.la
163
 
>       
164
 
>       pidfile     /usr/local/var/slapd.pid
165
 
>       argsfile    /usr/local/var/slapd.args
166
 
>       
167
 
>       loglevel    sync stats
168
 
>       
169
 
>       database    hdb
170
 
>       suffix      "dc=suretecsystems,dc=com"
171
 
>       directory   /usr/local/var/openldap-slave/data
172
 
>       
173
 
>       checkpoint      1024 5
174
 
>       cachesize       10000
175
 
>       idlcachesize    10000
176
 
>       
177
 
>       index       objectClass eq
178
 
>       # rest of indexes
179
 
>       index       default     sub
180
 
>       
181
 
>       rootdn          "cn=admin,dc=suretecsystems,dc=com"
182
 
>       rootpw          testing 
183
 
>       
184
 
>       # Let the replica DN have limitless searches
185
 
>       limits dn.exact="cn=replicator,dc=suretecsystems,dc=com" time.soft=unlimited time.hard=unlimited size.soft=unlimited size.hard=unlimited
186
 
>       
187
 
>       updatedn "cn=replicator,dc=suretecsystems,dc=com"
188
 
>       
189
 
>       # Refer updates to the master
190
 
>       updateref   ldap://localhost:9011
191
 
>       
192
 
>       database    monitor
193
 
>       
194
 
>       database    config
195
 
>       rootpw          testing
196
 
 
197
 
You can see we use the {{updatedn}} directive here and example ACLs ({{F:usr/local/etc/openldap/slapd.acl}}) for this could be:
198
 
        
199
 
>       # Give the replica DN unlimited read access.  This ACL may need to be
200
 
>       # merged with other ACL statements.
201
 
>       
202
 
>       access to *
203
 
>            by dn.base="cn=replicator,dc=suretecsystems,dc=com" write
204
 
>            by * break
205
 
>       
206
 
>       access to dn.base=""
207
 
>               by * read
208
 
>       
209
 
>       access to dn.base="cn=Subschema"
210
 
>               by * read
211
 
>       
212
 
>       access to dn.subtree="cn=Monitor"
213
 
>           by dn.exact="uid=admin,dc=suretecsystems,dc=com" write
214
 
>           by users read
215
 
>           by * none
216
 
>       
217
 
>       access to *
218
 
>               by self write
219
 
>               by * read 
220
 
 
221
 
In order to support more replicas, just add more {{database ldap}} sections and
222
 
increment the {{syncrepl rid}} number accordingly.
223
 
 
224
 
Note: You must populate the Master and Slave directories with the same data, 
225
 
unlike when using normal Syncrepl
226
 
 
227
 
If you do not have access to modify the master directory configuration you can
228
 
configure a standalone ldap proxy, which might look like:
229
 
 
230
 
!import "push-based-standalone.png"; align="center"; title="Syncrepl Standalone Proxy Mode"
231
 
FT[align="Center"] Figure X.Y: Replacing slurpd with a standalone version
232
 
 
233
 
The following configuration is an example of a standalone LDAP Proxy:
234
 
 
235
 
>       include     /usr/local/etc/openldap/schema/core.schema
236
 
>       include     /usr/local/etc/openldap/schema/cosine.schema
237
 
>       include     /usr/local/etc/openldap/schema/nis.schema
238
 
>       include     /usr/local/etc/openldap/schema/inetorgperson.schema
239
 
>       
240
 
>       include     /usr/local/etc/openldap/slapd.acl
241
 
>       
242
 
>       modulepath  /usr/local/libexec/openldap
243
 
>       moduleload  syncprov.la
244
 
>       moduleload  back_ldap.la
245
 
>       
246
 
>       ##############################################################################
247
 
>       # Consumer Proxy that pulls in data via Syncrepl and pushes out via slapd-ldap
248
 
>       ##############################################################################
249
 
>       
250
 
>       database        ldap
251
 
>       # ignore conflicts with other databases, as we need to push out to same suffix
252
 
>       hidden              on
253
 
>       suffix          "dc=suretecsystems,dc=com"
254
 
>       rootdn          "cn=slapd-ldap"
255
 
>       uri             ldap://localhost:9012/
256
 
>       
257
 
>       lastmod         on
258
 
>               
259
 
>       # We don't need any access to this DSA
260
 
>       restrict        all
261
 
>       
262
 
>       acl-bind        bindmethod=simple
263
 
>                       binddn="cn=replicator,dc=suretecsystems,dc=com"
264
 
>                       credentials=testing
265
 
>       
266
 
>       syncrepl        rid=001
267
 
>                       provider=ldap://localhost:9011/
268
 
>                       binddn="cn=replicator,dc=suretecsystems,dc=com"
269
 
>                       bindmethod=simple
270
 
>                       credentials=testing
271
 
>                       searchbase="dc=suretecsystems,dc=com"
272
 
>                       type=refreshAndPersist
273
 
>                       retry="5 5 300 5"
274
 
>       
275
 
>       overlay         syncprov
276
 
 
277
 
As you can see, you can let your imagination go wild using Syncrepl and 
278
 
{{slapd-ldap(8)}} tailoring your replication to fit your specific network 
279
 
topology.
280
 
 
281
 
H2: Pull Based
 
11
directory. In previous releases, replication was discussed in terms of
 
12
a {{master}} server and some number of {{slave}} servers. A master
 
13
accepted directory updates from other clients, and a slave only
 
14
accepted updates from a (single) master. The replication structure
 
15
was rigidly defined and any particular database could only fulfill
 
16
a single role, either master or slave.
 
17
 
 
18
As OpenLDAP now supports a wide variety of replication topologies, these
 
19
terms have been deprecated in favor of {{provider}} and
 
20
{{consumer}}: A provider replicates directory updates to consumers; 
 
21
consumers receive replication updates from providers. Unlike the
 
22
rigidly defined master/slave relationships, provider/consumer roles
 
23
are quite fluid: replication updates received in a consumer can be
 
24
further propagated by that consumer to other servers, so a consumer
 
25
can also act simultaneously as a provider. Also, a consumer need not
 
26
be an actual LDAP server; it may be just an LDAP client.
 
27
 
 
28
The following sections will describe the replication technology and
 
29
discuss the various replication options that are available.
 
30
 
 
31
H2: Replication Technology
282
32
 
283
33
H3: LDAP Sync Replication
284
34
 
285
35
The {{TERM:LDAP Sync}} Replication engine, {{TERM:syncrepl}} for
286
36
short, is a consumer-side replication engine that enables the
287
37
consumer {{TERM:LDAP}} server to maintain a shadow copy of a
288
 
{{TERM:DIT}} fragment. A syncrepl engine resides at the consumer-side
289
 
as one of the {{slapd}}(8) threads. It creates and maintains a
 
38
{{TERM:DIT}} fragment. A syncrepl engine resides at the consumer
 
39
and executes as one of the {{slapd}}(8) threads. It creates and maintains a
290
40
consumer replica by connecting to the replication provider to perform
291
41
the initial DIT content load followed either by periodic content
292
42
polling or by timely updates upon content changes.
293
43
 
294
 
Syncrepl uses the LDAP Content Synchronization (or LDAP Sync for
295
 
short) protocol as the replica synchronization protocol.  It provides
 
44
Syncrepl uses the LDAP Content Synchronization protocol (or LDAP Sync for
 
45
short) as the replica synchronization protocol.  LDAP Sync provides
296
46
a stateful replication which supports both pull-based and push-based
297
47
synchronization and does not mandate the use of a history store.
 
48
In pull-based replication the consumer periodically
 
49
polls the provider for updates. In push-based replication the consumer
 
50
listens for updates that are sent by the provider in realtime. Since the
 
51
protocol does not require a history store, the provider does not need to
 
52
maintain any log of updates it has received.  (Note
 
53
that the syncrepl engine is extensible and additional replication
 
54
protocols may be supported in the future.)
298
55
 
299
56
Syncrepl keeps track of the status of the replication content by
300
57
maintaining and exchanging synchronization cookies. Because the
331
88
server can stop the replication also without the need for provider-side
332
89
changes and restart.
333
90
 
334
 
Syncrepl supports both partial and sparse replications.  The shadow
 
91
Syncrepl supports partial, sparse, and fractional replications.  The shadow
335
92
DIT fragment is defined by a general search criteria consisting of
336
93
base, scope, filter, and attribute list.  The replica content is
337
94
also subject to the access privileges of the bind identity of the
346
103
operation. This section introduces the LDAP Content Sync protocol
347
104
only briefly.  For more information, refer to {{REF:RFC4533}}.
348
105
 
349
 
The LDAP Sync protocol supports both polling and listening for
350
 
changes by defining two respective synchronization operations:
 
106
The LDAP Sync protocol supports both polling and listening for changes
 
107
by defining two respective synchronization operations:
351
108
{{refreshOnly}} and {{refreshAndPersist}}.  Polling is implemented
352
 
by the {{refreshOnly}} operation.  The client copy is synchronized
353
 
to the server copy at the time of polling.  The server finishes the
 
109
by the {{refreshOnly}} operation. The consumer
 
110
polls the provider using an LDAP Search request with an LDAP Sync
 
111
control attached. The consumer copy is synchronized
 
112
to the provider copy at the time of polling using the information
 
113
returned in the search.  The provider finishes the
354
114
search operation by returning {{SearchResultDone}} at the end of
355
 
the search operation as in the normal search.  The listening is
356
 
implemented by the {{refreshAndPersist}} operation.  Instead of
 
115
the search operation as in the normal search.  Listening is
 
116
implemented by the {{refreshAndPersist}} operation. As the name
 
117
implies, it begins with a search, like refreshOnly. Instead of
357
118
finishing the search after returning all entries currently matching
358
119
the search criteria, the synchronization search remains persistent
359
 
in the server. Subsequent updates to the synchronization content
360
 
in the server cause additional entry updates to be sent to the
361
 
client.
 
120
in the provider. Subsequent updates to the synchronization content
 
121
in the provider cause additional entry updates to be sent to the
 
122
consumer.
362
123
 
363
124
The {{refreshOnly}} operation and the refresh stage of the
364
125
{{refreshAndPersist}} operation can be performed with a present
365
126
phase or a delete phase.
366
127
 
367
 
In the present phase, the server sends the client the entries updated
368
 
within the search scope since the last synchronization. The server
369
 
sends all requested attributes, be it changed or not, of the updated
 
128
In the present phase, the provider sends the consumer the entries updated
 
129
within the search scope since the last synchronization. The provider
 
130
sends all requested attributes, be they changed or not, of the updated
370
131
entries.  For each unchanged entry which remains in the scope, the
371
 
server sends a present message consisting only of the name of the
 
132
provider sends a present message consisting only of the name of the
372
133
entry and the synchronization control representing state present.
373
134
The present message does not contain any attributes of the entry.
374
 
After the client receives all update and present entries, it can
375
 
reliably determine the new client copy by adding the entries added
376
 
to the server, by replacing the entries modified at the server, and
377
 
by deleting entries in the client copy which have not been updated
378
 
nor specified as being present at the server.
 
135
After the consumer receives all update and present entries, it can
 
136
reliably determine the new consumer copy by adding the entries added
 
137
to the provider, by replacing the entries modified at the provider, and
 
138
by deleting entries in the consumer copy which have not been updated
 
139
nor specified as being present at the provider.
379
140
 
380
141
The transmission of the updated entries in the delete phase is the
381
 
same as in the present phase. The server sends all the requested
 
142
same as in the present phase. The provider sends all the requested
382
143
attributes of the entries updated within the search scope since the
383
 
last synchronization to the client. In the delete phase, however,
384
 
the server sends a delete message for each entry deleted from the
 
144
last synchronization to the consumer. In the delete phase, however,
 
145
the provider sends a delete message for each entry deleted from the
385
146
search scope, instead of sending present messages.  The delete
386
147
message consists only of the name of the entry and the synchronization
387
 
control representing state delete.  The new client copy can be
 
148
control representing state delete.  The new consumer copy can be
388
149
determined by adding, modifying, and removing entries according to
389
150
the synchronization control attached to the {{SearchResultEntry}}
390
151
message.
391
152
 
392
 
In the case that the LDAP Sync server maintains a history store and
393
 
can determine which entries are scoped out of the client copy since
394
 
the last synchronization time, the server can use the delete phase.
395
 
If the server does not maintain any history store, cannot determine
 
153
In the case that the LDAP Sync provider maintains a history store and
 
154
can determine which entries are scoped out of the consumer copy since
 
155
the last synchronization time, the provider can use the delete phase.
 
156
If the provider does not maintain any history store, cannot determine
396
157
the scoped-out entries from the history store, or the history store
397
 
does not cover the outdated synchronization state of the client,
398
 
the server should use the present phase.  The use of the present
 
158
does not cover the outdated synchronization state of the consumer,
 
159
the provider should use the present phase.  The use of the present
399
160
phase is much more efficient than a full content reload in terms
400
161
of the synchronization traffic.  To reduce the synchronization
401
162
traffic further, the LDAP Sync protocol also provides several
403
164
and the transmission of multiple {{EX:entryUUIDs}} in a single
404
165
{{syncIdSet}} message.
405
166
 
406
 
At the end of the {{refreshOnly}} synchronization, the server sends
407
 
a synchronization cookie to the client as a state indicator of the
408
 
client copy after the synchronization is completed.  The client
 
167
At the end of the {{refreshOnly}} synchronization, the provider sends
 
168
a synchronization cookie to the consumer as a state indicator of the
 
169
consumer copy after the synchronization is completed.  The consumer
409
170
will present the received cookie when it requests the next incremental
410
 
synchronization to the server.
 
171
synchronization to the provider.
411
172
 
412
 
When {{refreshAndPersist}} synchronization is used, the server sends
 
173
When {{refreshAndPersist}} synchronization is used, the provider sends
413
174
a synchronization cookie at the end of the refresh stage by sending
414
 
a Sync Info message with TRUE refreshDone.  It also sends a
 
175
a Sync Info message with refreshDone=TRUE.  It also sends a
415
176
synchronization cookie by attaching it to {{SearchResultEntry}}
416
 
generated in the persist stage of the synchronization search. During
417
 
the persist stage, the server can also send a Sync Info message
418
 
containing the synchronization cookie at any time the server wants
419
 
to update the client-side state indicator.  The server also updates
420
 
a synchronization indicator of the client at the end of the persist
421
 
stage.
 
177
messages generated in the persist stage of the synchronization search. During
 
178
the persist stage, the provider can also send a Sync Info message
 
179
containing the synchronization cookie at any time the provider wants
 
180
to update the consumer-side state indicator.
422
181
 
423
182
In the LDAP Sync protocol, entries are uniquely identified by the
424
183
{{EX:entryUUID}} attribute value. It can function as a reliable
428
187
{{SearchResultEntry}} or {{SearchResultReference}} as a part of the
429
188
synchronization control.
430
189
 
431
 
 
432
190
H4: Syncrepl Details
433
191
 
434
192
The syncrepl engine utilizes both the {{refreshOnly}} and the
444
202
 
445
203
The syncrepl engine utilizes both the present phase and the delete
446
204
phase of the refresh synchronization. It is possible to configure
447
 
a per-scope session log in the provider server which stores the
 
205
a session log in the provider which stores the
448
206
{{EX:entryUUID}}s of a finite number of entries deleted from a
449
 
replication content.  Multiple replicas of single provider content
450
 
share the same per-scope session log. The syncrepl engine uses the
 
207
database. Multiple replicas share the same session log. The syncrepl
 
208
engine uses the
451
209
delete phase if the session log is present and the state of the
452
210
consumer server is recent enough that no session log entries are
453
211
truncated after the last synchronization of the client.  The syncrepl
538
296
For configuration, please see the {{SECT:Syncrepl}} section.
539
297
 
540
298
 
 
299
H2: Deployment Alternatives
 
300
 
 
301
While the LDAP Sync specification only defines a narrow scope for replication,
 
302
the OpenLDAP implementation is extremely flexible and supports a variety of
 
303
operating modes to handle other scenarios not explicitly addressed in the spec.
 
304
 
 
305
 
541
306
H3: Delta-syncrepl replication
542
307
 
543
 
* Disadvantages of Syncrepl replication:
 
308
* Disadvantages of LDAP Sync replication:
544
309
 
545
 
OpenLDAP's syncrepl replication is an object-based replication mechanism. 
 
310
LDAP Sync replication is an object-based replication mechanism. 
546
311
When any attribute value in a replicated object is changed on the provider, 
547
 
each consumer fetches and processes the complete changed object {B:both changed and unchanged attribute values}
548
 
 during replication. This works well, but has drawbacks in some situations. 
 
312
each consumer fetches and processes the complete changed object, including
 
313
{{B:both the changed and unchanged attribute values}} during replication.
 
314
One advantage of this approach is that when multiple changes occur to
 
315
a single object, the precise sequence of those changes need not be preserved;
 
316
only the final state of the entry is significant. But this approach
 
317
may have drawbacks when the usage pattern involves single changes to
 
318
multiple objects.
549
319
 
550
320
For example, suppose you have a database consisting of 100,000 objects of 1 KB 
551
321
each. Further, suppose you routinely run a batch job to change the value of 
552
322
a single two-byte attribute value that appears in each of the 100,000 objects 
553
323
on the master. Not counting LDAP and TCP/IP protocol overhead, each time you 
554
 
run this job each consumer will transfer and process {B:1 GB} of data to process 
555
 
{B:200KB of changes! }
 
324
run this job each consumer will transfer and process {{B:1 GB}} of data to
 
325
process {{B:200KB of changes!}}
556
326
 
557
327
99.98% of the data that is transmitted and processed in a case like this will 
558
328
be redundant, since it represents values that did not change. This is a waste 
565
335
 
566
336
Delta-syncrepl, a changelog-based variant of syncrepl, is designed to address 
567
337
situations like the one described above. Delta-syncrepl works by maintaining a 
568
 
changelog of a selectable depth on the provider. The replication consumer on 
569
 
each consumer checks the changelog for the changes it needs and, as long as 
570
 
the changelog contains the needed changes, the delta-syncrepl consumer fetches 
571
 
them from the changelog and applies them to its database. If, however, a replica 
 
338
changelog of a selectable depth on the provider. The replication consumer 
 
339
checks the changelog for the changes it needs and, as long as 
 
340
the changelog contains the needed changes, the consumer fetches the changes
 
341
from the changelog and applies them to its database. If, however, a replica 
572
342
is too far out of sync (or completely empty), conventional syncrepl is used to 
573
 
bring it up to date and replication then switches to the delta-syncrepl mode.
 
343
bring it up to date and replication then switches back to the delta-syncrepl
 
344
mode.
574
345
 
575
346
For configuration, please see the {{SECT:Delta-syncrepl}} section.
576
347
 
577
348
 
578
 
H2: Mixture of both Pull and Push based
579
 
 
580
349
H3: N-Way Multi-Master replication
581
350
 
582
351
Multi-Master replication is a replication technique using Syncrepl to replicate 
583
 
data to multiple Master Directory servers. 
584
 
 
585
 
* Advantages of Multi-Master replication:
586
 
 
587
 
- If any master fails, other masters will continue to accept updates
588
 
- Avoids a single point of failure
589
 
- Masters can be located in several physical sites i.e. distributed across the 
590
 
network/globe.
591
 
- Good for Automatic failover/High Availability
592
 
 
593
 
* Disadvantages of Multi-Master replication:
594
 
 
595
 
- It has {{B:NOTHING}} to do with load balancing
596
 
- {{URL:http://www.openldap.org/faq/data/cache/1240.html}}
597
 
- If connectivity with a master is lost because of a network partition, then 
 
352
data to multiple provider ("Master") Directory servers. 
 
353
 
 
354
H4: Valid Arguments for Multi-Master replication
 
355
 
 
356
* If any provider fails, other providers will continue to accept updates
 
357
* Avoids a single point of failure
 
358
* Providers can be located in several physical sites i.e. distributed across
 
359
the network/globe.
 
360
* Good for Automatic failover/High Availability
 
361
 
 
362
H4: Invalid Arguments for Multi-Master replication
 
363
 
 
364
(These are often claimed to be advantages of Multi-Master replication but
 
365
those claims are false):
 
366
 
 
367
* It has {{B:NOTHING}} to do with load balancing
 
368
* Providers {{B:must}} propagate writes to {{B:all}} the other servers, which 
 
369
means the network traffic and write load spreads across all 
 
370
of the servers the same as for single-master.
 
371
* Server utilization and performance are at best identical for
 
372
Multi-Master and Single-Master replication; at worst Single-Master is
 
373
superior because indexing can be tuned differently to optimize for the
 
374
different usage patterns between the provider and the consumers.
 
375
 
 
376
H4: Arguments against Multi-Master replication
 
377
 
 
378
* Breaks the data consistency guarantees of the directory model
 
379
* {{URL:http://www.openldap.org/faq/data/cache/1240.html}}
 
380
* If connectivity with a provider is lost because of a network partition, then 
598
381
"automatic failover" can just compound the problem
599
 
- Typically, a particular machine cannot distinguish between losing contact
 
382
* Typically, a particular machine cannot distinguish between losing contact
600
383
 with a peer because that peer crashed, or because the network link has failed
601
 
- If a network is partitioned and multiple clients start writing to each of the 
 
384
* If a network is partitioned and multiple clients start writing to each of the 
602
385
"masters" then reconciliation will be a pain; it may be best to simply deny 
603
 
writes to the clients that are partitioned from the single master
604
 
- Masters {{B:must}} propagate writes to {{B:all}} the other servers, which 
605
 
means the network traffic and write load is constant and spreads across all 
606
 
of the servers
 
386
writes to the clients that are partitioned from the single provider
607
387
 
608
388
 
609
389
For configuration, please see the {{SECT:N-Way Multi-Master}} section below
612
392
 
613
393
MirrorMode is a hybrid configuration that provides all of the consistency
614
394
guarantees of single-master replication, while also providing the high
615
 
availability of multi-master. In MirrorMode two masters are set up to
616
 
replicate from each other (as a multi-master configuration) but an
 
395
availability of multi-master. In MirrorMode two providers are set up to
 
396
replicate from each other (as a multi-master configuration), but an
617
397
external frontend is employed to direct all writes to only one of
618
 
the two servers. The second master will only be used for writes if
619
 
the first master crashes, at which point the frontend will switch to
620
 
directing all writes to the second master. When a crashed master is
 
398
the two servers. The second provider will only be used for writes if
 
399
the first provider crashes, at which point the frontend will switch to
 
400
directing all writes to the second provider. When a crashed provider is
621
401
repaired and restarted it will automatically catch up to any changes
622
 
on the running master and resync.
 
402
on the running provider and resync.
623
403
 
624
404
H4: Arguments for MirrorMode
625
405
 
626
406
* Provides a high-availability (HA) solution for directory writes (replicas handle reads)
627
 
* As long as one Master is operational, writes can safely be accepted
628
 
* Master nodes replicate from each other, so they are always up to date and
 
407
* As long as one provider is operational, writes can safely be accepted
 
408
* Provider nodes replicate from each other, so they are always up to date and
629
409
can be ready to take over (hot standby)
630
 
* Syncrepl also allows the master nodes to re-synchronize after any downtime
631
 
* Delta-Syncrepl can be used
 
410
* Syncrepl also allows the provider nodes to re-synchronize after any downtime
632
411
 
633
412
 
634
413
H4: Arguments against MirrorMode
635
414
 
636
415
* MirrorMode is not what is termed as a Multi-Master solution. This is because 
637
 
writes have to go to one of the mirror nodes at a time
638
 
* MirrorMode can be termed as Active-Active Hot-Standby, therefor an external 
639
 
server (slapd in proxy mode) or device (hardware load balancer) to manage which 
640
 
master is currently active
641
 
* While syncrepl can recover from a completely empty database, slapadd is much 
642
 
faster
643
 
* Does not provide faster or more scalable write performance (neither could 
644
 
  any Multi-Master solution)
 
416
writes have to go to just one of the mirror nodes at a time
 
417
* MirrorMode can be termed as Active-Active Hot-Standby, therefore an external 
 
418
server (slapd in proxy mode) or device (hardware load balancer)
 
419
is needed to manage which provider is currently active
645
420
* Backups are managed slightly differently
646
421
- If backing up the Berkeley database itself and periodically backing up the 
647
422
transaction log files, then the same member of the mirror pair needs to be 
648
423
used to collect logfiles until the next database backup is taken 
649
424
- To ensure that both databases are consistent, each database might have to be 
650
425
put in read-only mode while performing a slapcat. 
651
 
- When using slapcat, the generated LDIF files can be rather large. This can 
652
 
happen with a non-MirrorMode deployment also.
 
426
* Delta-Syncrepl is not yet supported
653
427
 
654
428
For configuration, please see the {{SECT:MirrorMode}} section below
655
429
 
656
430
 
 
431
H3: Syncrepl Proxy Mode
 
432
 
 
433
While the LDAP Sync protocol supports both pull- and push-based replication,
 
434
the push mode (refreshAndPersist) must still be initiated from the consumer
 
435
before the provider can begin pushing changes. In some network configurations,
 
436
particularly where firewalls restrict the direction in which connections
 
437
can be made, a provider-initiated push mode may be needed. 
 
438
 
 
439
This mode can be configured with the aid of the LDAP Backend
 
440
({{SECT: Backends}} and {{slapd-ldap(8)}}). Instead of running the
 
441
syncrepl engine on the actual consumer, a slapd-ldap proxy is set up
 
442
near (or collocated with) the provider that points to the consumer,
 
443
and the syncrepl engine runs on the proxy.
 
444
 
 
445
For configuration, please see the {{SECT:Syncrepl Proxy}} section.
 
446
 
 
447
H4: Replacing Slurpd
 
448
 
 
449
The old {{slurpd}} mechanism only operated in provider-initiated
 
450
push mode.  Slurpd replication was deprecated in favor of Syncrepl
 
451
replication and has been completely removed from OpenLDAP 2.4.
 
452
 
 
453
The slurpd daemon was the original replication mechanism inherited from 
 
454
UMich's LDAP and operated in push mode: the master pushed changes to the 
 
455
slaves. It was replaced for many reasons, in brief:
 
456
 
 
457
 * It was not reliable
 
458
 ** It was extremely sensitive to the ordering of records in the replog
 
459
 ** It could easily go out of sync, at which point manual intervention was 
 
460
   required to resync the slave database with the master directory
 
461
 ** It wasn't very tolerant of unavailable servers. If a slave went down 
 
462
   for a long time, the replog could grow to a size that was too large for 
 
463
   slurpd to process
 
464
 * It only worked in push mode
 
465
 * It required stopping and restarting the master to add new slaves
 
466
 * It only supported single master replication
 
467
 
 
468
Syncrepl has none of those weaknesses:
 
469
 
 
470
 * Syncrepl is self-synchronizing; you can start with a consumer database
 
471
   in any state from totally empty to fully synced and it will automatically
 
472
   do the right thing to achieve and maintain synchronization
 
473
 ** It is completely insensitive to the order in which changes occur
 
474
 ** It guarantees convergence between the consumer and the provider
 
475
    content without manual intervention
 
476
 ** It can resynchronize regardless of how long a consumer stays out
 
477
    of contact with the provider
 
478
 * Syncrepl can operate in either direction
 
479
 * Consumers can be added at any time without touching anything on the
 
480
   provider
 
481
 * Multi-master replication is supported
 
482
 
 
483
 
657
484
H2: Configuring the different replication types
658
485
 
659
486
H3: Syncrepl
665
492
server, not in the provider server's configuration file.  The initial
666
493
loading of the replica content can be performed either by starting
667
494
the syncrepl engine with no synchronization cookie or by populating
668
 
the consumer replica by adding an {{TERM:LDIF}} file dumped as a
 
495
the consumer replica by loading an {{TERM:LDIF}} file dumped as a
669
496
backup at the provider.
670
497
 
671
498
When loading from a backup, it is not required to perform the initial
771
598
are {{EX:cn}}, {{EX:sn}}, {{EX:ou}}, {{EX:telephoneNumber}},
772
599
{{EX:title}}, and {{EX:l}}. The schema checking is turned off, so
773
600
that the consumer {{slapd}}(8) will not enforce entry schema
774
 
checking when it process updates from the provider {{slapd}}(8).
 
601
checking when it processes updates from the provider {{slapd}}(8).
775
602
 
776
603
For more detailed information on the syncrepl directive, see the
777
604
{{SECT:syncrepl}} section of {{SECT:The slapd Configuration File}}
806
633
 
807
634
H3: Delta-syncrepl
808
635
 
809
 
H4: Delta-syncrepl Master configuration
 
636
H4: Delta-syncrepl Provider configuration
810
637
 
811
638
Setting up delta-syncrepl requires configuration changes on both the master and 
812
639
replica servers:
813
640
 
814
 
>     # Give the replica DN unlimited read access.  This ACL may need to be
815
 
>     # merged with other ACL statements.
816
 
>     
 
641
>     # Give the replica DN unlimited read access.  This ACL needs to be
 
642
>     # merged with other ACL statements, and/or moved within the scope
 
643
>     # of a database.  The "by * break" portion causes evaluation of
 
644
>     # subsequent rules.  See slapd.access(5) for details.
817
645
>     access to *
818
646
>        by dn.base="cn=replicator,dc=symas,dc=com" read
819
647
>        by * break
871
699
>     # Let the replica DN have limitless searches
872
700
>     limits dn.exact="cn=replicator,dc=symas,dc=com" time.soft=unlimited time.hard=unlimited size.soft=unlimited size.hard=unlimited
873
701
 
874
 
For more information, always consult the relevant man pages (slapo-accesslog and slapd.conf)
875
 
 
876
 
 
877
 
H4: Delta-syncrepl Replica configuration
878
 
 
879
 
>     # Primary replica database configuration
 
702
For more information, always consult the relevant man pages ({{slapo-accesslog}}(5) and {{slapd.conf}}(5))
 
703
 
 
704
 
 
705
H4: Delta-syncrepl Consumer configuration
 
706
 
 
707
>     # Replica database configuration
880
708
>     database hdb
881
709
>     suffix "dc=symas,dc=com"
882
710
>     rootdn "cn=manager,dc=symas,dc=com"
906
734
 
907
735
 
908
736
The above configuration assumes that you have a replicator identity defined 
909
 
in your database that can be used to bind to the master with. In addition, 
910
 
all of the databases (primary master, primary replica, and the accesslog 
 
737
in your database that can be used to bind to the provider. In addition, 
 
738
all of the databases (primary, replica, and the accesslog 
911
739
storage database) should also have properly tuned {{DB_CONFIG}} files that meet 
912
740
your needs.
913
741
 
993
821
>     olcDbDirectory: ./db
994
822
>     olcRootDN: $MANAGERDN
995
823
>     olcRootPW: $PASSWD
 
824
>     olcLimits: dn.exact="$MANAGERDN" time.soft=unlimited time.hard=unlimited size.soft=unlimited size.hard=unlimited
996
825
>     olcSyncRepl: rid=004 provider=$URI1 binddn="$MANAGERDN" bindmethod=simple
997
826
>       credentials=$PASSWD searchbase="$BASEDN" type=refreshOnly
998
827
>       interval=00:00:00:10 retry="5 5 300 5" timeout=1
1010
839
>     objectClass: olcSyncProvConfig
1011
840
>     olcOverlay: syncprov
1012
841
 
1013
 
Note: You must have all your server set to the same time via {{http://www.ntp.org/}}
 
842
Note: You must have all your servers set to the same time via {{http://www.ntp.org/}}
1014
843
 
1015
844
H3: MirrorMode
1016
845
 
1020
849
>       mirrormode  on
1021
850
>       serverID    1
1022
851
 
1023
 
Note: You need to make sure that the {{serverID}} of each mirror node pair is 
 
852
Note: You need to make sure that the {{serverID}} of each mirror node is 
1024
853
different and add it as a global configuration option.
1025
854
 
1026
855
H4: Mirror Node Configuration
1027
856
 
1028
 
This is the same as the {{SECT:Set up the provider slapd}} section.
 
857
The first step is to configure the syncrepl provider the same as in the 
 
858
{{SECT:Set up the provider slapd}} section.
1029
859
 
1030
860
Note: Delta-syncrepl is not yet supported with MirrorMode.
1031
861
 
1038
868
>       serverID    1
1039
869
>       # database section
1040
870
>       
1041
 
>       # syncrepl directives    
 
871
>       # syncrepl directive    
1042
872
>       syncrepl      rid=001
1043
 
>                     provider=ldap://ldap-ridr1.example.com
 
873
>                     provider=ldap://ldap-sid2.example.com
1044
874
>                     bindmethod=simple
1045
875
>                     binddn="cn=mirrormode,dc=example,dc=com"
1046
876
>                     credentials=mirrormode
1049
879
>                     type=refreshAndPersist
1050
880
>                     retry="60 +"
1051
881
>
1052
 
>       syncrepl      rid=002
1053
 
>                     provider=ldap://ldap-rid2.example.com
1054
 
>                     bindmethod=simple
1055
 
>                     binddn="cn=mirrormode,dc=example,dc=com"
1056
 
>                     credentials=mirrormode
1057
 
>                     searchbase="dc=example,dc=com"
1058
 
>                     schemachecking=on
1059
 
>                     type=refreshAndPersist
1060
 
>                     retry="60 +"
1061
 
>       
1062
882
>       mirrormode on
1063
883
 
1064
884
MirrorMode node 2:
1067
887
>       serverID    2
1068
888
>       # database section
1069
889
>       
1070
 
>       # syncrepl directives
 
890
>       # syncrepl directive
1071
891
>       syncrepl      rid=001
1072
 
>                     provider=ldap://ldap-ridr1.example.com
1073
 
>                     bindmethod=simple
1074
 
>                     binddn="cn=mirrormode,dc=example,dc=com"
1075
 
>                     credentials=mirrormode
1076
 
>                     searchbase="dc=example,dc=com"
1077
 
>                     schemachecking=on
1078
 
>                     type=refreshAndPersist
1079
 
>                     retry="60 +"
1080
 
>
1081
 
>       syncrepl      rid=002
1082
 
>                     provider=ldap://ldap-rid2.example.com
 
892
>                     provider=ldap://ldap-sid1.example.com
1083
893
>                     bindmethod=simple
1084
894
>                     binddn="cn=mirrormode,dc=example,dc=com"
1085
895
>                     credentials=mirrormode
1091
901
>       mirrormode on
1092
902
 
1093
903
It's simple really; each MirrorMode node is setup {{B:exactly}} the same, except
1094
 
that the {{serverID}} is unique.
 
904
that the {{serverID}} is unique, and each consumer is pointed to 
 
905
the other server.
1095
906
 
1096
907
H5: Failover Configuration
1097
908
 
1111
922
 
1112
923
H4: MirrorMode Summary
1113
924
 
1114
 
Hopefully you will now have a directory architecture that provides all of the 
1115
 
consistency guarantees of single-master replication, whilst also providing the 
 
925
You will now have a directory architecture that provides all of the 
 
926
consistency guarantees of single-master replication, while also providing the 
1116
927
high availability of multi-master replication.
1117
928
 
1118
929
 
 
930
H3: Syncrepl Proxy
 
931
 
 
932
!import "push-based-complete.png"; align="center"; title="Syncrepl Proxy Mode"
 
933
FT[align="Center"] Figure X.Y: Replacing slurpd
 
934
 
 
935
The following example is for a self-contained push-based replication solution:
 
936
 
 
937
>       #######################################################################
 
938
>       # Standard OpenLDAP Master/Provider
 
939
>       #######################################################################
 
940
>       
 
941
>       include     /usr/local/etc/openldap/schema/core.schema
 
942
>       include     /usr/local/etc/openldap/schema/cosine.schema
 
943
>       include     /usr/local/etc/openldap/schema/nis.schema
 
944
>       include     /usr/local/etc/openldap/schema/inetorgperson.schema
 
945
>       
 
946
>       include     /usr/local/etc/openldap/slapd.acl
 
947
>       
 
948
>       modulepath  /usr/local/libexec/openldap
 
949
>       moduleload  back_hdb.la
 
950
>       moduleload  syncprov.la
 
951
>       moduleload  back_monitor.la
 
952
>       moduleload  back_ldap.la
 
953
>       
 
954
>       pidfile     /usr/local/var/slapd.pid
 
955
>       argsfile    /usr/local/var/slapd.args
 
956
>       
 
957
>       loglevel    sync stats
 
958
>       
 
959
>       database    hdb
 
960
>       suffix      "dc=suretecsystems,dc=com"
 
961
>       directory   /usr/local/var/openldap-data
 
962
>       
 
963
>       checkpoint      1024 5
 
964
>       cachesize       10000
 
965
>       idlcachesize    10000
 
966
>       
 
967
>       index       objectClass eq
 
968
>       # rest of indexes
 
969
>       index       default     sub
 
970
>       
 
971
>       rootdn          "cn=admin,dc=suretecsystems,dc=com"
 
972
>       rootpw          testing 
 
973
>       
 
974
>       # syncprov specific indexing
 
975
>       index entryCSN eq
 
976
>       index entryUUID eq
 
977
>       
 
978
>       # syncrepl Provider for primary db
 
979
>       overlay syncprov
 
980
>       syncprov-checkpoint 1000 60
 
981
>       
 
982
>       # Let the replica DN have limitless searches
 
983
>       limits dn.exact="cn=replicator,dc=suretecsystems,dc=com" time.soft=unlimited time.hard=unlimited size.soft=unlimited size.hard=unlimited
 
984
>       
 
985
>       database    monitor
 
986
>       
 
987
>       database    config
 
988
>       rootpw          testing
 
989
>       
 
990
>       ##############################################################################
 
991
>       # Consumer Proxy that pulls in data via Syncrepl and pushes out via slapd-ldap
 
992
>       ##############################################################################
 
993
>       
 
994
>       database        ldap
 
995
>       # ignore conflicts with other databases, as we need to push out to same suffix
 
996
>       hidden              on
 
997
>       suffix          "dc=suretecsystems,dc=com"
 
998
>       rootdn          "cn=slapd-ldap"
 
999
>       uri             ldap://localhost:9012/
 
1000
>       
 
1001
>       lastmod         on
 
1002
>               
 
1003
>       # We don't need any access to this DSA
 
1004
>       restrict        all
 
1005
>       
 
1006
>       acl-bind        bindmethod=simple
 
1007
>                       binddn="cn=replicator,dc=suretecsystems,dc=com"
 
1008
>                       credentials=testing
 
1009
>       
 
1010
>       syncrepl        rid=001
 
1011
>                       provider=ldap://localhost:9011/
 
1012
>                       binddn="cn=replicator,dc=suretecsystems,dc=com"
 
1013
>                       bindmethod=simple
 
1014
>                       credentials=testing
 
1015
>                       searchbase="dc=suretecsystems,dc=com"
 
1016
>                       type=refreshAndPersist
 
1017
>                       retry="5 5 300 5"
 
1018
>       
 
1019
>       overlay         syncprov
 
1020
 
 
1021
A replica configuration for this type of setup could be:
 
1022
 
 
1023
>       #######################################################################
 
1024
>       # Standard OpenLDAP Slave without Syncrepl
 
1025
>       #######################################################################
 
1026
>       
 
1027
>       include     /usr/local/etc/openldap/schema/core.schema
 
1028
>       include     /usr/local/etc/openldap/schema/cosine.schema
 
1029
>       include     /usr/local/etc/openldap/schema/nis.schema
 
1030
>       include     /usr/local/etc/openldap/schema/inetorgperson.schema
 
1031
>       
 
1032
>       include     /usr/local/etc/openldap/slapd.acl
 
1033
>       
 
1034
>       modulepath  /usr/local/libexec/openldap
 
1035
>       moduleload  back_hdb.la
 
1036
>       moduleload  syncprov.la
 
1037
>       moduleload  back_monitor.la
 
1038
>       moduleload  back_ldap.la
 
1039
>       
 
1040
>       pidfile     /usr/local/var/slapd.pid
 
1041
>       argsfile    /usr/local/var/slapd.args
 
1042
>       
 
1043
>       loglevel    sync stats
 
1044
>       
 
1045
>       database    hdb
 
1046
>       suffix      "dc=suretecsystems,dc=com"
 
1047
>       directory   /usr/local/var/openldap-slave/data
 
1048
>       
 
1049
>       checkpoint      1024 5
 
1050
>       cachesize       10000
 
1051
>       idlcachesize    10000
 
1052
>       
 
1053
>       index       objectClass eq
 
1054
>       # rest of indexes
 
1055
>       index       default     sub
 
1056
>       
 
1057
>       rootdn          "cn=admin,dc=suretecsystems,dc=com"
 
1058
>       rootpw          testing 
 
1059
>       
 
1060
>       # Let the replica DN have limitless searches
 
1061
>       limits dn.exact="cn=replicator,dc=suretecsystems,dc=com" time.soft=unlimited time.hard=unlimited size.soft=unlimited size.hard=unlimited
 
1062
>       
 
1063
>       updatedn "cn=replicator,dc=suretecsystems,dc=com"
 
1064
>       
 
1065
>       # Refer updates to the master
 
1066
>       updateref   ldap://localhost:9011
 
1067
>       
 
1068
>       database    monitor
 
1069
>       
 
1070
>       database    config
 
1071
>       rootpw          testing
 
1072
 
 
1073
You can see we use the {{updatedn}} directive here and example ACLs ({{F:usr/local/etc/openldap/slapd.acl}}) for this could be:
 
1074
        
 
1075
>       # Give the replica DN unlimited read access.  This ACL may need to be
 
1076
>       # merged with other ACL statements.
 
1077
>       
 
1078
>       access to *
 
1079
>            by dn.base="cn=replicator,dc=suretecsystems,dc=com" write
 
1080
>            by * break
 
1081
>       
 
1082
>       access to dn.base=""
 
1083
>               by * read
 
1084
>       
 
1085
>       access to dn.base="cn=Subschema"
 
1086
>               by * read
 
1087
>       
 
1088
>       access to dn.subtree="cn=Monitor"
 
1089
>           by dn.exact="uid=admin,dc=suretecsystems,dc=com" write
 
1090
>           by users read
 
1091
>           by * none
 
1092
>       
 
1093
>       access to *
 
1094
>               by self write
 
1095
>               by * read 
 
1096
 
 
1097
In order to support more replicas, just add more {{database ldap}} sections and
 
1098
increment the {{syncrepl rid}} number accordingly.
 
1099
 
 
1100
Note: You must populate the Master and Slave directories with the same data, 
 
1101
unlike when using normal Syncrepl
 
1102
 
 
1103
If you do not have access to modify the master directory configuration you can
 
1104
configure a standalone ldap proxy, which might look like:
 
1105
 
 
1106
!import "push-based-standalone.png"; align="center"; title="Syncrepl Standalone Proxy Mode"
 
1107
FT[align="Center"] Figure X.Y: Replacing slurpd with a standalone version
 
1108
 
 
1109
The following configuration is an example of a standalone LDAP Proxy:
 
1110
 
 
1111
>       include     /usr/local/etc/openldap/schema/core.schema
 
1112
>       include     /usr/local/etc/openldap/schema/cosine.schema
 
1113
>       include     /usr/local/etc/openldap/schema/nis.schema
 
1114
>       include     /usr/local/etc/openldap/schema/inetorgperson.schema
 
1115
>       
 
1116
>       include     /usr/local/etc/openldap/slapd.acl
 
1117
>       
 
1118
>       modulepath  /usr/local/libexec/openldap
 
1119
>       moduleload  syncprov.la
 
1120
>       moduleload  back_ldap.la
 
1121
>       
 
1122
>       ##############################################################################
 
1123
>       # Consumer Proxy that pulls in data via Syncrepl and pushes out via slapd-ldap
 
1124
>       ##############################################################################
 
1125
>       
 
1126
>       database        ldap
 
1127
>       # ignore conflicts with other databases, as we need to push out to same suffix
 
1128
>       hidden              on
 
1129
>       suffix          "dc=suretecsystems,dc=com"
 
1130
>       rootdn          "cn=slapd-ldap"
 
1131
>       uri             ldap://localhost:9012/
 
1132
>       
 
1133
>       lastmod         on
 
1134
>               
 
1135
>       # We don't need any access to this DSA
 
1136
>       restrict        all
 
1137
>       
 
1138
>       acl-bind        bindmethod=simple
 
1139
>                       binddn="cn=replicator,dc=suretecsystems,dc=com"
 
1140
>                       credentials=testing
 
1141
>       
 
1142
>       syncrepl        rid=001
 
1143
>                       provider=ldap://localhost:9011/
 
1144
>                       binddn="cn=replicator,dc=suretecsystems,dc=com"
 
1145
>                       bindmethod=simple
 
1146
>                       credentials=testing
 
1147
>                       searchbase="dc=suretecsystems,dc=com"
 
1148
>                       type=refreshAndPersist
 
1149
>                       retry="5 5 300 5"
 
1150
>       
 
1151
>       overlay         syncprov
 
1152
 
 
1153
As you can see, you can let your imagination go wild using Syncrepl and 
 
1154
{{slapd-ldap(8)}} tailoring your replication to fit your specific network 
 
1155
topology.