11.05.2016 Views

Apache Solr Reference Guide Covering Apache Solr 6.0

21SiXmO

21SiXmO

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

master/slave shard.<br />

For high availability you can use a load balancer to set up a virtual IP for each shard's set of slaves. If you are<br />

new to load balancing, HAProxy ( http://haproxy.1wt.eu/ ) is a good open source software load-balancer. If a slave<br />

server goes down, a good load-balancer will detect the failure using some technique (generally a heartbeat<br />

system), and forward all requests to the remaining live slaves that served with the failed slave. A single virtual IP<br />

should then be set up so that requests can hit a single IP, and get load balanced to each of the virtual IPs for the<br />

search slaves.<br />

With this configuration you will have a fully load balanced, search-side fault-tolerant system (<strong>Solr</strong> does not yet<br />

support fault-tolerant indexing). Incoming searches will be handed off to one of the functioning slaves, then the<br />

slave will distribute the search request across a slave for each of the shards in your configuration. The slave will<br />

issue a request to each of the virtual IPs for each shard, and the load balancer will choose one of the available<br />

slaves. Finally, the results will be combined into a single results set and returned. If any of the slaves go down,<br />

they will be taken out of rotation and the remaining slaves will be used. If a shard master goes down, searches<br />

can still be served from the slaves until you have corrected the problem and put the master back into production.<br />

Merging Indexes<br />

If you need to combine indexes from two different projects or from multiple servers previously used in a<br />

distributed configuration, you can use either the IndexMergeTool included in lucene-misc or the CoreAdminH<br />

andler.<br />

To merge indexes, they must meet these requirements:<br />

The two indexes must be compatible: their schemas should include the same fields and they should<br />

analyze fields the same way.<br />

The indexes must not include duplicate data.<br />

Optimally, the two indexes should be built using the same schema.<br />

Using IndexMergeTool<br />

To merge the indexes, do the following:<br />

1.<br />

2.<br />

Make sure that both indexes you want to merge are closed.<br />

Issue this command:<br />

java -cp $SOLR/server/solr-webapp/webapp/WEB-INF/lib/lucene-core-VERSION.jar:$<br />

SOLR/server/solr-webapp/webapp/WEB-INF/lib/lucene-misc-VERSION.jar<br />

org/apache/lucene/misc/IndexMergeTool<br />

/path/to/newindex<br />

/path/to/old/index1<br />

/path/to/old/index2<br />

This will create a new index at /path/to/newindex that contains both index1 and index2.<br />

3. Copy this new directory to the location of your application's solr index (move the old one aside first, of<br />

course) and start <strong>Solr</strong>.<br />

Using CoreAdmin<br />

The MERGEINDEXES command of the CoreAdminHandler can be used to merge indexes into a new core – either<br />

from one or more arbitrary indexDir directories or by merging from one or more existing srcCore core names.<br />

See the CoreAdminHandler section for details.<br />

<strong>Apache</strong> <strong>Solr</strong> <strong>Reference</strong> <strong>Guide</strong> <strong>6.0</strong><br />

638

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!