Validating the Deployment with the Solr REST API
Validate the deployment by indexing and querying documents with the Solr REST API. Before beginning this process, you must have access to the Solr admin web console, as detailed in Deploying Cloudera Search.
Note: Validating deployments using the Solr REST API only succeeds if Kerberos is disabled.
Initiating the collection
- Generate the configuration files for the collection:
$ solrctl instancedir --generate $HOME/solr_configs
- Upload the instance directory to ZooKeeper:
$ solrctl instancedir --create collection1 $HOME/solr_configs
- Create the new collection:
$ solrctl collection --create collection1 -s 2 -c collection1
Indexing Data
Begin by indexing data to be queried later. Sample data is provided in the installed packages. Replace $SOLRHOST in the example below with the name of
any host running the Solr process.
- Parcel-based Installation:
$ cd /opt/cloudera/parcels/CDH/share/doc/solr-doc*/example/exampledocs $ java -Durl=http://$SOLRHOST:8983/solr/collection1/update -jar post.jar *.xml
- Package-based Installation:
$ cd /usr/share/doc/solr-doc*/example/exampledocs $ java -Durl=http://$SOLRHOST:8983/solr/collection1/update -jar post.jar *.xml
Running Queries
After you have indexed data, you can run a query.
To run a query:
- Open the following link in a browser, replacing $SOLRHOST with the name of any host running the Solr process: http://$SOLRHOST:8983/solr.
- Click the collection name in the left panel.
- Click Query in the Menu and select execute query.
Note: Choose wt as json and select the indent option in the web GUI to see more readable output.
Next Steps
Consider indexing more data using the Solr REST API, or move to batch indexing with MapReduce or NRT indexing with Flume. To learn more about Solr, see the Apache Solr Tutorial.
Page generated July 8, 2016.
<< Cloudera Search Tutorial | ©2016 Cloudera, Inc. All rights reserved | Preparing to Index Data with Cloudera Search >> |
Terms and Conditions Privacy Policy |