OpenLDAP Syncrepl 同步模式配置详解 - 主从服务器配置指南
OpenLDAP Syncrepl 同步模式配置详解
本文将详细介绍 OpenLDAP Syncrepl 同步模式的配置方法,包括主服务器和从服务器的配置参数,以及各个参数的含义和作用。
1. 主服务器配置
# Enable syncrepl
syncrepl rid=001
provider=ldap://ldap-master.example.com
type=refreshAndPersist
interval=00:00:05:00
searchbase='dc=example,dc=com'
filter='(objectClass=*)'
scope=sub
schemachecking=off
bindmethod=simple
binddn='cn=admin,dc=example,dc=com'
credentials=secret
retry='60 +'
timeout=1
2. 从服务器配置
# Enable syncrepl
syncrepl rid=001
provider=ldap://ldap-master.example.com
type=refreshAndPersist
interval=00:00:05:00
searchbase='dc=example,dc=com'
filter='(objectClass=*)'
scope=sub
schemachecking=off
bindmethod=simple
binddn='cn=admin,dc=example,dc=com'
credentials=secret
retry='60 +'
timeout=1
updatedn='cn=admin,dc=example,dc=com'
updateref=ldap://ldap-master.example.com
主服务器和从服务器的配置基本相同,只有 updatedn 和 updateref 两个参数不同。主服务器不需要这两个参数,从服务器需要指定 updatedn 为管理员账号,并将 updateref 指向主服务器。
参数说明
syncrepl rid=001:指定同步 ID,可以自定义。provider=ldap://ldap-master.example.com:指定主服务器的 URL。type=refreshAndPersist:指定同步模式为增量同步。interval=00:00:05:00:指定同步间隔为 5 分钟。searchbase='dc=example,dc=com':指定同步的搜索基准 DN。filter='(objectClass=*)':指定同步的搜索过滤条件为所有对象。scope=sub:指定同步的搜索范围为子树。schemachecking=off:关闭模式检查。bindmethod=simple:指定简单绑定方式。binddn='cn=admin,dc=example,dc=com':指定管理员账号的 DN。credentials=secret:指定管理员账号的密码。retry='60 +':指定同步失败后重试的时间间隔。timeout=1:指定连接超时时间。updatedn='cn=admin,dc=example,dc=com':只有从服务器需要指定此参数,指定管理员账号的 DN。updateref=ldap://ldap-master.example.com:只有从服务器需要指定此参数,指定主服务器的 URL。
通过以上配置,你可以成功搭建 OpenLDAP Syncrepl 同步环境,确保多个服务器之间的数据一致性。
原文地址: https://www.cveoy.top/t/topic/lVrO 著作权归作者所有。请勿转载和采集!