How To
ForgeRock Identity Platform
Does not apply to Identity Cloud

How do I relocate the backend database files in DS (All versions) on to a separate file system?

Last updated Jun 15, 2021

The purpose of this article is to provide information on relocating the backend database files in DS to a different location, such as a separate file system.


Overview

When you change the current location of the backend database files in DS, the database files are created in the new location going forward. The database files in the existing location are not automatically moved to the new location and will remain in the existing location until you remove or archive them off. The following process is used to manually relocate the database files:

Note

You must restart DS after running the dsconfig command and then import the data as described in the steps below or the database files will not be created in the new location. 

Relocating the backend database files (DS 7 and later)

This process uses the following example details:

  • old location - /path/to/ds/db
  • new location - /opt/ds/db
  • backend being relocated - appData

You can relocate the backend database files to a new location as follows: 

  1. Export the ldif file for the old location, for example:
    • DS 7.1 and later: $ ./export-ldif --hostname ds1.example.com --port 4444 --bindDN uid=admin --bindPassword password --backendID appData --ldifFile /path/to/generated.ldif --start 0 --usePkcs12TrustStore /path/to/ds/config/keystore --trustStorePassword:file /path/to/ds/config/keystore.pin
    • DS 7:  $ ./export-ldif --hostname ds1.example.com --port 4444 --bindDN uid=admin --bindPassword password --backendID appData --ldifFile /path/to/generated.ldif --start 0 --usePkcs12TrustStore /path/to/ds/config/keystore --trustStorePasswordFile /path/to/ds/config/keystore.pin
  2. Relocate the required backend from the old location to the new location, for example: 
    • DS 7.1 and later: $ ./dsconfig set-backend-prop --backend-name appData --set db-directory:/opt/ds/db --hostname ds1.example.com --port 4444 --bindDN uid=admin --bindPassword password --usePkcs12TrustStore /path/to/ds/config/keystore --trustStorePassword:file /path/to/ds/config/keystore.pin --no-prompt
    • DS 7: $ ./dsconfig set-backend-prop --backend-name appData --set db-directory:/opt/ds/db --hostname ds1.example.com --port 4444 --bindDN uid=admin --bindPassword password --usePkcs12TrustStore /path/to/ds/config/keystore --trustStorePasswordFile /path/to/ds/config/keystore.pin --no-prompt
  3. Restart DS.
  4. Import the ldif file you created in step 1 to restore the old database files to the new location, for example: 
    • DS 7.1 and later: $ ./import-ldif --hostname ds1.example.com --port 4444 --bindDN uid=admin --bindPassword password --backendID appData --ldifFile /path/to/generated.ldif --usePkcs12TrustStore /path/to/ds/config/keystore --trustStorePassword:file /path/to/ds/config/keystore.pin
    • DS 7: $ ./import-ldif --hostname ds1.example.com --port 4444 --bindDN uid=admin --bindPassword password --backendID appData --ldifFile /path/to/generated.ldif --usePkcs12TrustStore /path/to/ds/config/keystore --trustStorePasswordFile /path/to/ds/config/keystore.pinAll the backend database files for appData are now located in /opt/ds/db and this is the location that will be used going forward.

Relocating the backend database files (Pre-DS 7)

This process uses the following example details:

  • old location - /path/to/ds/db
  • new location - /opt/ds/db
  • backend being relocated - userRoot

You can relocate the backend database files to a new location as follows: 

  1. Export the ldif file for the old location, for example:  $ ./export-ldif --hostname localhost --port 4444 --bindDN "cn=Directory Manager" --bindPassword password --backendID userRoot --ldifFile /path/to/generated.ldif --start 0 --trustAll
  2. Relocate the required backend from the old location to the new location, for example:  $ ./dsconfig set-backend-prop --backend-name userRoot --set db-directory:/opt/ds/db --hostname localhost --port 4444 --trustAll --bindDN "cn=Directory Manager" --bindPassword password --no-prompt
  3. Restart DS.
  4. Import the ldif file you created in step 1 to restore the old database files to the new location, for example: $ ./import-ldif --hostname localhost --port 4444 --bindDN "cn=Directory Manager" --bindPassword password --backendID userRoot --ldifFile /path/to/generated.ldifAll the backend database files for userRoot are now located in /opt/ds/db and this is the location that will be used going forward.
Note

You can optionally use the DS backup and restore commands to relocate the backend database files instead, where the backup command replaces export-ldif in step 1 and the restore command replaces import-ldif in step 4.

See Also

How do I install DS (All versions) so that the instance files are separate to the install files?

Installing and Administering DS

Import and Export

Related Training

N/A

Related Issue Tracker IDs

N/A


Copyright and Trademarks Copyright © 2021 ForgeRock, all rights reserved.