Load balancing Solr queries using PHP
Solarium comes with a load balancer plugin that can be used to build redundancy among multiple Solr servers. The load balancer plugin has the following features:
Support for multiple servers, each with their own weight.
The ability to use a failover mode—try another Solr server if a query fails.
Block certain query types. Updates are by default blocked.
Force a specific server for the next query.
Add all Solr servers where you want to distribute your queries to your Solarium client configuration. In our case, we will be adding the master and slave Solr servers that we have recently set up with the following code:
$config = array( "master" => array( "master" => array( "host"=>"127.0.0.1", "port"=>"8080", "path"=>"/solr", "core"=>"collection1", ), ), "slave" => array( "slave" => array( "host"=>"127.0.0.1", "port"=>"8983...