 |
» |
|
|
 |
|  |  |
Performing a Hot Backup and Reloading the Berkeley DB |  |
Hot backups offer a convenient way to back up data when the
CDS server is running. Performing a hot backup does not require downtime
and it does not impact the CDS server. Use the slapcat command, which is provided with the CDS distributions, to perform
a hot backup. The following steps explain how to perform a hot backup
and, when the Berkeley DB is damaged, reload data.  |  |  |  |  | CAUTION: If data is being altered or updated when you perform a hot backup,
a mismatch can occur between the backup file and CDS server's final
data. There is a risk of inconsistent data when performing a hot backup. |  |  |  |  |
To view the data in the Berkeley Database, enter the
following command: # /opt/symas/bin/slapcat To perform a hot backup of the Berkeley Database to
an LDIF file, while the CDS server is running enter the following
command: # /opt/symas/bin/slapcat –l backup.ldif To view the file, enter the following command: # vi backup.ldif When the CDS server has a problem or the data file
is damaged, the data can be reloaded from the LDIF file. To mimic
a damaged data file for this example, manually delete the data using
the following command: # /opt/symas/bin/ldapdelete -x -D 'cn=Manager,dc=example,dc=com'
\ -w secret -r dc=example,dc=com Verify the data has been deleted using the slapcat command. The query result should be empty. # /opt/symas/bin/slapcat Before you reload the data from the LDIF file, shut
down the CDS server by entering the following command: # /etc/init.d/cdsserver
stop Reload data from the LDIF file using the slapadd utility by entering the following command: # /opt/symas/bin/slapadd
-l backup.ldif Restart the CDS server and check the restored data
by entering the following commands: # /etc/init.d/cdsserver start # /opt/symas/bin/slapcat
Recovering the Berkeley DB |  |
The db_archive and db_recover utilities are used for normal recovery or disaster recovery for
the Berkeley DB data, which is the back-end database of CDS server.
The following example procedure shows how to use the db_archive and db_recover utilities to backup and recover
data. Stop the CDS server and force a checkpoint of the
log or archive using the db_checkpoint utility
by entering the following commands: # /etc/init.d/cdsserver stop # /opt/symas/bin/db_checkpoint
-1 -h /var/symas/openldap-data/example/ Archive the data files by entering the following command:
# /opt/symas/bin/db_archive
-s -h /var/symas/openldap-data/example/ To back up the Berkeley DB data files, copy these
files to another directory or server, for example /databackup, using the following commands: # mkdir /databackup # cp /var/symas/openldap-data/example/*db.00*
/databackup # cp /var/symas/openldap-data/example/*.bdb
/databackup Archive and copy the log files by entering the following
commands: # mkdir /logbackup # /opt/symas/bin/db_archive
-l -h /var/symas/openldap-data/example/ # cp /var/symas/openldap-logs/example/log.0000000001
/logbackup For the test in this example, delete all CDS data
manually and verify the results by entering the following commands:
# /etc/init.d/cdsserver
start # /opt/symas/bin/ldapdelete
-x -D 'cn=Manager,dc=example,dc=com' \ -w secret -r dc=example,dc=com # /opt/symas/bin/slapcat To recover the data from the backup using the db_recover utility, restore data files from the backup
media by entering the following commands: # /etc/init.d/cdsserver stop # cp /databackup/*db.00*
/var/symas/openldap-data/example/ # cp /databackup/*.bdb
/var/symas/openldap-data/example/ Restore the transaction log files from the backup
media by entering the following command: # cp /logbackup/log.0000000001 /var/symas/openldap-logs/example/ To place the data files and log files in a consistent
state, run the following command: # /opt/symas/bin/db_recover –c –h /var/symas/openldap-data/example/ Start the CDS server and verify the recover results
by entering the following commands: # /etc/init.d/cdsserver start # /opt/symas/bin/slapcat
Obtaining Statistics for the Berkeley DB |  |
Use the db_stat utility, contained in the
CDS distribution, to obtain statistics and state information for the
Berkeley DB environment. The db_stat utility is
located in the /opt/symas/bin directory. To get the Berkeley database version information,
enter the following command: # /opt/symas/bin/db_stat -V Display the lock region parameter and information
for the Berkeley database by entering the following command: # /opt/symas/bin/db_stat
-C A -h /var/symas/openldap-data/example To display detailed statistical information for a
specified file, use the db_stat utility with the –d option as follows: # /opt/symas/bin/db_stat -d dn2id.bdb
-h \ /var/symas/openldap-data/example To monitor the current transaction's information,
use the db_stat utility with the –t option as follows: # /opt/symas/bin/db_stat -t -h /var/symas/openldap-data/example To check additional Berkeley DB information, such
as environment version, log region, lock region, and transaction region,
enter the following command: # /opt/symas/bin/db_stat -e -h /var/symas/openldap-data/example
|