SolrCloud-5.2.1 cluster deployment and Testing
I. Description
Solr5 has built-in Jetty service, so you do not need to install and deploy Tomcat. The information on deploying Tomcat on the internet is too extensive.
Preparations before deployment:
1. Configure the IP addresses of each host as static IP addresses (ensure that each host can communicate normally. To avoid excessive network transmission, we recommend that you use the same network segment ).
2. Modify the host name, configure host ing, modify the hosts file, and add the IP ing between the IP address and host name of each host.
3. Open the corresponding port or directly close the firewall.
4. Ensure that the Zookeeper cluster service runs properly. Zookeeper deployment reference: http://www.cnblogs.com/wxisme/p/5178211.html
5. root permission
6. Descriptions of related parameters and components:
Collection: A complete index in the logic sense of the SolrCloud cluster. It is often divided into one or more Shard, and they use the same Config Set. If there is more than one Shard, It is a distributed index. SolrCloud allows you to reference it by Collection name without worrying about the Shard-related parameters required for Distributed Retrieval.
Core: that is, Solr Core. A Solr contains one or more Solr cores. Each Solr Core can independently provide the index and query functions. Each Solr Core corresponds to one index or Collection Shard, solr Core is proposed to increase management flexibility and share resources. The difference in SolrCloud is that it uses the configuration in Zookeeper, and the traditional Solr core configuration file is in the configuration directory on the disk.
Leader: the Shard replicas that won the election. Each Shard has multiple Replicas. These Replicas need to be elected to determine a Leader. Elections can occur at any time, but they are usually triggered only when a Solr instance fails. When you index events, SolrCloud will pass the corresponding leaders to the Shard, and the leaders will then distribute them to all Shard replicas.
Replica: a copy of Shard. Each Replica exists in a Solr Core. A collection named "test" is created with numShards = 1 and the replicationFactor is set to 2. Two replicas are generated, that is, two cores are generated, each instance is on a different machine or Solr instance. One is named test_shard1_replica1, and the other is named test_shard1_replica2. One of them will be elected as the Leader.
Shard: the logical part of the Collection. Each Shard is converted into one or more replicas, and the Leader is determined by election.
Ii. Installation Process
1. Go to Apache official website to download the Solr-5.2.1 installation package
2. Go to the Solr file directory and run the following command to extract the installation script from the package:
Tar-xvzf solr-5.2.1.tgz solr-5.2.1/bin/install_solr_service.sh -- strip-components = 2
3. Run the installation script
Run the following command to install Solr:
./Install_solr_service.sh solr-5.2.1.tgz-I/usr/solr/solr5-d/usr/solr/solr5-u solr-s solr-p 8983
Alternatively, run the following command to install the SDK by default:
./Install_solr_service.sh solr-5.2.1.tgz
In fact, you can also directly decompress the installation package and then customize the configuration.
4. modify configuration
Run the following command to edit the solr. in. sh file:
Vim/usr/solr5/solr. in. sh
Modify as follows:
SOLR_JAVA_MEM = "-Xms1G-Xmx1G"
ZK_HOST = "node1: 2181, node2: 2181, node3: 2181/solr"
The memory limit can be set as needed.
5. perform installation on other nodes according to the above steps
Iii. Start and verify Solr Service
1. Run the following command on each node of the Solr cluster to start the Solr service:
Service solr start
2. View Solr status
Service solr status
3. log on to Solr UI
Http: // node1: 8983/solr
Iv. Test Solr
Solr provides several common operations, such as Shell commands, REST APIs, and SolrJ interfaces. The following operations show how to use Shell commands for ease.
1. Open and edit the schema. xml file under server/solr/configsets/sample_techproducts_configs/conf, and add a field at the end of the file.
2. Create a collection and upload the associated configuration file to Zookeeper.
./Bin/solr create_collection-c students-d server/solr/configsets/sample_techproducts_configs/conf-shards 3-replicationFactor 3
To update the configuration file to Zookeeper in the future, run the following command to update all configurations:
. /Server/scripts/cloud-scripts/zkcli. sh-zkhost node2: 2181, node1: 2181, node3: 2181-cmd upconfig-confname students-confdir server/solr/configsets/sample_techproducts_configs/conf
If only one file is updated, run the putfile command:
. /Server/scripts/cloud-scripts/zkcli. sh-zkhost node2: 2181, node1: 2181, node3: 2181-cmd putfile/solr/configs/students/schema. xml/usr/tempfiles/schema. xml
The former is the storage path of the configuration file in Zookeeper, and the latter is the local path of the configuration file. Note that if the file in Zookeeper exists, you need to delete it first and then upload and update it. You can log on to Zookeeper to perform the following operations:
ZK_HOME/./bin/zkCli. sh-timeout 5000-server node3: 2181
After logging on to Zookeeper, you can use the command to delete the configuration file and perform other operations. If you are not clear about the position of the configuration file in Zookeeper, you can also view it.
3. Check whether collection is successfully created. Refresh the page in Solr UI. Click Cloud. If Collection is successfully created, the Solr cluster topology is displayed.
You can also check whether the defined schema. xml has taken effect.
4. Add indexes to query data
1. You can use the preceding methods to add index data. For simplicity, use Solr UI to add simple index data for testing.
Click Submit to return a successful message:
2. query Test
After the test, you can delete the Collection.
Http: // node1: 8983/solr/admin/collections? Action = DELETE & name = students
Now the deployment and simple test of Solr are complete. Next, you can thoroughly learn the working principle, data structure definition, configuration, and query of Solr.
References: Solr official documentation
Solr3.6.1 build an environment in Tomcat6
Tomcat-based Solr3.5 cluster deployment
Load Balancing for Solr clusters using Nginx on Linux
Install and use Solr in Linux
Deploy Solr 4 on Ubuntu 12.04 LTS through Tomcat
Solr implements Low Level query parsing (QParser)
Build a search Server Based on Solr 3.5
Solr 3.5 development and application tutorial PDF
Solr 4.0 deployment instance tutorial
Solr details: click here
Solr: click here
This article permanently updates the link address: