System Requirements
The system requirements for Apache Solr vary depending on the scale of your deployment and the specific workload. However, here are some general guidelines for hardware and software requirements that will help ensure a robust and efficient Solr setup:
Hardware Requirements
- CPU: Solr is a CPU-intensive application, particularly during indexing. A modern multi-core processor (quad-core or higher) is recommended for better performance, especially for high-query environments or large indexing tasks.
- Memory: Solr heavily relies on RAM for its caching and to hold the inverted index. The amount of RAM needed will depend on the size of your data and your query load. It’s common to start with at least 8 GB of RAM, but for larger datasets or higher query volumes, 16 GB or more may be necessary.
- Disk Space: Solr stores indexes on disk, and these indexes can be quite large depending on the dataset. Fast I/O is crucial, so SSDs (Solid State Drives) are recommended over HDDs (Hard Disk Drives) for production environments. The amount of disk space required will depend on the size of your data and your index configurations.
- Network: Good network throughput is essential, especially in a distributed SolrCloud setup, where nodes need to communicate frequently.
Software Requirements
- Java: Solr is a Java application and requires a Java Runtime Environment (JRE). As of Solr 8.x and later, Java 11 or newer is required. Make sure to use a supported Java version for your specific Solr version.
- Operating System: Solr is platform-independent and can run on any operating system that supports Java, including Linux, Windows, and MacOS. However, a Unix-like environment (e.g., Linux) is typically preferred for production deployments due to its stability and performance handling.
- Servlet Container: For older versions of Solr (before Solr 5.x), a servlet container such as Apache Tomcat or Jetty was required. From Solr 5.x onwards, Solr comes with a built-in Jetty servlet container, so no external container is needed.
- Browser: For accessing the Solr Admin interface, a modern web browser is required. This is not a server requirement per se but necessary for administrative access.
Here is a table summarizing major versions of Apache Solr and the Java versions they support:
Solr Version | Supported Java Version |
---|---|
Solr 4.x | Java 7+ |
Solr 5.x | Java 8+ |
Solr 6.x | Java 8+ |
Solr 7.x | Java 8+ |
Solr 8.x | Java 8 to 15 |
Solr 9.x | Java 11+ |
Network Configuration
- Ensure that appropriate firewall and security settings are configured to allow traffic on the ports used by Solr (default is 8983 for the HTTP interface).
- For SolrCloud configurations, additional setup for ZooKeeper nodes and inter-node communication is necessary, often requiring configuration on multiple ports.
It is strongly recommended to run Apache Solr as a normal user, not as the root user. Running Solr as root can pose security risks, especially if Solr is exposed to the internet.
How to Install Solr using Docker?
## ------------------------------------------------------------------------------------ ##
# Running Solr with host-mounted directories
$ mkdir solrdata
$ docker run -d -v "$PWD/solrdata:/var/solr" -p 8983:8983 --name my_solr solr solr-precreate gettingstarted
## ------------------------------------------------------------------------------------ ##
Then with a web browser go to http://localhost:8983/ to see Solr’s Admin UI (adjust the hostname for your docker host). In the UI, click on "Core Admin" and should now see the "gettingstarted" core.
Next load some of the example data that is included in the container:
$ docker exec -it my_solr post -c gettingstarted example/exampledocs/manufacturers.xml
## ------------------------------------------------------------------------------------ ##
# For quick demos of Solr docker, there is a single command that starts Solr, creates a collection called "demo", and loads sample data into it:
$ docker run --name solr_demo -d -p 8983:8983 solr solr-demo
## ------------------------------------------------------------------------------------ ##
# Loading Your Own Data
# start Solr. Listens on localhost:8983
$ docker run --name my_solr -p 8983:8983 solr solr-precreate books
# get data
$ mkdir mydata
$ wget -O mydata/books.csv https://raw.githubusercontent.com/apache/solr/main/solr/example/exampledocs/books.csv
$ docker run --rm -v "$PWD/mydata:/mydata" --network=host solr post -c books /mydata/books.csv
## ------------------------------------------------------------------------------------ ##
How to Install Solr using Docker Compose?
version: '3'
services:
solr:
image: solr
ports:
- "8983:8983"
volumes:
- data:/var/solr
command:
- solr-precreate
- gettingstarted
volumes:
data:
you can simply run:
$ docker compose up -d
How to run Apache solr 9.x in ubuntu?
sudo apt update
sudo apt install openjdk-11-jdk
wget https://dlcdn.apache.org/solr/solr/9.6.0/solr-9.6.0.tgz
tar xzf solr-9.6.0.tgz
cd solr-9.6.0
bin/solr start
This will run Solr on the default port 8983. Access the Solr admin panel via http://localhost:8983/solr.
Solr Configuration Files
Here’s a table summarizing some key Solr configuration files and their purposes:
File Name | Purpose |
---|---|
solr.xml | The main configuration file for a Solr instance, defining core properties and settings for the Solr environment. |
schema.xml | Defines the schema for data indexing, including field types, fields, and how fields are processed during indexing and querying. |
solrconfig.xml | Configures the Solr core, specifying settings for query processing, request handlers, and other core behaviors. |
stopwords.txt | Contains a list of stopwords that are not indexed to improve search efficiency and relevance. |
elevate.xml | Configures query elevation to prioritize certain documents in search results. |
synonyms.txt | Manages synonyms to expand or conflate query terms for more comprehensive search results. |
core.properties | Stores properties specific to each core, including core name and data directory path, used for core discovery and configuration. |
Apache Solr Directory Layout
After installing Solr, you’ll see the following directories and files within them:
bin/
This directory includes several important scripts that will make using Solr easier.
solr and solr.cmd
This is Solr’s Control Script, also known as bin/solr (*nix) / bin/solr.cmd (Windows). This script is the preferred tool to start and stop Solr. You can also create collections or cores, configure authentication, and work with configuration files when running in SolrCloud mode.
post
The Post Tool, which provides a simple command line interface for POSTing content to Solr.
solr.in.sh and solr.in.cmd
These are property files for *nix and Windows systems, respectively. System-level properties for Java, Jetty, and Solr are configured here. Many of these settings can be overridden when using bin/solr / bin/solr.cmd, but this allows you to set all the properties in one place.
install_solr_services.sh
This script is used on *nix systems to install Solr as a service. It is described in more detail in the section Taking Solr to Production.
modules/
Solr’s modules directory includes 1st-party add-ons for specialized features that enhance Solr. See the section Solr Modules for more information. This is not included in the slim distribution.
prometheus-exporter/
A standalone application, included under bin/, that montiors Solr instances and produces Prometheus metrics. See the section Monitoring with Prometheus and Grafana for more information. This is not included in the slim distribution.
docker/
This contains a Dockerfile to build a Docker image from the binary distribution, that is compatible with the official image. This directory also contains the scripts needed when using Solr inside the Docker image, under the scripts/ directory. The README.md in this directory describes how custom Solr Docker images can be built using this binary distribution. Refer to the section Solr in Docker page for information on using a Solr Docker image.
lib/
Folder where Solr will look for additional plugin jar files.
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. See the section Solr Examples below for more details on what is in this directory.
licenses/
The licenses directory includes all of the licenses for 3rd party libraries used by that distribution of Solr.
server/
This directory is where the heart of the Solr application resides. A README in this directory provides a detailed overview, but here are some highlights:
Solr’s Admin UI & JAR files (server/solr-webapp)
Jetty libraries (server/lib)
Log files (server/logs) and log configurations (server/resources). See the section Configuring Logging for more details on how to customize Solr’s default logging.
Sample configsets (server/solr/configsets)
Here are the examples included with Solr:
exampledocs
This is a small set of simple CSV, XML, and JSON files that can be used with bin/solr post
when first getting started with Solr. For more information about using bin/solr post
with these files, see Post Tool.
files
The files
directory provides a basic search UI for documents such as Word or PDF that you may have stored locally. See the README there for details on how to use this example.
films
The films
directory includes a robust set of data about movies in three formats: CSV, XML, and JSON. See the README there for details on how to use this dataset.
Leave a Reply