You are viewing a plain text version of this content. The canonical link for it is here.
Posted to solr-user@lucene.apache.org by Andreas Kahl <ka...@bsb-muenchen.de> on 2016/07/04 09:54:05 UTC

Access Solr via Apache's mod_proxy_balancer or mod_jk (AJP)

Hello everyone, 

we've setup two Solr servers (not SolrCloud) which shall be accessed via
Apache webserver's load balancing (either mod_proxy_balancer or mod_jk).


1. Is it possible to configure Solr >5 to enable an AJP port as this was
the case in earlier versions when running in Tomcat? 

2. If AJP/mod_jk is not possible, how should I set up
mod_proxy_balancer? At the moment I run into the error "All workers are
in error state". This is my current Apache config: 
<Proxy balancer://solrCluster>
                BalancerMember http://server1:8888
                BalancerMember http://server2:8888
</Proxy>
ProxyPass /solrCluster balancer://solrCluster/solr
ProxyPassReverse /solrCluster balancer://solrCluster/solr

Accessing a single server with a non balanced ReverseProxy works
perfectly, but somehow mod_proxy_balancer's health checks do get
negative responses from Solr. Any ideas what's going wrong? (I already
tried putting /solr into the BalancerMembers to avoid the redirect from
/ to /solr)

Thanks
Andreas



RE: Access Solr via Apache's mod_proxy_balancer or mod_jk (AJP)

Posted by "Davis, Daniel (NIH/NLM) [C]" <da...@nih.gov>.
Again I have to insert the larger company view:
  * if your company is largish, you may have a load balancer hardware already in use by systems.  
  * If you are using a Cloud system for the Solr, then you can probably use a load balancer provided by the cloud provider, and this may be cheaper than another instance running haproxy.

However, if there is any problem automating configuration etc. due to corporate culture, then go with haproxy.   Shawn is correct that haproxy is a better fit here than varnish.

-----Original Message-----
From: Shawn Heisey [mailto:apache@elyograg.org] 
Sent: Wednesday, July 06, 2016 9:39 AM
To: solr-user@lucene.apache.org
Subject: Re: Access Solr via Apache's mod_proxy_balancer or mod_jk (AJP)

On 7/4/2016 9:53 AM, Shawn Heisey wrote:
> On 7/4/2016 3:54 AM, Andreas Kahl wrote:
>> Hello everyone, we've setup two Solr servers (not SolrCloud) which 
>> shall be accessed via Apache webserver's load balancing (either 
>> mod_proxy_balancer or mod_jk). 1. Is it possible to configure Solr >5 
>> to enable an AJP port as this was the case in earlier versions when 
>> running in Tomcat? 2. If AJP/mod_jk is not possible, how should I set 
>> up mod_proxy_balancer? At the moment I run into the error "All 
>> workers are in error state". This is my current Apache config: <Proxy 
>> balancer://solrCluster> BalancerMember http://server1:8888 
>> BalancerMember http://server2:8888 </Proxy> ProxyPass /solrCluster 
>> balancer://solrCluster/solr ProxyPassReverse /solrCluster 
>> balancer://solrCluster/solr Accessing a single server with a non 
>> balanced ReverseProxy works perfectly, but somehow 
>> mod_proxy_balancer's health checks do get negative responses from 
>> Solr. Any ideas what's going wrong? (I already tried putting /solr 
>> into the BalancerMembers to avoid the redirect from / to /solr)
> The eclipse wiki is down, but in the Google search results that link 
> to the wiki I can see the text "Using Apache mod_jk and the /Jetty 
> AJP/ connector. We recommend using the HTTP connectors for the 
> following reasons: Jetty performs ..." So for some reason I can't see 
> at the moment, the Jetty authors don't recommend AJP, even though it 
> apparently can do it. You can likely get the AJP module working in the 
> Jetty that Solr includes, but doing so is outside the scope of this 
> mailing list.

Followup:

https://wiki.eclipse.org/Jetty/Howto/Configure_AJP13

They recommend not doing it because performance with http is better, and because support for AJP has been dropped from Jetty 9.  Solr 5.0 and later uses Jetty 9.  So I was incorrect when I said that you can probably get it working with Solr.

I personally would recommend using haproxy as a load balancer for Solr. 
I am doing this, and it works very well.  If you need encryption between Solr and its clients for some reason, setting up TLS on haproxy is also a lot easier than with Java.

Thanks,
Shawn


Re: Access Solr via Apache's mod_proxy_balancer or mod_jk (AJP)

Posted by Shawn Heisey <ap...@elyograg.org>.
On 7/4/2016 9:53 AM, Shawn Heisey wrote:
> On 7/4/2016 3:54 AM, Andreas Kahl wrote:
>> Hello everyone, we've setup two Solr servers (not SolrCloud) which
>> shall be accessed via Apache webserver's load balancing (either
>> mod_proxy_balancer or mod_jk). 1. Is it possible to configure Solr >5
>> to enable an AJP port as this was the case in earlier versions when
>> running in Tomcat? 2. If AJP/mod_jk is not possible, how should I set
>> up mod_proxy_balancer? At the moment I run into the error "All
>> workers are in error state". This is my current Apache config: <Proxy
>> balancer://solrCluster> BalancerMember http://server1:8888
>> BalancerMember http://server2:8888 </Proxy> ProxyPass /solrCluster
>> balancer://solrCluster/solr ProxyPassReverse /solrCluster
>> balancer://solrCluster/solr Accessing a single server with a non
>> balanced ReverseProxy works perfectly, but somehow
>> mod_proxy_balancer's health checks do get negative responses from
>> Solr. Any ideas what's going wrong? (I already tried putting /solr
>> into the BalancerMembers to avoid the redirect from / to /solr) 
> The eclipse wiki is down, but in the Google search results that link
> to the wiki I can see the text "Using Apache mod_jk and the /Jetty
> AJP/ connector. We recommend using the HTTP connectors for the
> following reasons: Jetty performs ..." So for some reason I can't see
> at the moment, the Jetty authors don't recommend AJP, even though it
> apparently can do it. You can likely get the AJP module working in the
> Jetty that Solr includes, but doing so is outside the scope of this
> mailing list.

Followup:

https://wiki.eclipse.org/Jetty/Howto/Configure_AJP13

They recommend not doing it because performance with http is better, and
because support for AJP has been dropped from Jetty 9.  Solr 5.0 and
later uses Jetty 9.  So I was incorrect when I said that you can
probably get it working with Solr.

I personally would recommend using haproxy as a load balancer for Solr. 
I am doing this, and it works very well.  If you need encryption between
Solr and its clients for some reason, setting up TLS on haproxy is also
a lot easier than with Java.

Thanks,
Shawn


Re: Access Solr via Apache's mod_proxy_balancer or mod_jk (AJP)

Posted by Shawn Heisey <ap...@elyograg.org>.
On 7/4/2016 3:54 AM, Andreas Kahl wrote:
> Hello everyone,
>
> we've setup two Solr servers (not SolrCloud) which shall be accessed
> via Apache webserver's load balancing (either mod_proxy_balancer or
> mod_jk).
>
> 1. Is it possible to configure Solr >5 to enable an AJP port as this
> was the case in earlier versions when running in Tomcat?
>
> 2. If AJP/mod_jk is not possible, how should I set up
> mod_proxy_balancer? At the moment I run into the error "All workers
> are in error state". This is my current Apache config:
> <Proxy balancer://solrCluster>
>                 BalancerMember http://server1:8888
>                 BalancerMember http://server2:8888
> </Proxy>
> ProxyPass /solrCluster balancer://solrCluster/solr
> ProxyPassReverse /solrCluster balancer://solrCluster/solr
>
> Accessing a single server with a non balanced ReverseProxy works
> perfectly, but somehow mod_proxy_balancer's health checks do get
> negative responses from Solr. Any ideas what's going wrong? (I already
> tried putting /solr into the BalancerMembers to avoid the redirect
> from / to /solr)

The eclipse wiki is down, but in the Google search results that link to
the wiki I can see the text "Using Apache mod_jk and the /Jetty AJP/
connector. We recommend using the HTTP connectors for the following
reasons: Jetty performs ..."

So for some reason I can't see at the moment, the Jetty authors don't
recommend AJP, even though it apparently can do it.  You can likely get
the AJP module working in the Jetty that Solr includes, but doing so is
outside the scope of this mailing list.

The only load balancer I've ever set up is haproxy.  I use the ping
request handler with the health check file (/solr/corename/admin/ping)
as the method for haproxy to decide when one of the Solr hosts is down. 
The health check file allows me to enable/disable a particular core so I
can influence load balancer decisions without shutting Solr down.

To get help with the proxy mod for Apache, you'll need to find a support
resource for the httpd project.  This is your best bet:

http://httpd.apache.org/lists.html

Thanks,
Shawn


Antw: RE: Access Solr via Apache's mod_proxy_balancer or mod_jk (AJP)

Posted by Andreas Kahl <ka...@bsb-muenchen.de>.
Thanks, Shawn and Daniel for your feedback. We will consider that and see what fits best into our environment. 

Regards
Andreas




>>> "Davis, Daniel (NIH/NLM) [C]" <da...@nih.gov> 05.07.16 19.36 Uhr >>>
Because access to Solr is typically to an API, rather than to webapps having images and static files that can be served directly, I think you can use mod_proxy_http just as well as mod_jk.   I would suggest you not pursue trying to get AJP to work.

mod_proxy_balancer will work with mod_proxy_http, but you may also want to consider using varnish as a front-end cache rather than Apache httpd.   I’m not sure about that architecture myself, because varnish’s strength is in caching the data from the backend systems, and Solr’s data should primarily not be cached.   However, varnish is very commonly used for this sort of thing – and if you also have other things behind the balancer (such as WordPress or Drupal), then varnish is becoming a better a way to go.

Hope this helps,

Dan Davis, Systems/Applications Architect (Contractor),
Office of Computer and Communications Systems,
National Library of Medicine, NIH



From: Andreas Kahl [mailto:kahl@bsb-muenchen.de]
Sent: Monday, July 04, 2016 5:54 AM
To: solr-user@lucene.apache.org
Subject: Access Solr via Apache's mod_proxy_balancer or mod_jk (AJP)

Hello everyone,

we've setup two Solr servers (not SolrCloud) which shall be accessed via Apache webserver's load balancing (either mod_proxy_balancer or mod_jk).

1. Is it possible to configure Solr >5 to enable an AJP port as this was the case in earlier versions when running in Tomcat?

2. If AJP/mod_jk is not possible, how should I set up mod_proxy_balancer? At the moment I run into the error "All workers are in error state". This is my current Apache config:
<Proxy balancer://solrCluster>
                BalancerMember http://server1:8888
                BalancerMember http://server2:8888
</Proxy>
ProxyPass /solrCluster balancer://solrCluster/solr
ProxyPassReverse /solrCluster balancer://solrCluster/solr

Accessing a single server with a non balanced ReverseProxy works perfectly, but somehow mod_proxy_balancer's health checks do get negative responses from Solr. Any ideas what's going wrong? (I already tried putting /solr into the BalancerMembers to avoid the redirect from / to /solr)

Thanks
Andreas



RE: Access Solr via Apache's mod_proxy_balancer or mod_jk (AJP)

Posted by "Davis, Daniel (NIH/NLM) [C]" <da...@nih.gov>.
Because access to Solr is typically to an API, rather than to webapps having images and static files that can be served directly, I think you can use mod_proxy_http just as well as mod_jk.   I would suggest you not pursue trying to get AJP to work.

mod_proxy_balancer will work with mod_proxy_http, but you may also want to consider using varnish as a front-end cache rather than Apache httpd.   I’m not sure about that architecture myself, because varnish’s strength is in caching the data from the backend systems, and Solr’s data should primarily not be cached.   However, varnish is very commonly used for this sort of thing – and if you also have other things behind the balancer (such as WordPress or Drupal), then varnish is becoming a better a way to go.

Hope this helps,

Dan Davis, Systems/Applications Architect (Contractor),
Office of Computer and Communications Systems,
National Library of Medicine, NIH



From: Andreas Kahl [mailto:kahl@bsb-muenchen.de]
Sent: Monday, July 04, 2016 5:54 AM
To: solr-user@lucene.apache.org
Subject: Access Solr via Apache's mod_proxy_balancer or mod_jk (AJP)

Hello everyone,

we've setup two Solr servers (not SolrCloud) which shall be accessed via Apache webserver's load balancing (either mod_proxy_balancer or mod_jk).

1. Is it possible to configure Solr >5 to enable an AJP port as this was the case in earlier versions when running in Tomcat?

2. If AJP/mod_jk is not possible, how should I set up mod_proxy_balancer? At the moment I run into the error "All workers are in error state". This is my current Apache config:
<Proxy balancer://solrCluster>
                BalancerMember http://server1:8888
                BalancerMember http://server2:8888
</Proxy>
ProxyPass /solrCluster balancer://solrCluster/solr
ProxyPassReverse /solrCluster balancer://solrCluster/solr

Accessing a single server with a non balanced ReverseProxy works perfectly, but somehow mod_proxy_balancer's health checks do get negative responses from Solr. Any ideas what's going wrong? (I already tried putting /solr into the BalancerMembers to avoid the redirect from / to /solr)

Thanks
Andreas