Reserve ApacheSolr servers for Drupal


First of all what is Apache Solr?

Apache Solr – is the advanced search platform with open primary code by Apache Lucene project.

Why Apache Solr?

The main criteria for us to choose this platform was the fact that Apache Solr is optimized for work with big loading and that replication is already in platform core and this gives big opportunities for scaling.

One of our projects made us come across a question: “What will happen if our main Solr server will suddenly stop responding? Will all search system on site die in that case?”

Sometimes it’s possible to switch on search of Drupal core (this kind of functional is in Apache Solr Search Integration module), but it can’t be done with big projects because it will create deadly load on data base – so this option is set aside at once.

As another option if main Solr-server is down the administrator sets up a new one ASAP (or makes a master-server out of slave-server) and writes a new connect in Drupal.

But there are 2 problems with that. Firstly, the administrator can’t be online 24/7, secondly in setting up a new server re-indexation of material might take several dozens of hours…

Our decision in this situation:

1) Adding the following lines in settings.php


Here “main” and “reserve” are just the names of connections for a programmer and they don’t affect anything.

If SOLR replication is not used on several servers, but a reserve server must be created, the information can be duplicated from the main server to a reserve server with the help of simple rsync’ folders. It’s enough to add a rule into a crontab:


2) Creating drupal-module which will check connection to SOLR-server on hook_cron and if failure occurs it will switch it to one of the reserve servers.


In our case Elysia Cron module is set to make a check every 3 minutes.


Maximum time of search absence on site if SOLR-server goes down is only several minutes without the interference of web developer or administrator.

5 votes, Rating: 5

Read also


While developing a real estate site for one of our clients we tried to import...


It’s a very helpful module, which allows inserting FileField right into the text editor. For example, in the process of writing this text an Insert button was pushed and the following image...


This kind of mistake can be seen on servers with nginx as frontend and Apache as backend. It’s usually considered to be a nginx problem which is tried to be strenuously solved. Quite often it’s...


Facebook Developer Blog published good news: from now on one can get user’s address and cell phone number.

Need a quote? Let's discuss the project

Are you looking for someone to help you with your Drupal Web Development needs? Let’s get in touch and discuss the requirements of your project. We would love to hear from you.

Join the people who have already subscribed!

Want to be aware of important and interesting things happening? We will inform you about new blog posts on Drupal development, design, QA testing and more, as well news about Drupal events.

No charge. Unsubscribe anytime