Expand my Community achievements bar.

Enhance your AEM Assets & Boost Your Development: [AEM Gems | June 19, 2024] Improving the Developer Experience with New APIs and Events
SOLVED

Connecting AEM to mongodb replica set

Avatar

Level 3

Has anyone tried connecting AEM 6.0 to a MongoDB replica set? I'm not sure how to specify the replica set here:

-Doak.mongo.uri=mongodb://localhost:27017

That will only connect to one specific mongodb instance. It might be due to my lack of mongodb knowledge, but any extra documentation around this installation would be great.

Thanks.

1 Accepted Solution

Avatar

Correct answer by
Level 3

I think I found the information here:

Although it would still be nice if someone could give me an example here as well. Or if documentation was updated to explain how to connect to replica set.

View solution in original post

5 Replies

Avatar

Correct answer by
Level 3

I think I found the information here:

Although it would still be nice if someone could give me an example here as well. Or if documentation was updated to explain how to connect to replica set.

Avatar

Level 3

Thanks but that post doesn't explain how to connect to a replica set. Only to an individual mongo instance. But I got it running now using hte documentation given in my earlier post.

Avatar

Employee

It is mentioned on this page: http://jackrabbit.apache.org/oak/docs/osgi_config.html#Mongo_Configuration

It's essentially comma-delimited. E.g. -Doak.mongo.uri=mongodb://localhost:27017,localhost:27018
(You can certainly add more than two instances.)

The example on the above page also gives you some hints about configuring one instance as preferred for writes with the the other as preferred for reads: mongodb://db1.example.net,db2.example.com?readPreference=secondary&readPreferenceTags=dc:ny,rack:1&readPreferenceTags=dc:ny&readPreferenceTags=&w=1&wtimeoutMS=10000