ldap主从同步
一、安装ldap从服务器
安装步骤同ldap主服务器相同
导出原用户,格式为ldif,并将其传输到ldap从服务器
# ldapsearch -x -H ldap://127.0.0.1 -b 'dc=taobao,dc=com' > wdd.ldif
# yum -y install openssh-clients
# scp wdd.ldif 192.168.131.140:/root
# ldapadd -x -D "cn=admin,dc=taobao,dc=com" -W -f /root/wdd.ldif
# service slapd stop
# vim /etc/openldap/slapd.conf
replica host=192.168.131.140:389
binddn="cn=admin,dc=taobao,dc=com"
bindmethod=simple
credentials=123456 #密码
replogfile /var/lib/ldap/openldap-master-replog
# chown -R ldap:ldap /var/lib/ldap/
# vim /etc/openldap/slapd.conf
updatedn "cn=admin,dc=taobao,dc=com"
updateref ldap://192.168.131.138:389 #ldap主服务器地址
# /etc/init.d/slapd restart
# /etc/init.d/slapd start
#ldapsearch -LLL -x -H ldap://192.168.131.138 -b 'dc=taobao,dc=com'| grep uid=
#ldapsearch -LLL -x -H ldap://192.168.131.140 -b 'dc=taobao,dc=com'| grep uid=
#ldapdelete -x -D "cn=admin,dc=taobao,dc=com" -W "uid=ldapuser1,ou=People,dc=taobao,dc=com"
#ldapsearch -LLL -x -H ldap://192.168.131.138 -b 'dc=taobao,dc=com'| grep uid=
#ldapsearch -LLL -x -H ldap://192.168.131.140 -b 'dc=taobao,dc=com'| grep uid=