ldap主从复制

主从复制原理

安装

1、配置主服务器,添加syncprov模块

[root@dlp ~]# vi mod_syncprov.ldif
# create new
 dn: cn=module,cn=config
objectClass: olcModuleList
cn: module
olcModulePath: /usr/lib64/openldap
olcModuleLoad: syncprov.la

[root@dlp ~]# ldapadd -Y EXTERNAL -H ldapi:/// -f mod_syncprov.ldif 
SASL/EXTERNAL authentication started
SASL username: gidNumber=0+uidNumber=0,cn=peercred,cn=external,cn=auth
SASL SSF: 0
adding new entry "cn=module,cn=config"

[root@dlp ~]# vi syncprov.ldif
# create new
 dn: olcOverlay=syncprov,olcDatabase={2}hdb,cn=config
objectClass: olcOverlayConfig
objectClass: olcSyncProvConfig
olcOverlay: syncprov
olcSpSessionLog: 100

[root@dlp ~]# ldapadd -Y EXTERNAL -H ldapi:/// -f syncprov.ldif 
SASL/EXTERNAL authentication started
SASL username: gidNumber=0+uidNumber=0,cn=peercred,cn=external,cn=auth
SASL SSF: 0
adding new entry "olcOverlay=syncprov,olcDatabase={2}hdb,cn=config"

2、配置从服务器

[root@slave ~]# vi syncrepl.ldif
# create new
 dn: olcDatabase={2}hdb,cn=config
changetype: modify
add: olcSyncRepl
olcSyncRepl: rid=001
  # LDAP server's URI
  provider=ldap://10.0.0.30:389/
  bindmethod=simple
  # own domain name
  binddn="cn=Manager,dc=srv,dc=world"
  # directory manager's password
  credentials=password
  searchbase="dc=srv,dc=world"
  # includes subtree
  scope=sub
  schemachecking=on
  type=refreshAndPersist
  # [retry interval] [retry times] [interval of re-retry] [re-retry times]
  retry="30 5 300 3"
  # replication interval
  interval=00:00:05:00

[root@slave ~]# ldapadd -Y EXTERNAL -H ldapi:/// -f syncrepl.ldif 
SASL/EXTERNAL authentication started
SASL username: gidNumber=0+uidNumber=0,cn=peercred,cn=external,cn=auth
SASL SSF: 0
modifying entry "olcDatabase={2}hdb,cn=config"

# confirm settings to search datas
[root@slave ~]# ldapsearch -x -b 'ou=People,dc=srv,dc=world' 
# People, srv.world
dn: ou=People,dc=srv,dc=world
objectClass: organizationalUnit
ou: People
...
...

3、客户端绑定主从服务器

[root@www ~]# authconfig --ldapserver=dlp.srv.world,slave.srv.world --update 

你可能感兴趣的:(ldap)