Installing AEM 6.0 with MongoDB

Installing AEM 6.0 with MongoDB

The major change that AEM6 has, is at its repository level.Till CQ 5.6 version TarPM was used as a persistence manager but with AEM 6 TarPM is not supported any more by CQ. AEM 6 now comes with the MicroKernels which act as persistence managers in AEM 6.
For now AEM 6 support TarMK and MongoMK Microkernal.

Below are the steps taken to install AEM 6 with MongoMK.
Basic Requirements:
Install the latest 1.7 JDK (Oracle)
Download mongodb in zip or in msi for windows from https://www.mongodb.org/downloads

[MongoDB]
1) Install MongoDB msi(NOTE: Version 2.6.1 or better is required) OR in case of zip, unzip it at C:\MongoDB\
2) Create two more folders \data and \log (at the same level as \bin)
3) Create a new configuration file named as mongod.cfg (at same level in which data and log folders are present) as following:
port = 27017
quiet = false
dbpath = C:\MongoDB\Server\3.0\data
logpath = C:\MongoDB\Server\3.0\log\mongod.log
logappend = true
journal = true
directoryperdb = true
rest=true
httpinterface=true
profile=2
4) Start MongoDB using the command:
mongod.exe –config C:\MongoDB\Server\3.0\mongod.cfg
5) Check C:\MongoDB\log\mongod.log for entries that look like the following:
2015-07-02T11:56:40.543+0530 I JOURNAL [durability] Durability thread started
2015-07-02T11:56:40.544+0530 I JOURNAL [journal writer] Journal writer thread started
2015-07-02T11:56:40.639+0530 I CONTROL [initandlisten] MongoDB starting : pid=7748 port=27017 dbpath=C:\MongoDB\Server\3.0\data 64-bit host=trantor230
2015-07-02T11:56:40.640+0530 I CONTROL [initandlisten] targetMinOS: Windows 7/Windows Server 2008 R2
2015-07-02T11:56:40.640+0530 I CONTROL [initandlisten] db version v3.0.4
2015-07-02T11:56:40.640+0530 I CONTROL [initandlisten] git version: 0481c958daeb2969800511e7475dc66986fa9ed5
2015-07-02T11:56:40.640+0530 I CONTROL [initandlisten] OpenSSL version: OpenSSL 1.0.1m-fips 19 Mar 2015
2015-07-02T11:56:40.640+0530 I CONTROL [initandlisten] build info: windows sys.getwindowsversion(major=6, minor=1, build=7601, platform=2, service_pack=’Service Pack 1′) BOOST_LIB_VERSION=1_49
2015-07-02T11:56:40.640+0530 I CONTROL [initandlisten] allocator: tcmalloc
2015-07-02T11:56:40.640+0530 I CONTROL [initandlisten] options: { config: “C:\MongoDB\Server\3.0\mongod.cfg”, net: { http: { RESTInterfaceEnabled: true, enabled: true }, port: 27017 }, operationProfiling: { mode: “all” }, storage: { dbPath: “C:\MongoDB\Server\3.0\data”, directoryPerDB: true, journal: { enabled: true } }, systemLog: { destination: “file”, logAppend: true, path: “C:\MongoDB\Server\3.0\log\mongod.log”, quiet: false } }
2015-07-02T11:56:40.642+0530 I NETWORK [websvr] admin web console waiting for connections on port 28017
2015-07-02T11:56:40.643+0530 I INDEX [initandlisten] allocating new ns file C:\MongoDB\Server\3.0\data\local\local.ns, filling with zeroes…
2015-07-02T11:56:40.940+0530 I STORAGE [FileAllocator] allocating new datafile C:\MongoDB\Server\3.0\data\local\local.0, filling with zeroes…
2015-07-02T11:56:40.940+0530 I STORAGE [FileAllocator] creating directory C:\MongoDB\Server\3.0\data\local\_tmp
2015-07-02T11:56:41.082+0530 I STORAGE [FileAllocator] done allocating datafile C:\MongoDB\Server\3.0\data\local\local.0, size: 64MB, took 0.141 secs
2015-07-02T11:56:41.189+0530 I NETWORK [initandlisten] waiting for connections on port 27017
[AEM 6.0]
1) Unpack AEM with the command:
java -jar aem6-author-p4502.jar -unpack
2) Go to /crx-quickstart/bin
3) Open the start.bat file and add the below two points:
Set the runmode as CQ_RUNMODE=author,crx3mongo

The oak.mongo.uri JVM argument:

-Doak.mongo.uri=mongodb://<serverName>:27017
Eg: CQ_JVM_OPTS=-server -Xmx1024m -XX:MaxPermSize=256M -Djava.awt.headless=true -Doak.mongo.uri=mongodb://localhost:27017
4) Start AEM using the start.bat file and watch both the MongoDB log and the AEM log
NOTE: For the first time startup of AEM 6.0 on MongoDB will be slow
5) In the MongoDB log, there should be some entries like these:
2015-07-02T12:11:36.541+0530 I WRITE [conn4] insert aem-author.system.indexes keyUpdates:0 writeConflicts:0 numYields:0 locks:{ Global: { acquireCount: { r: 1, w: 1 } }, MMAPV1Journal: { acquireCount: { w: 9 }, acquireWaitCount: { w: 1 }, timeAcquiringMicros: { w: 96 } }, Database: { acquireCount: { W: 1 } }, Collection: { acquireCount: { W: 1 } }, Metadata: { acquireCount: { W: 5 } } } 893ms
2015-07-02T12:11:36.591+0530 I STORAGE [FileAllocator] allocating new datafile C:\MongoDB\Server\3.0\data\aem-author\aem-author.1, filling with zeroes…
2015-07-02T12:11:37.460+0530 I STORAGE [FileAllocator] done allocating datafile C:\MongoDB\Server\3.0\data\aem-author\aem-author.1, size: 512MB, took 0.868 secs
6) Login to AEM 6.0 at http://localhost:4502 and it should open as usual but with mongodb.

Tags: