How to install Apache Solr on CentOS 8

How To Install Apache Solr On CentOS 8

On this article we will discuss about Apache Solr installation on Linux CentOS 8 operating system. We will be using Apache Solr version 8.7.0 as our example.

Introduction

Apache Solr (pronounced “solar”) is an open-source enterprise-search platform. The major features of Apache Solr including : full-text search, hit highlighting, faceted search, real-time indexing, dynamic clustering, database integration, NoSQL features and rich document handling. Apache Solr is written in Java. Solr is designed for scalability and fault tolerance. Solr is widely used for enterprise search and analytics use cases and has an active development community and regular releases. Solr was developed at CNET Networks as an in-house project to add search capability for the company website. and in 2004. And in 2006, 2006, CNET Network doneted the Solr to the Apache Software Foundation.

On this article we will discuss how to install Apache Solr on Linux CentOS 8 operating system. The Apache Solr latest stable version is 8.7.0, which was released on November 3, 2020. The installation process will be consist of several steps, as explain below :

  1. Install Java
  2. Download and install Apache Solr on CentOS 8
  3. Manage Solr Service
  4. Create New Solr Collection
  5. Access Solr via Web dashboard

Install Java

The Latest version of Apache Solr required Java version 8 or greater, on our system we have had Java installed. We will verify the Java installed on our system by submitting command : java --version.

[ramans@otodiginet ~]$ java --version
openjdk 11.0.8 2020-07-14 LTS
OpenJDK Runtime Environment 18.9 (build 11.0.8+10-LTS)
OpenJDK 64-Bit Server VM 18.9 (build 11.0.8+10-LTS, mixed mode, sharing)
OpenJDK 11.08

Java installation on CentOs 8 article is availlable on https://otodiginet.com/software/how-to-install-java-openjdk-11-on-centos-8/ article.

Download and Install Apache Solr on CentOS 8

On this section, we will download, extract and install Solr. As mentioned above, if the lastest version of Apache Solr when this article is version 8.7, so we will download it source, by using command line : wget https://downloads.apache.org/lucene/solr/8.7.0/solr-8.7.0.tgz.

[ramans@otodiginet ~]$ wget https://downloads.apache.org/lucene/solr/8.7.0/solr-8.7.0.tgz
--2020-12-05 23:48:16-- https://downloads.apache.org/lucene/solr/8.7.0/solr-8.7.0.tgz
Resolving downloads.apache.org (downloads.apache.org)… 88.99.95.219, 2a01:4f8:10a:201a::2
Connecting to downloads.apache.org (downloads.apache.org)|88.99.95.219|:443… connected.
HTTP request sent, awaiting response… 200 OK
Length: 200805960 (192M) [application/x-gzip]
Saving to: ‘solr-8.7.0.tgz.1’
solr-8.7.0.tgz.1 100%[======================================>] 191.50M 169KB/s in 24m 8s
2020-12-06 00:12:26 (135 KB/s) - ‘solr-8.7.0.tgz.1’ saved [200805960/200805960]
Apache Solr 8.7.0 download

We will extract the source on the current directory, by submitting command line : tar xzf solr-8.7.0.tgz solr-8.7.0/bin/install_solr_service.sh --strip-components=2.

[ramans@otodiginet ~]$ tar xzf solr-8.7.0.tgz solr-8.7.0/bin/install_solr_service.sh --strip-components=2
Extract Apache Solr source file

The we install the Solr, by submitting command line : sudo bash ./install_solr_service.sh solr-8.7.0.tgz.

ramans@otodiginet ~]$ sudo bash ./install_solr_service.sh solr-8.7.0.tgz
[sudo] password for ramans:
id: ‘solr’: no such user
Creating new user: solr
Extracting solr-8.7.0.tgz to /opt
Installing symlink /opt/solr -> /opt/solr-8.7.0 …
Installing /etc/init.d/solr script …
Installing /etc/default/solr.in.sh …
Service solr installed.
Customize Solr startup configuration in /etc/default/solr.in.sh
*** [WARN] *** Your open file limit is currently 1024.
It should be set to 65000 to avoid operational disruption.
If you no longer wish to see this warning, set SOLR_ULIMIT_CHECKS to false in your profile or solr.in.sh
*** [WARN] *** Your Max Processes Limit is currently 31009.
It should be set to 65000 to avoid operational disruption.
If you no longer wish to see this warning, set SOLR_ULIMIT_CHECKS to false in your profile or solr.in.sh
Waiting up to 180 seconds to see Solr running on port 8983 [-]
Started Solr server on port 8983 (pid=16239). Happy searching!
Found 1 Solr nodes:
Solr process 16239 running on port 8983
{
"solr_home":"/var/solr/data",
"version":"8.7.0 2dc63e901c60cda27ef3b744bc554f1481b3b067 - atrisharma - 2020-10-29 19:39:16",
"startTime":"2020-12-06T09:37:58.229Z",
"uptime":"0 days, 0 hours, 0 minutes, 34 seconds",
"memory":"37.5 MB (%7.3) of 512 MB"}
Apache Solr Installation process
Apache Solr Installation process

Manage Solr Services

The installation will automatically startup the Solr services, but sometimes not. To ensure it, we will check by querying it status by submitting command line : sudo systemctl status solr.

[ramans@otodiginet ~]$ sudo systemctl status solr
● solr.service - LSB: Controls Apache Solr as a Service
Loaded: loaded (/etc/rc.d/init.d/solr; generated)
Active: active (exited) since Sun 2020-12-06 16:40:14 PST; 3min 26s ago
Docs: man:systemd-sysv-generator(8)
Process: 1921 ExecStart=/etc/rc.d/init.d/solr start (code=exited, status=0/SUCCESS)
Tasks: 0 (limit: 49614)
Memory: 0B
CGroup: /system.slice/solr.service
Dec 06 16:39:02 otodiginet solr[1921]: *** [WARN] *** Your open file limit is currently 1024.
Dec 06 16:39:02 otodiginet solr[1921]: It should be set to 65000 to avoid operational disruption.
Dec 06 16:39:02 otodiginet solr[1921]: If you no longer wish to see this warning, set SOLR_ULIMIT_CHECKS to >
Dec 06 16:39:02 otodiginet solr[1921]: *** [WARN] *** Your Max Processes Limit is currently 31009.
Dec 06 16:39:02 otodiginet solr[1921]: It should be set to 65000 to avoid operational disruption.
Dec 06 16:39:02 otodiginet solr[1921]: If you no longer wish to see this warning, set SOLR_ULIMIT_CHECKS to >
Dec 06 16:40:14 otodiginet solr[1921]: [1.2K blob data]
Dec 06 16:40:14 otodiginet solr[1921]: Started Solr server on port 8983 (pid=2512). Happy searching!
Dec 06 16:40:14 otodiginet solr[1921]: [8B blob data]
Dec 06 16:40:14 otodiginet systemd[1]: Started LSB: Controls Apache Solr as a Service.
Apache Solr services status

There are several tasks to manage the Solr service, namely :

  • sudo systemctl enable solr, to enable the service when the system is started up
  • sudo systemctl start solr, start the services
  • sudo systemctl stop sol, stop the services
  • sudo systemctl status solr, query the status of services

Create Solr Collection

The term ‘collection‘ on Apache Solr is the group of cores that together form a single logical index. A collection has a different set of configuration files and schema definitions than other collections.

On this testing, we will try to create a collection and named it as ‘diginet_col‘. For this purpose we will submit the command line : sudo su - solr -c "/opt/solr/bin/solr create -c diginet_col -n data_driven_schema_configs".

ramans@otodiginet ~]$ sudo su - solr -c "/opt/solr/bin/solr create -c diginet_col -n data_driven_schema_configs"
Created new core 'diginet_col'
Apache Solr New Collection
Apache Solr New Collection

Access Solr via Web Dashboard

The Apache Solr dasboard will be avialable on URL : http://[ip_address_server|servername]:8983/solr. OUr IP Address tutorial uses IP Address 192.158.20. 11.

Apache Solr Main dashboard
Apache Solr Main dashboard
Apache Solr Core
Apache Solr Core

Conclusion

We have through Apache Solr versi 8.7.0 installation process on CentOS 8. The installaton was suscessfully done. For more resources about Apache Solr, we could open the tutorial on this web page, https://lucene.apache.org/solr/guide/8_7/solr-tutorial.html.

Share this article via :

Leave a Reply

Your email address will not be published. Required fields are marked *