MongoDB and Solr | Community
Skip to main content
New Participant
September 5, 2016
Solved

MongoDB and Solr

  • September 5, 2016
  • 7 replies
  • 2742 views

I'm currently trying to set up MongoDB and Solr to store UGC for a forum. I've been able to get Mongo running fine - the author and publisher instances write new documents to the database when new UGC is created and share it. For some reason though, both instances have trouble reading from the database unless I play around with Solr.

For example: I create a new post in the forum. This post is written as a new document in the database (which I can see by querying it). I refresh the page to see the post and it disappears. I can then restart Solr and it appears.

Has this happened to anyone else and could it be that I've not configured Solr or Mongo correctly?

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.
Best answer by JK_Kendall

Hi Alistair,

The documentation does not intend to replace Solr documentation.  It is assumed you're relying most on Solr documentation when setting up SolrCloud mode, as you seem to be doing.

The upload of a single xml file appears incorrect to me.

Please read this section :

    SolrCloud Mode - Standard MLS

which references this section :

    SolrCloud Setup Commands

The best I can tell from your description

  • you did not copy both config files, solrconfig.xml and schema.xml to example\aemconfig
  • incomplete upconfig : missing -solrhome c:\solr-5.4.0 (or whatever)
  • incorrect create : -c collection1 -d example\aemconfig -n solrconfig -p 9983

And it is the case that Solr 6 is not yet supported.

- JK

7 replies

JK_Kendall
New Participant
September 7, 2016

You're very welcome!

- JK

New Participant
September 7, 2016

I've gone through these instructions again as well as using Solr 5.4.0, which seems to have done the trick. I think I was previously mistaken in one or two of the steps from that link.

Thanks for your help with this.

Alistair

September 6, 2016

In addition to creating the Collection, did you also create a Core in Solr?

Starting up in the SolrCloud mode is a little less pre-configured than when starting in other modes, especially in the newest versions of Solr - as such, it's easy to miss creating a core when following the instructions. (When creating the core, it has to be explicitly associated with the collection.) You can probably do these via the Solr web interface, but I know it can be done via command line.
And did you create a collection and core on each instance of Solr? (Assuming you have multiple instance of Solr running, since you're doing so in SolrCloud mode.)

Also, are you running external Zookeeper to manage the configuration, or not? If not, be sure configs are installed on each Solr instance. If so, be sure these have been uploaded to Zookeeper.
 

Refer to documentation from Solr and Zookeper, some of which JK links to to above, for info on how to do these things in Solr/Zookeper.

 

- Carey

JK_Kendall
JK_KendallAccepted solution
New Participant
September 6, 2016

Hi Alistair,

The documentation does not intend to replace Solr documentation.  It is assumed you're relying most on Solr documentation when setting up SolrCloud mode, as you seem to be doing.

The upload of a single xml file appears incorrect to me.

Please read this section :

    SolrCloud Mode - Standard MLS

which references this section :

    SolrCloud Setup Commands

The best I can tell from your description

  • you did not copy both config files, solrconfig.xml and schema.xml to example\aemconfig
  • incomplete upconfig : missing -solrhome c:\solr-5.4.0 (or whatever)
  • incorrect create : -c collection1 -d example\aemconfig -n solrconfig -p 9983

And it is the case that Solr 6 is not yet supported.

- JK

New Participant
September 6, 2016

I have tried again with Solr 5.4.0 and it's still not working correctly. I've noticed that the 'collection1' schema has been created but it doesn't contain all of the fields listed in the xml (see attached).

I may not be setting up my Solr correctly - could you please advise. 

I'm installing the config with this command: > server\scripts\cloud-scripts\zkcli.bat -cmd upconfig -zkhost 127.0.0.1:9983 -confname solrconfig -confdir example\aemconfig (I've put the solrconfig.xml file that I downloading from AEM in example\aemconfig).

I'm creating the collection with this command: > bin\solr.cmd create -c collection1 example\aemconfig\schema.xml

Then linking the two with this command: > server\scripts\cloud-scripts\zkcli.bat -cmd linkconfig -zkhost 127.0.0.1:9983 -collection collection1 -confname solrconfig

New Participant
September 6, 2016

Yes, I've installed the config and created the collection.

I'm using AEM 6.1, MongoDB 3.2.9 and Solr 6.4 with SolrCloud mode (I've just noticed in another thread that you've said 5.4 is the recommended version - I'm going to give this a try next).

The component has some customisation but very little - a small text addition beneath the 'Post' and 'Cancel' buttons.

I'm not using a dispatcher as I'm just working in a dev environment.

JK_Kendall
New Participant
September 5, 2016

Did you install the config files for your version of AEM Communities?

MSRP - Solr Configuration

What version of AEM Communities?

What version of MongoDB?

What version of Solr?  Standalone mode or SolrCloud mode?

Are you using a customized component?

Can you reproduce this on the Community Components Guide?

Do you have a dispatcher?

- JK