본문 바로가기

리눅스

[LDAP] OpenLDAP 백업/복원

반응형

OpenLDAP 백업/복원

[백업]

ldap config 백업(ldap 설정 백업)

slapcat -n 0 -l ldap-config_$(date '+%Y%m%d').ldif

$ slapcat -n 0 -l ldap-config_$(date '+%Y%m%d').ldif

--output--
$ ll | grep ldap-config_20210615
-rw-r--r-- 1 root root 39596 Jun 15 21:19 ldap-config_20210615.ldif

ldap data 백업(ldap 계정 백업)

 

slapcat -n 2 -l ldap-data_$(date '+%Y%m%d').ldif

$ slapcat -n 2 -l ldap-data_$(date '+%Y%m%d').ldif

--output--
$ ll | grep ldap-data_20210615
-rw-r--r-- 1 root root  3847 Jun 15 21:19 ldap-data_20210615.ldif

[복원]

ldap config 복원(ldap 설정 복원)

$ slapadd -n 0 -F /etc/openldap/slapd.d -l ldap-config_20210615.ldif
slapadd: could not add entry dn="cn=config" (line=1):
_                       1.31% eta   none elapsed            none spd   7.1 M/s
Closing DB...

ldap data 복원(ldap 계정 복원)

$ systemctl stop slapd
$ slapadd -l ldap-data_20210615.ldif
60c89c2f The first database does not allow slapadd; using the first available one (2)
60c89c2f => hdb_tool_entry_put: id2entry_add failed: BDB0067 DB_KEYEXIST: Key/data pair already exists (-30994)
60c89c2f => hdb_tool_entry_put: txn_aborted! BDB0067 DB_KEYEXIST: Key/data pair already exists (-30994)
slapadd: could not add entry dn="dc=4wxyz,dc=com" (line=1): txn_aborted! BDB0067 DB_KEYEXIST: Key/data pair already exists (-30994)
_##                    10.11% eta   none elapsed            none spd   1.7 M/s
Closing DB...
$ systemctl start slapd

https://milestone-of-se.nesuke.com/l7protocol/ldap/slapcat-options/

728x90
반응형