Unlike testing and research, it needs to be installed as a service if it is to be deployed as a product of SOLR. There is a script install_solr_service.sh under the bin directory in the SOLR compression package, which is responsible for the installation of SOLR and is registered as a self-initiated service.
Directory Planning:Dynamic Files: It is recommended to put the dynamic file (log, index file) separately in another directory (such as/Var), different from the SOLR installation directory, to facilitate management and later upgrade. The default is/VAR/SOLR, and if you need to change it, you can specify a different directory with the "-D" parameter during installation.Installation Path: Using a script installation, the default installation directory is/opt. If you need to change another directory, you can use the "-i" parameter, such as "-i/opt/app". In addition, the installation script automatically creates a soft connection:/OPT/SOLR,/opt/solr-5.2.1. The use of soft connections makes it easy to access later after upgrade.
Linux Users:By default, the installation script automatically creates a user named SOLR. You can also use the "-u" parameter to specify a user name yourself. The installation script will set the owner of the installation-related directory (/OPT/SOLR and VAR/SOLR) to this user.
To
download a compressed package:Official website: http://lucene.apache.org/solr/
wget Download:# wget Http://mirror.bit.edu.cn/apache/lucene/solr/5.2.1/solr-5.2.1.tgz
Unzip the installation script:# tar Xzf solr-5.2.1.tgz solr-5.2.1/bin/install_solr_service.sh--strip-components=2
Run the installation script (requires root account):
default installation:#./install_solr_service.sh solr-5.2.1.tgz
custom (with parameter) installation:#./install_solr_service.sh solr-5.2.1.tgz-i/opt-d/var/solr-u solr-ssolr-p 8983
Installation Parameters:
- -d Dynamic file directory, default to "/VAR/SOLR"
- -I SOLR pressurized installation directory, default to "/opt"
- -P work/Listen port, default = "8983"
- -S is installed as the name of the Linus service, which defaults to "SOLR"
- -U runs the SOLR user name, which is automatically created if the user does not exist, and the default is "SOLR"
to view all installation parameters:#./install_solr_service.sh-help
Suppose you need to install to the "/opt/app" directory:#./install_solr_service.sh Solr-5.2.1.tgz-i/opt/app
The results are as follows:Id:solr:no such usercreating new user:solrextracting solr-5.2.1.tgz TO/OPT/APPCREATING/ETC/INIT.D/SOLR script ...
Started SOLR Server on port 8983 (pid=18066). Happy searching!
Found 1 SOLR nodes:
SOLR process 18066 running on port 8983{"Solr_home": "/var/solr/data/", "Version": "5.2.1 1684708-shalin-2015-06-10 2 3:20:13 "," StartTime ":" 2015-08-27t04:02:34.071z "," uptime ":" 0 days, 0 hours, 0 minutes, 5 Seconds "," Memory ":" 38.5 MB ( %7.8) of 490.7 MB "}
Service SOLR installed.
to view the generated directory:# ls-l/opt/app can see two new things: SOLR,/opt/app/solr-5.2.1 solr-5.2.1
# Ls-l/var can see a new stuffSOLR
To
view the SOLR service status:# Service SOLR Status
Found 1 SOLR nodes:
SOLR process 18066 running on port 8983{"Solr_home": "/var/solr/data/", "Version": "5.2.1 1684708-shalin-2015-06-10 2 3:20:13 "," StartTime ":" 2015-08-27t04:02:34.071z "," uptime ":" 0 days, 0 hours, 2 minutes, seconds "," Memory ":"% MB (% 9.4) of 490.7 MB "}
The instructions have been successfully installed and started!
Related concepts and configurations:
- SOLR Home: Solr Find the Solr.xml and manage the path to the index file, which contains at least one solr.xml file. Default is/var/solr/data
- Include File : Files that define environment variables uniformly, default location:/var/solr/solr.in.sh. Includes at least the top two configurations below:
- SOLR_PID_DIR=/VAR/SOLR
- SOLR_ Home=/var/solr/data
- solr_java_mem="-xms512m-xmx512m "(Configuring Memsize of the JVM)
- ZK_HOST=zk1,zk2, ZK3 (Solrcloud case, configure zookeeper information. If this is configured, it means that the boot mode is Solrcloud. )
- Log Configuration : Solr uses log4j, configuration file location:/var/solr/log4j.properties. Log file default location:/var/solr/logs/solr.log
- init.d Script : A service-related script is stored in the/ETC/INIT.D directory. The Solr file, which defines the SOLR service (start|stop|restart|status), also defines some environment variables and users (runas variables):
- Solr_install_dir=/opt/solr
- solr_env=/var/solr/solr.in.sh
- Runas=solr
- Out-of-memory processing configuration: SOLR defaults to using the bin/oom_solr.sh script to handle the JVM's out-of-memory condition, the default is to kill the process. If the process is killed in Solrcloud mode, zookeeper will know and handle it accordingly.
when you need to start two SOLR service/node on a server:Execute the installation script again and specify a different service name and port number, for example: #./install_solr_service.sh solr-5.2.1.tgz-s solr2-p 8984 View service Status: # Service SOLR2 Status
Copyright NOTICE: This article is the original article, reprint please indicate the CSDN blog which is transferred from Clement-xu.
SOLR's product installation in Linux systems