You must stop the ldap service in two primary and secondary LDAP Server.
1. run "db_checkpoint" to make sure all the data have been written inside the BDB database:
--> db_checkpoint-4.3 -1 -h /var/db/openldap-data/
Copy ldap database from primary server to second server :
----------------------------
scp IP:/var/lib/ldap/* /var/lib/ldap/ (doing on the secondary server)
or scp /var/lib/ldap/* root@IP:/var/lib/ldap/ (doing on the primary server)
chown -R ldap.ldap /var/lib/ldap
chmod 700 /var/lib/ldap
----------------------------
1. Setup a new LDAP Server that its settings are similiar with the primary LDAP Server.
2. Add the following lines to the configuration file(slapd.conf) in Primary LDAP Server:
------------------------------
Line1 : replogfile /var/lib/ldap/replica.log
Line2 : replica uri=ldap://Secondary LDAP Server's IP binddn="cn=Manager,dc=my,dc=domain,dc=name" bindmethod=simple credentials=password
------------------------------
3. Add the following lines to the configuratino file(slapd.conf) in Secondary LDAP Server:
------------------------------
Line1 : updatedn "cn=Manager,dc=my,dc=domain,dc=name"
Line2 : updaterefldap://Primary LDAP Server's IP
------------------------------
Subscribe to:
Post Comments (Atom)
Method 2- to backup primary database to secondary database:
ReplyDelete1. Export primary BDB database:
--> slapcat -b "dc=abc,dc=abc,dc=abc" -l /tmp/contents.ldif
2. Copy data to secondary ldap server:
--> scp /tmp/contents.ldif root@IP:/tmp/contents.ldif
3. Import data to secondary ldap database:
--> slapadd -l /tmp/contents.ldif
4. Change the owner for the database:
--> chown ldap.ldap /var/lib/ldap/*.*
5. Done