Solr core setup and Solr UI
Extended from the previous post, we will explore Solr UI here. This post is third in its series of exploration and understanding of Solr for the purpose of full text search technology (1st post, 2nd post). Solr provides with UI that has powerful analysis tools along with admin capabilities. In this story we will explore admin tools such as core addition, core reload and core deletion along with core level configurations.
Let’s navigate to solr home directory (remember we set SOLR_HOME in the last post). You can pull an initial configuration setup that I have posted on github (https://github.com/vivek7266/solr-config).
$ # create a directory here corresponding to your core name e.g. "songs" (make sure you are using the same user that will start solr server)$ mkdir songs
$ cd songs$ # create conf and data folders here
$ # use the conf files provided in my repo (https://github.com/vivek7266/solr-config) to smoothly finish the setup
$ # basically you need to provide with solrconfig.xml
$ # and schema.xml, also if you have used other conf files in schema
$ # like stopwords.txt, synonyms.txt, etc
After we are done with creating appropriate folder structure and creating required configuration files, go to
http://localhost:8983/solr. We see a UI as shown in the figure below. Carefully glance through the details of our java process and navigation menu on the left side. Here, we have the option of Core Admin. Notice on left side, core navigation mentions there are no cores available as we have not created a core yet.
Let’s go to Core Admin and create songs core. Here, we need to provide with
instanceDir, set it as
songs as we have created folder with that name (as shown in the figure below). Instance directory is the location for core level files. Date directory is where Solr will store the indexes corresponding to the documents we add in this core later on.
After successfully creating the core, you will see the following screen. If you get some sort of error, go to
solr-7.3.1/server/logs/solr.log at the location where you unzipped/installed Solr. Try to figure out the error, which is mostly because of missing file/permissions/incorrect configurations. To delete this core simply Unload (red button on top). If we make some changes to schema or config after creating the core, we need not restart the server. We can use the Reload button to load new changes.
On the left hand side, notice that from No cores available, the text has changed to Core Selector. Let’s select a core and look at the tools that Solr UI is powered with. See the picture below. We should get this type of screen after successfully creating a core (also,
songs core has been selected here).
We see a bunch of options on the left just below the songs core. Overview summarises the core. Once we have a master-slave setup we can see how there is a version mismatch here, whether a slave is running behind the master (last modified gives the timestamp of the last updated document and version in is corresponding to last update, if mismatch between slave and master, it suggests updates are yet to happen on slaves). Another important attribute is Num Docs. This value is corresponding to the total number of documents in the core. As we have not added any documents here, it is zero. Additionally, have a look at the schema that we have provided with for now and tally with
Above picture is corresponding to replication for this core. If we look at
solrconfig.xml we have not provided a replication handler. This means that by default this core will be master. Also, version is zero as we are yet to add documents in this core. Note that, we have also not mentioned what files to replicate to slaves. And
replicationAfter is set to
commit, if it was set to
startup, commit replication would take place even when Solr master is restarted (or started).
Voila! We are through installing Solr, setting up configurations for Solr server and creating a core. You can play around and create a Solr slave using my last post. We will cover document add, update and delete and more document level analysis using UI in the next posts.
To be continued…