ldap主從同步


ldap主從同步

一、安裝ldap從服務器

安裝步驟同ldap主服務器相同

  1. 主從同步配置
  1. 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

  1. ldap從服務器

# ldapadd -x -D "cn=admin,dc=taobao,dc=com" -W -f /root/wdd.ldif

  1. 停止ldap主服務器,修改配置文件

# 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/

  1. 從服務器,修改其配置文件

# 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

  1. 啟動ldap主服務器

# /etc/init.d/slapd start

  1. 查看ldap用戶
  2. Ldap主服務器操作

#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=

  1. 刪除ldapuser1用戶

#ldapdelete -x -D "cn=admin,dc=taobao,dc=com" -W "uid=ldapuser1,ou=People,dc=taobao,dc=com"

  1. 再次進行查詢ldap主服務器

#ldapsearch -LLL -x -H ldap://192.168.131.138 -b 'dc=taobao,dc=com'| grep uid=

  1. 再次查詢ldap從服務器,發現ldapuser1用戶也沒有了

#ldapsearch -LLL -x -H ldap://192.168.131.140 -b 'dc=taobao,dc=com'| grep uid=


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM