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.

3.<br />

Create a core on both the nodes with the sample_techproducts_configs.<br />

bin/solr create_core -c core1 -p 8983 -d sample_techproducts_configs<br />

# Create a core on the <strong>Solr</strong> node running on port 8984<br />

bin/solr create_core -c core1 -p 8984 -d sample_techproducts_configs<br />

4.<br />

In the third window, index an example document to each of the server:<br />

bin/post -c core1 example/exampledocs/monitor.xml -port 8983<br />

bin/post -c core1 example/exampledocs/monitor2.xml -port 8984<br />

5.<br />

Search on the node on port 8983:<br />

curl http://localhost:8983/solr/core1/select?q=*:*&wt=xml&indent=true<br />

This should bring back one document.<br />

Search on the node on port 8984:<br />

curl http://localhost:8984/solr/core1/select?q=*:*&wt=xml&indent=true<br />

This should also bring back a single document.<br />

Now do a distributed search across both servers with your browser or curl. In the example below, an<br />

extra parameter 'fl' is passed to restrict the returned fields to id and name.<br />

curl<br />

http://localhost:8983/solr/core1/select?q=*:*&indent=true&shards=localhost:898<br />

3/solr/core1,localhost:8984/solr/core1&fl=id,name<br />

This should contain both the documents as shown below:<br />

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

628

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

Saved successfully!

Ooh no, something went wrong!