Purpose:
Migrate to Custom Datastore from Default datastore .
Perquisites:
we need oak upgrade jar to migrate repository and data store
You’re going to need a lot of disk capacity during the migration as the process creates a new datastore directory with all the data as well as a new repository directory and segment store. You are doubling your disk needs temporarily as the end result is basically two copies of your repo.
Process:
Take backup of your instance, its mandatory.
Adobe has a tool called crx2oak which helped to migrate the blob store to a custom file datastore.
After multiple attempts trying various oak versions, my conclusion is it’s a hit or miss. This the reason for taking a backup.
For AEM 6.1 – SP2 , crx2oak-1.4.6 jar is successful in my case.
Place the oak jar file in the same location as your quickstart jar file.
Create a new repository in crx-quickstart folder, name it in your conventions (repository new)
Create a folder where you want a custom datastore (/opt or /home) where you have space or need to do it.
Run below command at jar location
java -jar crx2oak-1.4.6-standalone.jar –copy-binaries –src-datastore=crx-quickstart/repository/segmentstore –datastore=/opt/aem/datastore crx-quickstart/repository crx-quickstart/repository_new -mmap
You will see info logs on your console, once migration is completed log will stop. To confirm the migration check the upgrade.log.
Now rename your repository to repository.migrated and repository new to repository.
Create install directory in crx-quickstart.
In Install directory, create file org.apache.jackrabbit.oak.plugins.blob.datastore.FileDataStore.config With contents
path=”/opt/datastore” #custom datastore location
minRecordLength=”256″
Create another file in install,
org.apache.jackrabbit.oak.plugins.segment.SegmentNodeStoreService.config with contents
customBlobStore=B”true”
Files screenshot as follows
Start your instance.
Observations:
Depending on the size of your repo, the migration may take a considerable amount of time. In addition to the binary data being copied, some of the Oak indexes will most likely need to be re-indexed (automatically)
For a vanilla Instance, it takes less than 10 minutes again it depends upon disk capacity