1.6. - Backup/Restore
You may want to save your data in a safe place, and be able to restore them.
ApacheDS stores its data into a set of files, which are binary files. You can’t simply copy those files in a backup directory, because there is no guarantee that their state is consistant when you do a copy (unless you have stopped the server while doing so) : one update operation might be running when you do a copy, and unless this update has been completed, the database is nt in a stable state.
The current solution is to extract a LDIF from ApacheDS. You can do so either by using Apache Directory Studio, or through a script using the slapsearch utility, on the partition you are interested in. In any case, you must requests all the attributes, including the operational attributes (use the ‘+’ special attributes for that purpose). Here is a sample command line that extract the data from the ‘example’ partition, on a default ApacheDS install :
$ ldapsearch -D "uid=admin,ou=system" -w secret -p 10389 -h localhost -b "dc=example,dc=com" -s sub "(ObjectClass=*)" * + > backup.ldif
(note that you will have to change the password, port, server name and partition name to fits your setup)
Restoring the database is a matter of starting frm a blank partition, and reimport the LDIF.
Note : This is not really convenient. First, it requires that an external tool is present to run the extract. Second, reimporting a huge database will take a lot of time… We are working on a new system that guarantees that the file containing the data can be copied directly and restored as is.