LDAP DB Migration on CentOS 7

LDAP 서버 이전(Migration) 가이드

사실 LDAP 서버를 이전할 상황이 생길 가능성이 매우 적긴 합니다. 저의 경우 CentOS 6 버전 EOL(End of Life) 로 인해 CentOS 6 버전에서 구동되던 LDAP 서버를 CentOS 7 버전으로 이전(Migration) 해야 하는 이슈가 있어 이번 작업을 진행해 보았습니다.

이전 작업은 간단하게 slapcat 커맨드를 이용하여 전체 데이터베이스를 백업하는 방법이 가장 보편적이고 확실한 방법이기 때문에 해당 방법을 사용해 보았습니다.

Source 서버 작업

LDAP 환경설정 및 데이타베이스 백업

[root@10-19-10-245 /]# slapcat -n 0 -l ldap-config.ldif
[root@10-19-10-245 /]# slapcat -n 2 -l ldap-databases.ldif

백업된 환경설정 및 데이터베이스 파일을 Target 서버의 /etc/openldap/ 디렉토리에 복사해 줍니다. 복사 방법은 scp, ftp, rsync 등 원하시는 형태로 하시면 됩니다.

Target 서버 작업

ldap 패키지 설치

[root@10-19-10-246 /]# yum install openldap-servers openldap-clients nss-pam-ldapd

환경설정 파일 복원 및 디렉토리 권한 설정

[root@10-19-10-246 /]# rm -Rf /etc/openldap/slapd.d/*
[root@10-19-10-246 /]# slapadd -n 0 -F /etc/openldap/slapd.d/ -l /etc/openldap/ldap-config.ldif
[root@10-19-10-246 /]# chmod -Rf u+rwX /etc/openldap/slapd.d
[root@10-19-10-246 /]# chown -Rf ldap. /etc/openldap/slapd.d

데이타베이스 복원 및 디렉토리 권한 설정

[root@10-19-10-246 /]# rm -Rf /var/lib/ldap/*
[root@10-19-10-246 /]# slapadd -n 2 -F /etc/openldap/slapd.d/ -l /etc/openldap/ldap-databases.ldif
[root@10-19-10-246 /]# chown -Rf ldap. /var/lib/ldap

systemd 등록 및 실행

[root@10-19-10-246 /]# systemctl enable slapd
[root@10-19-10-246 /]# systemctl start slapd

확인

[root@10-19-10-246 /]# ldapsearch -x -b dc=umount,dc=local

You may also like...

Subscribe
Notify of
guest

이 사이트는 스팸을 줄이는 아키스밋을 사용합니다. 댓글이 어떻게 처리되는지 알아보십시오.

0 Comments
Inline Feedbacks
View all comments
0
Would love your thoughts, please comment.x
()
x