Foreword
Apache Solr is an open source search engine. It helps in a quick and responsive access to a large library.
Why Solr?
With the new technology of the big data market, we came up with many new languages. Use Solr, no new language.
- Simply enter the text and look forward to answers
- Solr query internal data, without actually writing queries, just write simple text naturally. And then converted to a query and drive results.
- Solr using the search option set multiple databases.
- The index at the back end is completely controlled by the developer, the client uses only front-end dashboard perform text queries.
工欲善其事必先利其器, let's look at how to install solr on centos.
installation steps
First, the update system
Centos software system some updates or upgrades to time during installation can quickly find the installation package.
sudo yum install epel-release -y sudo yum update -y
Second, the installation jdk
Jdk installed in two ways, a way to install oracle jdk have to download the installation package, the second way without having to download the installation package, execute the command directly to complete the installation, the installation is openjdk.
(1) installation of a first embodiment jdk
First to Oracle official website to download jdk, jdk download address is: https://www.oracle.com/java/technologies/javase/javase-jdk8-downloads.html uploaded to the centos After the download, and then perform a local installation jdk.
After the download is complete upload centos, then enter the following command to install it.
sudo yum -y localinstall jdk-8u241-linux-x64.rpm
After the installation is complete, then check the jdk is installed successfully.
(2) A second embodiment of the installation jdk
Use the following manner was installed, do not download the installation package, enter the command directly in centos to complete the installation. Enter the command is:
sudo yum install -y java-1.8.0-openjdk
After the installation is complete, check whether the installation was successful.
java -version
Since the implementation of solr need to configure jdk environment variable, then let's look at how to configure jdk variables.
Third, configure the Java environment variables
How to configure Java variables? First we have to check if species are Java environment variables.
echo $JAVA_HOME
Configuration is not checked, then we configure the environment variable, the installation path jdk find, this path is assigned to JAVA_HOME, written to the .bash_profile in the user's home directory or into / etc / profile in. To be configured by the following command.
echo "JAVA_HOME=$(readlink -f /usr/bin/java | sed "s:bin/java::")" | sudo tee -a /etc/profile
Then let the configuration file to take effect.
source /etc/profile
Once configured, it is next solr installation.
Fourth, the installation Solr
Solr solr downloaded from the official website of the binary installation package, download address is: https: //mirrors.tuna.tsinghua.edu.cn/apache/lucene/solr/8.5.0/solr-8.5.0.tgz, after downloaded decompress.
wget https://mirrors.tuna.tsinghua.edu.cn/apache/lucene/solr/8.5.0/solr-8.5.0.tgz
Then extract the compressed file to install the package solr installation script.
tar xzf solr-8.5.0.tgz solr-8.5.0/bin/install_solr_service.sh --strip-components=2
After extracting the script, it is next solr installation with the script.
sudo ./install_solr_service.sh solr-8.5.0.tgz
Then to start off solr stopped by the command.
sudo service solr stop sudo service solr start sudo service solr status
或者
# systemctl stop solr # systemctl start solr # systemctl restart solr # systemctl status solr
Verify solr, whether to start successfully, the following create a collection by solr. Here solr must first create a user password to execute.
su - solr -c "/opt/solr/bin/solr create -c mycol1 -n data_driven_schema_configs"
Finally, open ports, can be accessed via the Internet.
sudo firewall-cmd --zone=public --permanent --add-port=8983/tcp sudo firewall-cmd --reload
Then visit a page in a browser enter the address, access address is http: // server ip address: 8983.
By the above steps, solr installation.