Skip Main Navigation

Adobe Experience Manager 6 with a MongoDB Setup

With AEM 6 the persistence layer which is used to store content, configurations, and program code, is called a MicroKernel (MK).  AEM 6 introduced a new MicroKernel and here's what you should know. 

AEM 6 introduced a new MicroKernel (MongoMK) which allows the use of MongoDB as a repository. Further MicroKernels may be added along the line but are not fully confirmed yet. In this article we will be looking at a very basic local MongoDB setup.


A simple and local MongoDB with AEM


  • Linux or Mac
  • Java 7 (preferably JDK and possibly from Oracle so you can make full use of JMX)
  • An AEM 6 license
  • An AEM 6 crx-quickstart jar
  • The mongodb binaries (linked below)

Follow the steps below to get an AEM author (or publish) up and running using a local MongoDB

1. Prepare a folder structure (sample) as below

  1. ./aem_600_mongodb

2. Download MongoDB for Mac OSX or other OS (configs in this guide also work with Linux)

3. extract the packages content directly into the mongodb directory as created under point 1. -> ( ./aem_600_mongodb/mongodb/bin should then exist )

4. in your mongodb directory, parallel to the data & logs & bin directory create the mongod.cfg file


bind_ip =
port = 27017
quiet = false
dbpath = ../data
logpath = ../logs/mongod.log
logappend = true
journal = true
directoryperdb = true
rest = true
httpinterface = true

5. now place your & AEM 6 quickstart jar in your base directory (in this case ./aem_600_mongodb)

6. extract the AEM 6 jar file (java -jar aem- -unpack)

7. edit the start script under ./aem_600_mongodb/crx-quickstart/bin and add the following properties

CQ_RUNMODE='author,crx3mongo' -> crx3mongo is added here
CQ_JVM_OPTS='-server -Xmx1024m -XX:MaxPermSize=256M -Djava.awt.headless=true -Doak.mongo.uri=mongodb://localhost:27017' -> -Doak.mongo.uri=mongodb://localhost:27017 is added here

8. once the above steps are completed go to your bin directory in your mongodb directory and start mongo db & tail the log

./mongod --config ../mongod.cfg && tail -f ../logs/mongod.log

9. now start your AEM from the ../crx-quickstart/bin directory and tail the log 

./start && tail -f ../error.log

10. once your AEM is started and everything has been created you got an AEM running on MongoDB

11. for administration purposes have a look at using the robomongo app:

The Adobe documentation and MongoDB documentation is your best bet for further details.

Setup a replica set

A. Change mongod.cfg

bind_ip = mongotest
port = 27017
quiet = false
dbpath = ../data
logpath = ../logs/mongod.log
logappend = true
journal = true
directoryperdb = true
rest = true
httpinterface = true

B. Modify /etc/hosts mongotest

C. Start Mongo with Option --replSet

./mongod --replSet "rs0" --config ../mongod.cfg

D. Open Mongo Console

        "_id" : "rs0",
        "version" : 1,
        "members" : [
                "_id" : 1,
                "host" : "mongotest:27017"
        "set" : "rs0",
        "date" : ISODate("2014-07-21T16:45:15Z"),
        "myState" : 1,
        "members" : [
                "_id" : 0,
                "name" : "mongotest:27017",
                "health" : 1,
                "state" : 1,
                "stateStr" : "PRIMARY",
                "uptime" : 5559,
                "optime" : Timestamp(1405961115, 1),
                "optimeDate" : ISODate("2014-07-21T16:45:15Z"),
                "electionTime" : Timestamp(1405955596, 2),
                "electionDate" : ISODate("2014-07-21T15:13:16Z"),
                "self" : true
                "_id" : 3,
                "name" : "mongotest2:27017",
                "health" : 1,
                "state" : 2,
                "stateStr" : "SECONDARY",
                "uptime" : 3445,
                "optime" : Timestamp(1405961115, 1),
                "optimeDate" : ISODate("2014-07-21T16:45:15Z"),
                "lastHeartbeat" : ISODate("2014-07-21T16:45:15Z"),
                "lastHeartbeatRecv" : ISODate("2014-07-21T16:45:15Z"),
                "pingMs" : 4,
                "syncingTo" : "mongotest:27017"
        "ok" : 1


Failover logic with a MongoDB replica set


  • The logic for the actual failover needs to be defined in a separate layer, in this case in the Load Balancer.
  • This makes the setup a bit more complex but also offers you a bit more flexibility as you can do some fancy setups.
  • To make it work overall you are required to have a virtual IP located in front of the AEM and a separate virtual IP in front of the Mongo Replica Set.
  • In general the logic won't differ too much from a CRX2 cluster setup except that you introduce a second Loadbalancer, as seen above.
  • This one sits between the AEM and MongoDB to handle connections in case a Primary node drops out of the pool.
  • In any case you are required to also have an Arbiter node or a 3rd MongoDB also acting as a secondary. This is required due to the nature of the MongoDB Primary node election process.

Stephan Becker

Head of Operations and Support

More Content Management

  • How to build websites fearlessly with AEM editable templates

    Stefan Franck

    Senior Director

    One Netcentric’s co-founders, Stefan is an expert in shaping solutions for clients - from requirements analysis to project specification and more. Stefan sees himself as the link between business and technology and, for over ten years now, he has filled various roles as architect, project lead and lead consultant. Stefan's focus is on the Adobe Marketing Cloud and AEM, to which he is strongly connected from his days at Day Software and Adobe. He says that co-founding Netcentric was one of the best choices in his professional life. Never before been able to work with so many brilliant people.