Mention how to restore OpenBSD ldapd backup.

This commit is contained in:
Zhang Huangbin 2016-05-01 23:40:19 +08:00
parent eb1b231d36
commit bec6c73e16
2 changed files with 68 additions and 4 deletions

View File

@ -68,7 +68,7 @@ You can simply restore plain SQL files backed up by above backup scripts.
> `mysql` database, otherwise almost all services won't work due to incorrect
> SQL credentials.
### How to restore LDAP backup
### How to restore OpenLDAP backup
Backup script runs command `slapcat` to dump whole LDAP tree as a backup, it
must be so restored with command `slapadd`.
@ -243,3 +243,34 @@ owner on newly created bdb files immediately, then restart OpenLDAP service:
# chown ldap:ldap /var/lib/ldap/iredmail.org/*.bdb
# /etc/init.d/ldap restart
```
### How to restore OpenBSD ldapd(8) backup
iRedMail-0.9.5 and later releases ships script
`/var/vmail/backup/backup_ldapd.sh` for daily backup. It backs up data with
command `ldapsearch` (not `slapcat` - which is used for OpenLDAP), so you have
to restore its data with command `ldapadd`.
* Stop ldapd service first.
```
rcctl stop ldapd
```
* Remove all files under ldapd data directory `/var/db/ldap/`.
* Start ldapd service.
```
rcctl start ldapd
```
* Import backup LDIF file:
* Please replace `cn=Manager,dc=xx,dc=xx` by the real LDAP root dn.
* Please replace `/path/to/backup.ldif` by the real path of backup LDIF file.
```
# ldapadd -x -D 'cn=Manager,dc=xx,dc=xx' -W -f /path/to/backup.ldif
```
That's all.

View File

@ -25,7 +25,8 @@
</li>
<li><a href="#restore">Restore</a><ul>
<li><a href="#how-to-restore-sql-databases">How to restore SQL databases</a></li>
<li><a href="#how-to-restore-ldap-backup">How to restore LDAP backup</a></li>
<li><a href="#how-to-restore-openldap-backup">How to restore OpenLDAP backup</a></li>
<li><a href="#how-to-restore-openbsd-ldapd8-backup">How to restore OpenBSD ldapd(8) backup</a></li>
</ul>
</li>
</ul>
@ -95,7 +96,7 @@ the same SQL accounts with different passwords, so please do not restore
<code>mysql</code> database, otherwise almost all services won't work due to incorrect
SQL credentials.</p>
</blockquote>
<h3 id="how-to-restore-ldap-backup">How to restore LDAP backup</h3>
<h3 id="how-to-restore-openldap-backup">How to restore OpenLDAP backup</h3>
<p>Backup script runs command <code>slapcat</code> to dump whole LDAP tree as a backup, it
must be so restored with command <code>slapadd</code>.</p>
<p>Below example shows how to restore a LDAP backup on RHEL/CentOS 6.x, files and
@ -269,7 +270,39 @@ Starting slapd: [ OK ]
owner on newly created bdb files immediately, then restart OpenLDAP service:</p>
<pre><code># chown ldap:ldap /var/lib/ldap/iredmail.org/*.bdb
# /etc/init.d/ldap restart
</code></pre><p style="text-align: center; color: grey;">All documents are available in <a href="https://bitbucket.org/zhb/iredmail-docs/src">BitBucket repository</a>, and published under <a href="http://creativecommons.org/licenses/by-nd/3.0/us/" target="_blank">Creative Commons</a> license. If you found something wrong, please do <a href="http://www.iredmail.org/contact.html">contact us</a> to fix it.<script>
</code></pre>
<h3 id="how-to-restore-openbsd-ldapd8-backup">How to restore OpenBSD ldapd(8) backup</h3>
<p>iRedMail-0.9.5 and later releases ships script
<code>/var/vmail/backup/backup_ldapd.sh</code> for daily backup. It backs up data with
command <code>ldapsearch</code> (not <code>slapcat</code> - which is used for OpenLDAP), so you have
to restore its data with command <code>ldapadd</code>.</p>
<ul>
<li>Stop ldapd service first.</li>
</ul>
<pre><code>rcctl stop ldapd
</code></pre>
<ul>
<li>Remove all files under ldapd data directory <code>/var/db/ldap/</code>.</li>
<li>Start ldapd service.</li>
</ul>
<pre><code>rcctl start ldapd
</code></pre>
<ul>
<li>
<p>Import backup LDIF file:</p>
<ul>
<li>Please replace <code>cn=Manager,dc=xx,dc=xx</code> by the real LDAP root dn.</li>
<li>Please replace <code>/path/to/backup.ldif</code> by the real path of backup LDIF file.</li>
</ul>
</li>
</ul>
<pre><code># ldapadd -x -D 'cn=Manager,dc=xx,dc=xx' -W -f /path/to/backup.ldif
</code></pre>
<p>That's all.</p><p style="text-align: center; color: grey;">All documents are available in <a href="https://bitbucket.org/zhb/iredmail-docs/src">BitBucket repository</a>, and published under <a href="http://creativecommons.org/licenses/by-nd/3.0/us/" target="_blank">Creative Commons</a> license. If you found something wrong, please do <a href="http://www.iredmail.org/contact.html">contact us</a> to fix it.<script>
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)