如何在OPENLDAP中配置镜像节点

时间:2019-10-30 05:00:55

标签: ldap openldap

我有两个OpenLDAP服务器:x.x.x.x:389和y.y.y.y:389。

我的第一台服务器的slapd.conf


include         /usr/local/etc/openldap/schema/core.schema

pidfile         /usr/local/var/run/slapd.pid
argsfile        /usr/local/var/run/slapd.args

modulepath      /usr/local/libexec/openldap
moduleload      back_mdb.la
moduleload      back_ldap.la
moduleload      syncprov.la

database        mdb
maxsize         1073741824
suffix          "dc=my-domain,dc=com"
rootdn          "cn=Manager,dc=my-domain,dc=com"
rootpw          ******

directory       /usr/local/var/openldap-data
# Indices to maintain
index   objectClass     eq

overlay syncprov

#Global section 
serverID 1


syncrepl rid=001
                 provider=ldap://y.y.y.y:389
                 binddn="cn=Manager,dc=my-domain,dc=com"
                 bindmethod=simple
                 credentials=****
                 searchbase="dc=my-domain,dc=com"
                 type=refreshAndPersist
                 interval=00:00:00:05
                 retry="5 5 300 5"
                 timeout=1

mirrormode on

sldap.conf用于第二台服务器:

include         /usr/local/etc/openldap/schema/core.schema

pidfile         /usr/local/var/run/slapd.pid
argsfile        /usr/local/var/run/slapd.args

modulepath      /usr/local/libexec/openldap
moduleload      back_mdb.la
moduleload      back_ldap.la
moduleload      syncprov.la

database        mdb
maxsize         1073741824
suffix          "dc=my-domain,dc=com"
rootdn          "cn=Manager,dc=my-domain,dc=com"
rootpw          ****

directory       /usr/local/var/openldap-data
# Indices to maintain
index   objectClass     eq

overlay syncprov

#Global section
serverID   2
#database section

syncrepl rid=001
                 provider=ldap://x.x.x.x:389
                 binddn="cn=Manager,dc=my-domain,dc=com"
                 bindmethod=simple
                 credentials=****
                 searchbase="dc=my-domain,dc=com"
                 type=refreshAndPersist
                 interval=00:00:00:05
                 retry="5 5 300 5"
                 timeout=1

mirrormode on

两台服务器都在运行,但是一台服务器尝试获取条目,但不复制任何数据。 我的配置有问题吗?

1 个答案:

答案 0 :(得分:0)

我做了几件事,现在可以了。我在这里共享我的conf文件。

slapd.conf用于第一台服务器

modulepath      /usr/local/libexec/openldap
moduleload      back_mdb.la
moduleload      back_ldap.la
moduleload      syncprov.la

database        mdb
maxsize         1073741824
suffix          "dc=my-domain,dc=com"
rootdn          "cn=Manager,dc=my-domain,dc=com"
rootpw          ******

directory       /usr/local/var/openldap-data
# Indices to maintain
index   objectClass     eq

overlay syncprov

#Global section 
serverid 1                       // I changed serverID 1 to serverid 1 


syncrepl rid=001
                 provider=ldap://y.y.y.y:389
                 binddn="cn=Manager,dc=my-domain,dc=com"
                 bindmethod=simple
                 credentials=****
                 searchbase="dc=my-domain,dc=com"
                 type=refreshAndPersist
                 interval=00:00:00:05
                 retry="5 5 300 5"
                 timeout=1

syncrepl rid=002                                          // added this
         provider=ldap://x.x.x.x:389
         binddn="cn=Manager,dc=my-domain,dc=com"
         bindmethod=simple
         credentials=secret
         searchbase="dc=my-domain,dc=com"
         schemachecking=on
         type=refreshAndPersist
         interval=00:00:00:05
         retry="60 +"


mirrormode TRUE                         // I changed on to TRUE

slapd.conf用于第二台服务器

include         /usr/local/etc/openldap/schema/core.schema

pidfile         /usr/local/var/run/slapd.pid
argsfile        /usr/local/var/run/slapd.args

modulepath      /usr/local/libexec/openldap
moduleload      back_mdb.la
moduleload      back_ldap.la
moduleload      syncprov.la

database        mdb
maxsize         1073741824
suffix          "dc=my-domain,dc=com"
rootdn          "cn=Manager,dc=my-domain,dc=com"
rootpw          ****

directory       /usr/local/var/openldap-data
# Indices to maintain
index   objectClass     eq

overlay syncprov

#Global section
serverid   2                                    //serverID --> serverid
#database section

syncrepl rid=001
                 provider=ldap://y.y.y.y:389
                 binddn="cn=Manager,dc=my-domain,dc=com"
                 bindmethod=simple
                 credentials=****
                 searchbase="dc=my-domain,dc=com"
                 type=refreshAndPersist
                 interval=00:00:00:05
                 retry="5 5 300 5"
                 timeout=1

syncrepl rid=002                               //added this
         provider=ldap://x.x.x.x:389
         binddn="cn=Manager,dc=my-domain,dc=com"
         bindmethod=simple
         credentials=secret
         searchbase="dc=my-domain,dc=com"
         schemachecking=on
         type=refreshAndPersist
         interval=00:00:00:05
         retry="60 +"


mirrormode TRUE                        //  on  -->  TRUE