Apache Solr is an opensource Java library builds on Lucene which provides indexing, searching and advanced analytic capabilities on data. In this tutorial, we are going to see how to install Apache Solr on Windows 10 operating system and run the basic commands on standalone solr console.
Apache Solr Requirements:
We can freely install the Apache Solr in any system with the minimum system requirements and suitable Java environment. Solr currently supports Linux, MacOS/OS X, and Microsoft Windows operating system. The latest Solr 7.x.x installation requires Java 8+
Install Apache Solr :
Step 1: Download the latest Apache Solr version from the official website. For me it is 7.5.0 is the most recent release and I am going with this.
Click on above heightened binary release then it will get automatically download into your machine.
Step 2: Extract the solr-7.5.0.zip into your favorite folder then you can see the following directories.
Apache Solr Directory Structure:
bin: It contains all the necessary binary scripts, which helps the solr make easier to run.
contrib: Solr’s contrib directory includes add-on plugins for specialized features of Solr.
dist: The dist directory contains the main Solr .jar files.
docs: The docs directory includes a link to online Javadocs for Solr.
example: The example directory includes several types of examples that demonstrate various Solr capabilities.
licenses: The licenses directory includes all of the licenses for 3rd party libraries used by Solr.
server: This directory is where the heart of the Solr application resides.
Start Solr server:
Step 3: Goto bin directory from command prompt and execute the >solr start command to start Solr instance.
You can notice the above solr console, I started the Solr server on port 8983.
Step 4: Access Apache Solr dashboard from the web browser.
This is the Solr dashboard, where we can see a lot of default configuration details such as solr-spec version, JVM detail, processor, physical, heap memory occupied by solr and etc..
As I highlighted above, solr doesn’t create any default cores. A Solr core is a running instance of the lucene index, that contains all solr configuration details. We have to create solr core to perform operations like indexing and analyzing the data.
A Solr can contain one or more cores if require these cores can communicate with each other.
Creating Solr Core:
Below is the syntax for creating core in Apache Solr.
bin/solr create_core [-c name] [-d confdir] [-p port]
Where create_core is used to create solr code, [-c name] giving a name to the core, [-d confdir] specifying configuration directory location to store the core in standalone mode and [-p port] is used to providing the port for the specific core.
Here confdir and port are optional if you don’t specify these two values, solr assigns it to the default values as $SOLR_HOME as confdir and 8983 as the port.
Creating sample-items Solr core with default confdir and port.
bin/solr create_core -c sample-items
Refresh the Solr dashboard on the web browser, there you can see the created solr core.
Likewise, you can create your solr cores with optional parameters like confdir and port.
bin/solr create_core -c sample-items2 -d myconfig -p 8989
Deleting Solr core:
We can delete the solr core using delete command, let’s delete the solr-items core.
>solr delete -c sample-items
Happy Learning 🙂