ddev / ddev-solr

Solr service for DDEV
Apache License 2.0
5 stars 5 forks source link

Multisite search - Collection connection keeps fluctuating #42

Closed wilfi closed 3 months ago

wilfi commented 3 months ago

I’m performing a multisite search per this guide here - https://www.drupal.org/docs/8/modules/search-api-solr/search-api-solr-howtos/set-up-and-configure-a-multisite-search

With ddev-solr add-on, I connected Site A SOLR endpoint to Site B. Server status shows as - 'The Solr server could be reached.'

When I point the specific collection of Site A SOLR to Site B, it initially showed as ' The collection could be accessed' , but when I keep refreshing the page it shows as 'The Solr collection could not be accessed. Further data is therefore unavailable.'

This is not consistent as well. It keeps fluctuating.

And I'm facing the same problem when I do any search with the cloned multisite index from Site A on Site B. At times the result shows 0 , at times it errors out, at times it gives the right resultset.

Is this expected behaviour? Or am I doing something wrong.

Thankyou.

wilfi commented 3 months ago

![Uploading Screenshot 2024-06-27 at 3.10.08 AM.png…]()

wilfi commented 3 months ago
Screenshot 2024-06-27 at 3 15 10 AM
rfay commented 3 months ago

If you show the configuration for the first site and the second site, and make it clear which one has the solr service, maybe we'll have something to say.

wilfi commented 3 months ago

Sure. Let me detail it out here.

Screenshot 2024-06-27 at 2 41 54 PM

Current behaviour

Attaching the Site A & B's Search server configs and Site A's multisite index yaml (which is imported to Site B)

multisearch_index.yml.txt site_a_search_server.yml.txt site_b_search_server.yml.txt

TIA!

wilfi commented 3 months ago

https://github.com/ddev/ddev-solr/assets/6604995/8995ab9b-765c-4f31-995f-23fec8ff9410

Here is the video clip of what I'm experiencing. This is from Site B.

mkalkbrenner commented 3 months ago

The host in site_b_search_server.txt is wrong. solr would access the ddev-solr service of site B, which doesn't exist. The host name has to be something like site-b.ddev.site.

mkalkbrenner commented 3 months ago

@rfay Even if the config isn't correct, I don't understand how site B, which is a different ddev project, could sometimes reach the solr service of site A. With that configuration (the wrong host name) it should never reach it. Is there a general issue with the router?

rfay commented 3 months ago

@mkalkbrenner Projects can connect to each others' services using their fully-qualified container names, like ddev-projecta-solr or ddev-projectb-db, etc.

@wilfi unfortunately I can't read your configurations, and github says the images are not available to zoom in on. If you could please just show the configuration pages of each as a screenshot.

wilfi commented 3 months ago

The host in site_b_search_server.txt is wrong. solr would access the ddev-solr service of site B, which doesn't exist. The host name has to be something like site-b.ddev.site.

This is what I tried initially, but wasn't working until I switched to solr , tried once more now but no luck.

wilfi commented 3 months ago

@mkalkbrenner Projects can connect to each others' services using their fully-qualified container names, like ddev-projecta-solr or ddev-projectb-db, etc.

@wilfi unfortunately I can't read your configurations, and github says the images are not available to zoom in on. If you could please just show the configuration pages of each as a screenshot.

@rfay Here we go - I assume you want to see the server configuration page. Let me know if you want the edit page as well.

Site B (No solr)

Screenshot 2024-06-27 at 7 26 47 PM

Site A

Screenshot 2024-06-27 at 7 26 04 PM
wilfi commented 3 months ago

Here is the edit page screenshots just in case if you want to see.

Site B

Screenshot 2024-06-27 at 7 18 50 PM Screenshot 2024-06-27 at 7 19 06 PM Screenshot 2024-06-27 at 7 19 20 PM Screenshot 2024-06-27 at 7 19 29 PM

Site A

Screenshot 2024-06-27 at 7 30 38 PM Screenshot 2024-06-27 at 7 31 03 PM Screenshot 2024-06-27 at 7 31 23 PM Screenshot 2024-06-27 at 7 31 39 PM
wilfi commented 3 months ago

I think I got the problem. The hostname / node should be like ddev-<projectname>-solr.

The host in site_b_search_server.txt is wrong. solr would access the ddev-solr service of site B, which doesn't exist. The host name has to be something like site-b.ddev.site.

This from @mkalkbrenner made me realise to try with the solr image name. In fact the message thread from @rfay from #ddev slack channel also conveys the same.

Turns out to be a simpler one than I thought. Thankyou both for the amazing work :)

I'll wait for both your go-ahead to close this one out, unless we want to talk about this

@rfay Even if the config isn't correct, I don't understand how site B, which is a different ddev project, could sometimes reach the solr service of site A. With that configuration (the wrong host name) it should never reach it. Is there a general issue with the router?

rfay commented 3 months ago

Glad you got it going!

rfay commented 3 months ago

@mkalkbrenner I should have answered your question:

With that configuration (the wrong host name) it should never reach it. Is there a general issue with the router?

With this configuration, the router is not in play at all, it's direct point-to-point between each ddev-webserver and the appropriate ddev-<projectname>-solr

@wilfi I'm glad you've got it going. None of your posts seems to show a correct configuration though. Please explain the final result so that if somebody wants to do this in the future they can figure it out

AFAICT the "solr node" should be named ddev-site1-solr or whatever on both Drupal instances.

wilfi commented 3 months ago

So here is the final working configuration.

Site B

Screenshot 2024-06-28 at 12 18 02 AM

Key point - Make sure hostname / node points to - ddev-<projectname>-solr (Site A Solr image name)

rfay commented 3 months ago

Thanks!