📄 syncrepl.sdf
字号:
transactions are not committed in the issue order.The provider stores the {{EX:contextCSN}} of a context in the{{EX:contextCSN}} attribute of the context suffix entry. The attributeis not written to the database after every update operation though;instead it is maintained primarily in memory. At database starttime the provider reads the last saved {{EX:contextCSN}} into memoryand uses the in-memory copy exclusively thereafter. By default,changes to the {{EX:contextCSN}} as a result of database updateswill not be written to the database until the server is cleanlyshut down. A checkpoint facility exists to cause the contextCSN tobe written out more frequently if desired.Note that at startup time, if the provider is unable to read a{{EX:contextCSN}} from the suffix entry, it will scan the entiredatabase to determine the value, and this scan may take quite along time on a large database. When a {{EX:contextCSN}} value isread, the database will still be scanned for any {{EX:entryCSN}}values greater than it, to make sure the {{EX:contextCSN}} valuetruly reflects the greatest committed {{EX:entryCSN}} in the database.On databases which support inequality indexing, setting an eq indexon the {{EX:entryCSN}} attribute and configuring {{contextCSN}}checkpoints will greatly speed up this scanning step.If no {{EX:contextCSN}} can be determined by reading and scanningthe database, a new value will be generated. Also, if scanning thedatabase yielded a greater {{EX:entryCSN}} than was previouslyrecorded in the suffix entry's {{EX:contextCSN}} attribute, acheckpoint will be immediately written with the new value.The consumer also stores its replica state, which is the provider's{{EX:contextCSN}} received as a synchronization cookie, in the{{EX:contextCSN}} attribute of the suffix entry. The replica statemaintained by a consumer server is used as the synchronization stateindicator when it performs subsequent incremental synchronizationwith the provider server. It is also used as a provider-sidesynchronization state indicator when it functions as a secondaryprovider server in a cascading replication configuration. Sincethe consumer and provider state information are maintained in thesame location within their respective databases, any consumer canbe promoted to a provider (and vice versa) without any specialactions.Because a general search filter can be used in the syncreplspecification, some entries in the context may be omitted from thesynchronization content. The syncrepl engine creates a glue entryto fill in the holes in the replica context if any part of thereplica content is subordinate to the holes. The glue entries willnot be returned in the search result unless {{ManageDsaIT}} controlis provided.Also as a consequence of the search filter used in the syncreplspecification, it is possible for a modification to remove an entryfrom the replication scope even though the entry has not been deletedon the provider. Logically the entry must be deleted on the consumerbut in {{refreshOnly}} mode the provider cannot detect and propagatethis change without the use of the session log.H2: Configuring SyncreplBecause syncrepl is a consumer-side replication engine, the syncreplspecification is defined in {{slapd.conf}} (5) of the consumerserver, not in the provider server's configuration file. The initialloading of the replica content can be performed either by startingthe syncrepl engine with no synchronization cookie or by populatingthe consumer replica by adding an {{TERM:LDIF}} file dumped as abackup at the provider.When loading from a backup, it is not required to perform the initialloading from the up-to-date backup of the provider content. Thesyncrepl engine will automatically synchronize the initial consumerreplica to the current provider content. As a result, it is notrequired to stop the provider server in order to avoid the replicainconsistency caused by the updates to the provider content duringthe content backup and loading process.When replicating a large scale directory, especially in a bandwidthconstrained environment, it is advised to load the consumer replicafrom a backup instead of performing a full initial load usingsyncrepl.H3: Set up the provider slapdThe provider is implemented as an overlay, so the overlay itselfmust first be configured in {{slapd.conf}} (5) before it can beused. The provider has only two configuration directives, for settingcheckpoints on the {{EX:contextCSN}} and for configuring the sessionlog. Because the LDAP Sync search is subject to access control,proper access control privileges should be set up for the replicatedcontent.The {{EX:contextCSN}} checkpoint is configured by the> syncprov-checkpoint <ops> <minutes>directive. Checkpoints are only tested after successful writeoperations. If {{<ops>}} operations or more than {{<minutes>}}time has passed since the last checkpoint, a new checkpoint isperformed.The session log is configured by the> syncprov-sessionlog <size>directive, where {{<size>}} is the maximum number of session logentries the session log can record. When a session log is configured,it is automatically used for all LDAP Sync searches within thedatabase.Note that using the session log requires searching on the {{entryUUID}}attribute. Setting an eq index on this attribute will greatly benefitthe performance of the session log on the provider.A more complete example of the {{slapd.conf}} content is thus:> database bdb> suffix dc=Example,dc=com> rootdn dc=Example,dc=com> directory /var/ldap/db> index objectclass,entryCSN,entryUUID eq>> overlay syncprov> syncprov-checkpoint 100 10> syncprov-sessionlog 100H3: Set up the consumer slapdThe syncrepl replication is specified in the database section of{{slapd.conf}} (5) for the replica context. The syncrepl engineis backend independent and the directive can be defined with anydatabase type.> database hdb> suffix dc=Example,dc=com> rootdn dc=Example,dc=com> directory /var/ldap/db> index objectclass,entryCSN,entryUUID eq>> syncrepl rid=123> provider=ldap://provider.example.com:389> type=refreshOnly> interval=01:00:00:00> searchbase="dc=example,dc=com"> filter="(objectClass=organizationalPerson)"> scope=sub> attrs="cn,sn,ou,telephoneNumber,title,l"> schemachecking=off> bindmethod=simple> binddn="cn=syncuser,dc=example,dc=com"> credentials=secretIn this example, the consumer will connect to the provider slapdat port 389 of {{FILE:ldap://provider.example.com}} to perform apolling ({{refreshOnly}}) mode of synchronization once a day. Itwill bind as {{EX:cn=syncuser,dc=example,dc=com}} using simpleauthentication with password "secret". Note that the access controlprivilege of {{EX:cn=syncuser,dc=example,dc=com}} should be setappropriately in the provider to retrieve the desired replicationcontent. Also the search limits must be high enough on the providerto allow the syncuser to retrieve a complete copy of the requestedcontent. The consumer uses the rootdn to write to its database soit always has full permissions to write all content.The synchronization search in the above example will search for theentries whose objectClass is organizationalPerson in the entiresubtree rooted at {{EX:dc=example,dc=com}}. The requested attributesare {{EX:cn}}, {{EX:sn}}, {{EX:ou}}, {{EX:telephoneNumber}},{{EX:title}}, and {{EX:l}}. The schema checking is turned off, sothat the consumer {{slapd}} (8) will not enforce entry schemachecking when it process updates from the provider {{slapd}} (8).For more detailed information on the syncrepl directive, see the{{SECT:syncrepl}} section of {{SECT:The slapd Configuration File}}chapter of this admin guide.H3: Start the provider and the consumer slapdThe provider {{slapd}} (8) is not required to be restarted.{{contextCSN}} is automatically generated as needed: it might beoriginally contained in the {{TERM:LDIF}} file, generated by{{slapadd}} (8), generated upon changes in the context, or generatedwhen the first LDAP Sync search arrives at the provider. If anLDIF file is being loaded which did not previously contain the{{contextCSN}}, the {{-w}} option should be used with {{slapadd}}(8) to cause it to be generated. This will allow the server tostartup a little quicker the first time it runs.When starting a consumer {{slapd}} (8), it is possible to providea synchronization cookie as the {{-c cookie}} command line optionin order to start the synchronization from a specific state. Thecookie is a comma separated list of name=value pairs. Currentlysupported syncrepl cookie fields are {{csn=<csn>}} and {{rid=<rid>}}.{{<csn>}} represents the current synchronization state of theconsumer replica. {{<rid>}} identifies a consumer replica locallywithin the consumer server. It is used to relate the cookie to thesyncrepl definition in {{slapd.conf}} (5) which has the matchingreplica identifier. The {{<rid>}} must have no more than 3 decimaldigits. The command line cookie overrides the synchronizationcookie stored in the consumer replica database.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -