×
Community Blog How to Install Apache Solr on Ubuntu 16.04

How to Install Apache Solr on Ubuntu 16.04

In this tutorial, we will explore how to install Apache Solr on an Alibaba Cloud ECS Ubuntu 16.04 instance.

By Hitesh Jethva, Alibaba Cloud Tech Share Author. Tech Share is Alibaba Cloud’s incentive program to encourage the sharing of technical knowledge and best practices within the cloud community.

Apache Solr is a free and open source search platform written in Java that can be used to build search applications. It was built on top of Lucene project that provides full-text search, spell suggestions, custom document ordering and ranking, Snippet generation and highlighting. Apache Solr allows us to create custom search engines that index databases, files, and websites. It is specially designed for scalability and fault tolerance. Apache Solr runs as a standalone full-text search server and uses the Lucene Java search library at its core for full-text indexing and search. You can also use Apache Solr with Hadoop to handles a large amount of data.

Some of the advantages of Apache Solr include:

  1. Supports different file formats like XML, JSON and .CSV.
  2. Can be deployed in any kind of systems such as standalone, distributed, and cloud.
  3. Allows customization of components easily.
  4. Provides a user-friendly, and feature powered web interface that can be used to manage logs, add, delete, update and search documents.
  5. Provides advanced text search capabilities including phrases, wildcards, joins, grouping and much more across any data type.

In this tutorial, we will learn how to how to install and configure Apache Solr on an Alibaba Cloud Elastic Compute Service (ECS) Ubuntu 16.04 instance.

Prerequisites

  1. A fresh Alibaba cloud instance with Ubuntu 16.04 server installed.
  2. A static IP address 192.168.0.103 is configured on the instance.
  3. A root password is setup on the server.

Launch an Alibaba Cloud ECS Instance

First, login to your Alibaba Cloud ECS Console. Create a new ECS instance, with Ubuntu 16.04 as the operating system with at least 2GB RAM. Connect to your ECS instance and log in as the root user.

Once you are logged into your Ubuntu 16.04 instance, run the following command to update your base system with the latest available packages.

apt-get update -y

Install Java

By default, the latest version of the Java is not available in Ubuntu 16.04 default repository. So, you will need to add the Java repository to your system. You can add Java repository using the following command:

 apt-get install python-software-properties -y
add-apt-repository ppa:webupd8team/java

Once the Java repository is installed, update the repository and install Java with the following command:

 apt-get update -y
apt-get install oracle-java8-installer -y

Once the Java is installed, you can check the Java version using the following command:

java -version

You should see the following output:

java version "1.8.0_161"
Java(TM) SE Runtime Environment (build 1.8.0_161-b12)
Java HotSpot(TM) 64-Bit Server VM (build 25.161-b12, mixed mode)

Install Apache Solr

First, you will need to download the latest version of the Solr from their official website. You can do this using the following command:

cd /opt/
wget http://redrockdigimark.com/apachemirror/lucene/solr/7.3.1/solr-7.3.1.tgz

Now, extract the Solr service installation file from Solr source by running the following command:

tar xzf solr-7.3.1.tgz solr-7.3.1/bin/install_solr_service.sh --strip-components=2

Next, install Solr as a service using the following command:

./install_solr_service.sh solr-7.3.1.tgz

Once Solr is installed, you should see the following output:

Service solr installed.
Customize Solr startup configuration in /etc/default/solr.in.sh
● solr.service - LSB: Controls Apache Solr as a Service
Loaded: loaded (/etc/init.d/solr; bad; vendor preset: enabled)
Active: active (exited) since Sun 2018-05-20 07:37:04 IST; 5s ago
 Docs: man:systemd-sysv-generator(8)

Process: 2926 ExecStart=/etc/init.d/solr start (code=exited, status=0/SUCCESS)

May 20 07:36:32 Node1 solr[2926]: [WARN] Your open file limit is currently 1024.
May 20 07:36:32 Node1 solr[2926]: It should be set to 65000 to avoid operational disruption.
May 20 07:36:32 Node1 solr[2926]: If you no longer wish to see this warning, set SOLR_ULIMIT_CHECKS to false in your profile or solr.in.sh
May 20 07:36:32 Node1 solr[2926]: [WARN] Your Max Processes Limit is currently 3820.
May 20 07:36:32 Node1 solr[2926]: It should be set to 65000 to avoid operational disruption.
May 20 07:36:32 Node1 solr[2926]: If you no longer wish to see this warning, set SOLR_ULIMIT_CHECKS to false in your profile or solr.in.sh
May 20 07:37:04 Node1 solr[2926]: [458B blob data]
May 20 07:37:04 Node1 solr[2926]: Started Solr server on port 8983 (pid=3050). Happy searching!
May 20 07:37:04 Node1 solr[2926]: [14B blob data]
May 20 07:37:04 Node1 systemd[1]: Started LSB: Controls Apache Solr as a Service.

You can check the status of Solr service at any time by running the following command:

service solr status

You should see the following output:

solr.service - LSB: Controls Apache Solr as a Service
Loaded: loaded (/etc/init.d/solr; bad; vendor preset: enabled)
Active: activating (start) since Thu 2018-05-24 21:22:20 IST; 49s ago
 Docs: man:systemd-sysv-generator(8)

Control: 569 (solr)
CGroup: /system.slice/solr.service

       └─569 /bin/sh /etc/init.d/solr start

May 24 21:22:20 Node1 systemd[1]: Starting LSB: Controls Apache Solr as a Service...
May 24 21:22:21 Node1 su[580]: Successful su for solr by root
May 24 21:22:21 Node1 su[580]: + ??? root:solr
May 24 21:22:22 Node1 su[580]: pam_unix(su:session): session opened for user solr by (uid=0)
May 24 21:22:42 Node1 solr[569]: [WARN] Your open file limit is currently 1024.
May 24 21:22:42 Node1 solr[569]: It should be set to 65000 to avoid operational disruption.
May 24 21:22:42 Node1 solr[569]: If you no longer wish to see this warning, set SOLR_ULIMIT_CHECKS to false in your profile or solr.in.sh
May 24 21:22:42 Node1 solr[569]: [WARN] Your Max Processes Limit is currently 9628.
May 24 21:22:42 Node1 solr[569]: It should be set to 65000 to avoid operational disruption.
May 24 21:22:42 Node1 solr[569]: If you no longer wish to see this warning, set SOLR_ULIMIT_CHECKS to false in your profile or solr.in.sh

Create Your First Solr Collection

Now, create your first collection in Apache Solr by running the following command:

cd /opt
solr -c "/opt/solr/bin/solr create -c letsstarted -n data_driven_schema_configs"

You should see the following output:

Created new core 'letsstarted'

Access Solr Web Interface

Apache Solr is now up and running on port 8983. Open your web browser and type the URL http://yourdomain.com:8983, and you should see the following page:

1

Now, click on the Core Selector dropdown list on the left sidebar and select your created collection. You should see the statics of created collection in the following page:

2

Next, on the left sidebar click on the Documents, you should see the following page:

3

Here, add some documents like "Linux Cookbook" as shown in the following output:

{
"id": 1,
"book_title": "Linux Cookbook",
"published": 2018,
"description": "All about Linux"
}

Now, click on the Submit Document button to add your documents to the Index. You should see the following output:

Status: success
Response:

{
"responseHeader": {

"status": 0,
"QTime": 1611

}
}

Now, on the left sidebar click on the Query button, you should see the following page:

4

Now, click on the Execute Query button, you should see your created documents in the following page:

5

Congratulations! You have successfully installed and configured Apache Solr on Ubuntu 16.04 server. You can now easily deploy it in the production environment.

Related Alibaba Cloud Products

Alibaba Cloud CDN is built to automatically handle spikes in traffic, reduce load speed on your origin site and support storage capacity of up to 1.5 petabytes.
With its low latency and high data transfer rate, the Alibaba Cloud CDN directs user requests to the most suitable node based on network congestion to retrieve content in the most efficient manner. The CDN has a high performance cache system built with powerful clusters of servers to maximize throughput. The CDN relies on an intelligent object heat algorithm and hierarchical ‘hot’ cache resources for precise resource acceleration.

Hybrid Cloud Storage Array is an enterprise-level storage array that integrates with the Alibaba Cloud storage gateway. You can use and manage cloud storage resources (blocks, files, and objects) just as you would with local storage. Cloud Cache, Cloud Sync, Cloud Tiering, and Cloud Backup all make local storage migrate to the cloud seamlessly. HCSA services provide a cost-effective, efficient and easy-to-manage hybrid cloud storage solution.
The devices are deployed using standard racks and have no requirements for the data center deployment. The devices support dual-controller and active-active clusters. The cloud distributed storage provides 99.9% reliability and 99.9% availability.

0 0 0
Share on

Alibaba Clouder

2,599 posts | 762 followers

You may also like

Comments