SOLR is an enterprise search server that provides external Web-service interfaces that allow users to submit XML or JSON-formatted data to search engines via HTTP requests, which can then be found via an HTTP GET request. Gets the data returned in various formats, such as XML or JSON.
First go to the official website to download SOLR installation package, the URL is: https://lucene.apache.org/solr/enter after clicking the Download button in the navigation bar, wait a few seconds the page will automatically jump to the mirror selection page, select the appropriate server, For example, at this point my final URL is: HTTP://MIRROR.BIT.EDU.CN/APACHE/LUCENE/SOLR/5.4.1/ Of course we want to download the other version of the 5.1.4 directory directly removed, access to the previous level, this time you can choose the appropriate version, I choose the version of Solr 5.2.1, here i download solr-5.2.1.tgz installation package
Download after the upload to the server specified directory, the premise of the installation of SOLR is must be configured zookeeper, of course, including a series of host name network configuration, etc., in the configuration of the premise of zookeeper, in addition to shut down the firewall, must be 3 machines are first started zookeeper services, Here are three hosts: HADOOPHA,HADOOP1,HADOOP2
Once you are ready, you can start the installation, enter the directory where the SOLR installation package is located, and execute the command extraction installation script:
tar xzf solr-5.2. 1. tgz solr-5.2. 1/bin/install_solr_service. sh --strip-components=2
Start the installation after releasing the script
./install_solr_service. sh solr-5.2. 1 8983
Where the meaning of the parameter-I represents the installed directory, the default is/opt;-d specifies the SOLR write file directory, including index, log, initial configuration, etc., by default/var/solr;-u the Solr file and the user to which the process belongs, the default is SOLR, The script automatically creates the SOLR account during installation, and the-s specifies the name of the system service to be created, and the default is SOLR, which is/ETC/INIT.D/SOLR can be started with service;-p specifies that the listener port for the service defaults to 8983. You can see that the parameters specified above are default, so the installation command can be equivalent to:
./install_solr_service. sh solr-5.2. 1. tgz
Wait for the installation to start automatically, then modify the configuration file
VIM/VAR/SOLR/SOLR. in. SH
Solr_java_mem before the #, the default is: solr_java_mem= "-xms512m-xmx512m", this according to their own computer hardware configuration settings, I here virtual machine memory is 1G, so here the direct default 512m is not modified.
Then the same way to configure zk_host= "hadoopha:2181,hadoop1:2181,hadoop2:2181" is specified here is a list of all nodes zookeeper, separated by commas
Then configure solr_host= "Hadoopha"
According to the above comment explanation, you can know that when the single-machine test using localhost, the production environment should use the name of the cluster, so here should configure the host name of the machine, the other two nodes should be filled HADOOP1, HADOOP2
The configuration is done here, save the exit, and then use the command:/ETC/INIT.D/SOLR restart start SOLR
Then the other two nodes are configured identically and eventually start up
Next, test the new collection, enter any of the hosts, and execute the following command, respectively:
$ cd/opt/solr/server/scripts/cloud-scripts$. /zkcli. sh -zkhost localhost:2181 -cmd upconfig-confdir/opt/solr/server/solr/configsets/sample_ Techproducts_configs/conf-confname Test
Perform the upload configuration operation, and then create a new collection:
" http://192.168.1.42:8983/solr/admin/collections?action=create&name=test&numshards=3& Replicationfactor=3&maxshardspernode=3&collection.configname=test"
or directly with the browser to access the URL above the establishment of a test collection, a few nodes can be created between a copy for simultaneous retrieval, can be accessed through the browser HTTP://192.168.1.42:8983/SOLR click cloud- >graph can see the distribution of nodes
Here SOLR cluster is configured, can be used in a variety of ways to add index to search and so on more API can refer to the official wiki:http://wiki.apache.org/solr/
Solrcloud Environment Configuration