03 Apache Solr: Installation and running, apachesolr

Source: Internet
Author: User
Tags apache solr solr

03 Apache Solr: Installation and running, apachesolr
I have introduced some ideas about how to use Solr in projects and how to build highly available and scalable Solr servers. But now, let's continue to understand Solr!InstallInstall JAVAApache Solr 6.3 requires support from JRE1.8 or later versions, and is supported by both Linux and Windows platforms. I will not talk more about downloading and configuration. I will search for this information on the Internet. However, to run Solr, you must set JAVA_HOME environment variables, you can view solr under the solr-6.3.0/bin folder (Windows view solr. cmd) file with reference to the JAVA_HOME environment variable.Install SolrYou can download solr's latest version from Solr's official website http://developere.apache.org/solr/. I will use 6.3.020. For Linux/Unix/OSX systems, download the. tgzfile. For Windows systems, download the. ZIP file. After the Solr compressed file is ready, the only thing we need to do is to decompress the package to the specified folder. In Windows, you can directly operate on the graphic interface. The command in Linux is as follows:

1 $ tar zxf solr-6.3.0.tgz
Once the package is decompressed, you can run it even after it is installed. Run Start Solr ServerEnter the Solr decompression file and run the bin/solr command to start solr.
1 $ bin/solr start
In Windows, run the bin \ solr. cmd file.
1 bin\solr.cmd start
I tried it in Windows Server 2012. After running the command, the Solr runs in the background and listens to port 8983. The solr script command allows you to customize how to start Solr. Solr script optionsThe solr command has some options, which can be viewed using the-help option (the execution in Windows and Linux is exactly the same ).
1 solr.cmd -help

For example, to clarify the introduction of the start command, execute the following command:

1 solr.cmd start -help
Start Solr on the frontendSolr is a server that generally runs in the background (for example, the example above), especially in Unix/Linux systems. However, Solr can also run on the frontend. You only need to execute a simple command:
1 solr.cmd start -f
In Unix/Linux, run:
1 $ solr start -f
Specified portTo change the Solr listening port, you can use the-p Parameter at startup, for example:
1 solr.cmd start -p 8984
In Unix/Linux, run:
1 $ solr start -p 8984
Stop a Solr ServerWhen Solr is running on the front-end, you can run Ctrl + C to stop the server. However, when running in the background, you need to use the stop command. For example:
1 solr.cmd stop -p 8983
In Unix/Linux, run:
1 $ solr stop -p 8983
Note:: The stop command must specify the Solr listening port number, or use the-all parameter to replace the port number. However, all Solr instances will be stopped. For example:
1 solr.cmd stop -all
In Unix/Linux, run:
1 $ solr stop -all
Start a specified Solr built-in instanceSolr provides some useful examples to help us learn the key features of Solr. You can use the-e tag to start these instances. For example, to start a "dih" instance, you should do this:
1 solr.cmd -e dih
In Unix/Linux, run:
1 $ solr -e dih
Check Solr execution statusIf you are not sure whether Solr is being executed, you can use the status command:
1 solr.cmd status
In Unix/Linux, run:
1 solr status
This command will search for Solr instances running on your computer and collect their basic information, such as version and memory usage. If Solr is successfully started, you can view the running status on the administrator interface. The address is as follows: http: // localhost: 8983/solr/may vary with the port numbers on different machines. For example, if the Solr instance is not running, the browser reports an error that cannot be linked to the server. Create a CoreIf you have used the example configuration to start Solr, you need to create a Core for indexing and querying. You can do this by executing the following command:
1 solr.cmd create -c <name>
This command will create a Core and use the data-driven Schema. It will try to deduce the correct field category after you add the document as an index. Use the-help command to view all the command line options of the create Command. For example:
1 solr.cmd create -help
Add documentSolr was initially created to find the documents that meet the query requirements. The Solr Schema provides a way to organize the content, but nothing can be found if there is no document. Solr needs to add documents at the beginning of use. You need to add some sample documents before trying to index the content. After Solr is installed, it comes with different types of sample documents, which are saved in the example/subfolder under the Solr installation folder. The post tool is available in the bin folder to index command line tools for different types of documents. In the example/exampledocs folder, there is a port. jar file, which is a post tool in Windows. You can run the-help command to view the post usage.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.