This section describes how to run Solr in Standalone Mode. This can be achieved by running Solr independently without zookeeper where you have a single core for each index.
In this section, we will discuss about the standalone server and core, to run Solr with an example schema, how to add documents, and how to run queries. When the Solr server is started in Standalone mode the created configuration is called core and when it is started in SolrCloud mode the created configuration is called Collection.
Solr server can be started by running following command in the bin directory from the Solr directory.
$ bin/solr start
This will start Solr, listening on default port 8983. Now, let’s open the Solr GUI by logging into localhost:8983 in the web browser.
Use help command for specific usage instructions of Solr
$ bin/solr start -help
We can change the port Solr listens on, by giving -p as a parameter to Solr start command.
$ bin/solr start -p 8984
To stop Solr instance running on a specific port use -p parameter with Solr stop command.
$ bin/solr stop -p 8983
We will use the -c parameter to create a core in Solr.
$ bin/solr create_core -c core1
Now, let’s check the Solr GUI for created core named as Core1.
$ bin/post -c core1 example/exampledocs/*xml
Now, let’s explore Solr GUI to check number of documents posted to core1.
We can run the desired query in the -q field of the Solr GUI query panel.
Once the query is executed we get the following result.
We can delete the core previously created by using -c parameter with delete command in Solr.
$ bin/solr delete -c core1 -p 8983
Solr introduced a provision to create a set of sharable configuration files called Config Sets, that can be used to create new cores. The example configurations allow to get started with a configuration that mirrors what you want to accomplish with Solr.
We can launch the examples using -e
The cloud example starts a 1-4 node SolrCloud cluster on a single system. An interactive session will be initiated to take you through options to select an initial config set to start with.
The Techproducts example starts Solr in standalone mode. It starts Solr schema designed for the sample documents included in exampledocs directory under example directory from Solr. The configuration used can be found in sample_techproducts_configs directory.
The Data Import Handler (DIH) provides a mechanism for extracting data from a data store and indexing it. DIH can index content from Relational Database, HTTP based data sources such as RSS and ATOM feeds, e-mail repositories, and structured XML.
The Schemaless example starts Solr in standalone mode using a managed schema, and provides a very minimal pre-defined schema.
Now, let’s run Solr with these example configurations.
To launch the "techproducts" example, we would do:
$ bin/solr -e techproducts
To launch the "dih" example, you would do:
$ bin/solr -e dih
To launch the "schemaless" example, you would do:
$ bin/solr -e schemaless
To launch the "cloud" example, you would do:
$ bin/solr -e cloud
This topic we have explained in detail in Section 3.
To check if Solr is running locally, we can use the status command:
$ bin/solr status
This will gather all the Solr instances running on the system and provide basic information about them, such as the version and memory usage.
We can use - all parameter to stop all running Solr instances.
$ bin/solr stop -all