I've installed tomcat6 and solr server. And it is fine when Drupal's search api solr module connects it locally. However it can't be reached by the same module externally. The weird is that it is ok by visiting directly 108.59.*.*:8080/solr

The os of solr server is Ubuntu 12.04 LTS. Any suggestion? Thanks.

Comments

hgurol’s picture

I am using jetty instead of tomcat. So, I am not sure if it would apply to your setup.

When I was using "108.59.*.*:8080/solr" directly it was working fine because jetty was redirecting me to "108.59.*.*:8080/solr/#/".

I kept receiving the same error message through Drupal setup until I figured that I should include that "#" part in the host address config.

Give it a try...

drunken monkey’s picture

I kept receiving the same error message through Drupal setup until I figured that I should include that "#" part in the host address config.

This really worked? Seems weird to me, but if you say so …

If you are using Solr 4.x, you might need to include the core name in the Search API server "path" setting – so, for the example server, "/solr/collection1". With the example application, "/solr" works fine for me, though.
If you are unsure, just use Solr's admin UI to execute a search query, look at the search URL and then copy everything between the domain/port and /select?…. So, if you get your result list under http://example.com:8080/solr/drupal/select?rows=10, then use "/solr/drupal" as the path.

Also, please make sure that your production Solr server is never accessible directly from the internet! This is a huge security risk! If Drupal has to access Solr remotely, either change the initial path component ("/solr") to a random string of characters (at least 16 characters) or use HTTP authentication or some other access control mechanism.

stBorchert’s picture

We installed the latest solr (4.7.0) and the current development versions of Search API (7.x-1.11+9-dev) and Search API Solr Search (7.x-1.4+8-dev).
Using simply "/solr" as path doesn't work with a custom index. We have to use "solr/#/~cores/collection1""solr/collection1" (where "collection1" is the name of the core we use) as the path to make Drupal connect to server.

Just for the record in case this may help some people.

hgurol’s picture

Status: Active » Closed (works as designed)

I take back whatever I said at #1. Using '#' fixes the connection problem but then the indexing do not work.
The correct solr path config should be "/solr/drupal", replace drupal with your own instance (core) name.
Closing this one.

sharif.elshobkshy’s picture

I'm unable to connect to the Solr Server.
We used to have Solr 4, then downgraded to 3.6.2, and finally we were forced to downgrade to 3.5.0 (for reasons beyond Drupal).
We were able to connect to Solr 4 and Solr 3.6.2 with multicores. However I'm unable to connect to the server with this new Solr version (3.5.0).

Is there something different when working with Solr 3.5.0.

Thanks.
Regards.
Sharif.

bwoods’s picture

For anyone checking this out and trying to use Solr 5.0, here's what I did:

- Created a drupal directory at server/solr/ (same level as configsets)
- Copied conf from the module to server/solr/drupal
- Created a solr core called drupal
- User http://servername.com:8983/solr/drupal in drupal solr config to contact the server

lmstephenson’s picture

@bwoods => reply #6

THANKS!!!! Was scratching my head for hours and all I had to do was add /drupal at the end of the URL input...

Solr server URL
http://IPADDRESS:8983/solr/drupal

Additional note: Adding the /drupal after /solr also worked for the Solr Search API config string too!

keesje’s picture

In my case I reverse-engineered it to ping() method in search_api_solr/includes/solr_connection.inc, the default timeout of 2 was too short. In my case the latency was 5000ms + something. When accessing the ping URL in the browser the latency was waaay shorter. I traced that down to a missing IPv6 entry in my hostfile for the (local) SOLR server. after adding this the extra latency of 5000ms disapeared.
ymmv

related:
http://stackoverflow.com/questions/10064581/how-can-i-eliminate-slow-res...

ressa’s picture

I can confirm that whereas the Solr URL might be http://example.com:8983/solr/#/your_core_name, this is the Solr path setting which works: /solr/your_core_name in Solr 7.7.0.

Yet, the path on the Status page https://example.com/admin/config/search/search_api/server/name_of_server doesn't work:
Solr server URI: http://example.com:8983/solr/your_core_name

ressa’s picture

Since the importance of securing Solr servers has been mentioned here, I thought I'd share an easy way to block external access, while still being able to access Solr Admin via browser, by opening an SSH tunnel:

First, block external access to Solr by adding this to /etc/default/solr.in.sh, restart Solr to make it take effect:
SOLR_OPTS="$SOLR_OPTS -Djetty.host=127.0.0.1"

Assuming you have SSH access to the server, open an SSH tunnel with this command, replacing user@x.x.x.x with your username and server IP:
ssh -L localhost:8080:127.0.0.1:8983 user@x.x.x.x -N -C

You can now access the Solr Admin via a browser, at http://localhost:8080/

Full disclosure: I found the tip in Accessing SOLR server instance with SSH Tunnelling, thanks to thepanz!