Hello everyone, welcome to this Apache Solr today we read articles. Simply put, Apache Solr is one of the most prestigious open source search platform, with the rear end of the site to run Apache Lucene, allows you to easily create a search engine to search for Web sites, databases and documents. It can index and search multiple sites and return to search relevant content recommendations based on search text.
Solr uses HTTP Extensible Markup Language (XML), provides an application program interface (API) as JSON, Python and Ruby. According to the project Apache Lucene, Solr provides a lot of features, making it popular with administrators of welcome:
Full Text Search
Faceted navigation (Faceted Navigation)
Spelling suggestion / autocomplete
Custom Document ordering / arrangement
On a package to minimize the use of the new Ubuntu 14/15 system, you only need a small amount of preparation, we begin to install Apache Solor.
1) System Update System Update
Use a non-root user with sudo privileges your Ubuntu server, the next step will be to use it in all the installation and use of Solr.
After a successful login, use the following command to upgrade your system to the latest patches and updates:
$ Sudoapt-get update
2) Install JRE
To install Solr, you first need to install the JRE (Java Runtime Environment) as the basis for environment, because solr are based on Java and tomcat. So, we need to install the latest version of Java and Java configure the local environment.
To install the latest version of Java 8, we need the following command to install the Python Software Properties Toolkit
$ Sudoapt-get install python-software-properties
Upon completion, the configuration of the latest version of Java 8 Warehouse
$ Sudo add-apt-repository ppa: webupd8team / java
Now you can update the package source list using the following command to install the latest version of Oracle Java 8 using 'apt-get'.
$ Sudoapt-get update
$ Sudoapt-get install oracle-java8-installer
During the installation and configuration process, click on the 'OK' button to accept the Java SE Platform and JavaFX for Oracle Binary Code License Agreement (Oracle Binary Code License Agreement).
After installation is complete, run the following command to check whether the installation was successful, and view the version installed.
kash @ solr: ~ $ java -version
java version "1.8.0_66"
Java (TM) SE RuntimeEnvironment (build 1.8.0_66-b17)
JavaHotSpot (TM) 64-BitServer VM (build 25.66-b17, mixed mode)
Implementation of the results shows that we have successfully installed Java, and meet the most basic requirements to install Solr, and then we carry out the next step.
There are two different ways to install Solr on Ubuntu, in this paper we only use the latest source package to demonstrate the source installation.
To use the source code to install Solr, from the first to the latest available official website to download the installation package. Copy the link below, then use 'wget' command to download.
$ Wget http://www.us.apache.org/dist/lucene/solr/5.3.1/solr-5.3.1.tgz
Run the following command to unpack the archived service to / bin directory.
$ Tar-xzf solr-5.3.1.tgz solr-5.3.1 / bin / install_solr_service.sh --strip-components = 2
Run a script to start the Solr service, which will create a solr user, and then install Solr into service.
$ Sudobash./install_solr_service.sh solr-5.3.1.tgz
Use the following command to check the status of the service Solr.
$ Service solr status
Create Solr collections:
We can now use Solr users to add multiple collections. As shown in the figure below, we only need to specify the collection name on the command line and specify the configuration set you can create more than one collection.
$ Sudosu- solr -c "/ opt / solr / bin / solr create -c myfirstcollection -n data_driven_schema_configs"
Create a collection
We have successfully created a new instance of the core catalog for our first collection, and you can add data to the inside. To view the library's default schema file, you can be found here: '/ opt / solr / server / solr / configsets / datadrivenschema_configs / conf'.
Use Solr Web
You can use the default port 8983 to connect Apache Solr. Open your browser and enter http: // your_server_ip: 8983 / solr or http://your-domain.com:8983/solr sure your firewall allows port 8983.
Web access Solr
In Solr's Web console menu on the left click on 'Core Admin' button, you will see before we use the command line to create a collection. You can click on the 'Add Core' button to create a new core.
As shown in the figure below, you can select a document to a collection point and add content to the inside or query data from the document. Add the following manner specified data format display.
"Name": "George Washington",
"Skills": "Linux and Virtualization"
After adding files click 'Submit Document' button.
to sum up
After a successful installation on Ubuntu, you can use Solr Web interface to insert or query data. If you want Solr to manage more data and files, you can create more collections. I hope you enjoyed this article and hope it can help you.