What is Solrcloud?
Refer to the Solrcloud official website to introduce http://lucene.apache.org/solr/guide/6_6/solrcloud.html
Apache SOLR can set up SOLR clusters with fault-tolerant and high-availability capabilities, this is called Solrcloud, which provides distributed indexing and search, supports the following features:
Centralized Central configuration
Automatic load balancing and failover
Zookeeper integration for cluster coordination and configuration.
Solrcloud is a flexible distributed search and indexing, without the primary node assigning nodes, shards, and replicas. Instead, SOLR uses zookeeper to manage these locations, depending on the configuration file and schema. queries and updates can be sent to any server. SOLR will use the information in the Zookeeper database to determine which servers need to process the request.
Solrcloud structure diagram
Zookeeper is required because of centralized configuration and coordination.
Zookeeper cluster installation
Install 3 ZK servers to do cluster localhost:2181,localhost:2182,localhost:2183.
install ZK, reference http://www.cnblogs.com/yangzhenlong/p/8270835.html
After installation, start 3 ZK.
Solrcloud Installation
Download SOLR http://mirrors.shu.edu.cn/apache/lucene/solr/
Unzip after download, name solr-1, enter \solr-1\bin directory
Need to do 3 operations
1. Configuring the Zookeeper Service
Modify Solr.in.cmd
REM set zk_host= is replaced by (here is the Zookeeper service address: port, separated by commas)
Set Zk_host=localhost:2181, localhost:2182, localhost:2183
REM set zk_client_timeout=15000 replaced by
Set zk_client_timeout=15000
2. Configure the SOLR port
Modify Solr.cmd, edit files, search solr_port=8983
Change Port to 8981
When you are done editing, copy the Solr-1 folder 3 points, named Solr-2,solr-3,solr-4
then modify the corresponding Solr.cmd file separately, set the port to 8982,8983,,8984
3. Upload SOLR's core configuration to zookeeper
Because ZK is required to govern SOLR in a unified governance, ZK is required to manage SOLR's configuration information.
Enter the \solr-1\server\scripts\cloud-scripts directory and see the client instruction file with ZK
Now you need to upload all the configuration in the \solr-1\server\solr\configsets\basic_configs\conf to the ZK service and execute the command:
Zkcli.bat-zkhost zk1:port,zk2:port-cmd upconfig-confdir SOLR conf directory-confname solrconf
For example:
Zkcli.bat-zkhost localhost:2181, localhost:2182, localhost:2183 -cmd upconfig-confdir d:\ develop-env\solr-cluster\solr-1\server\solr\configsets\basic_configs\conf-confname solrconf
After uploading, see if it is successful, connect to any ZK server with ZK client, view root path
Zkcli.cmd-server localhost:2181
LS/
Ls/configs
If we have the solrconf named above, the upload is successful.
Start SOLR
After Setup, use CMD to enter the bin directory of Solr-1, execute the command, then enter Solr-2/bin solr-3/bin Solr-4/bin respectively, and execute the following command as well:
SOLR start
Then access address http://localhost:8981/(or 8982 8983 8984)
Create SOLR Core
Create a new core, in the config set option, you can see the uploaded SOLR configuration
Select solrconf Configuration, numshards and replicationfact are filled 4, add Add button, will prompt error:
The last sentence says you need to 4*4=16 a shard, exceeding the allowable value. The rule is the number of Numshards * replicationfact number of <= Solrcloud in the SOLR service
Numshards and replicationfact are filled in 1 1 to create Core1
Numshards and Replicationfact are filled in 4 1 to create Core1
Numshards and replicationfact are filled in 1 4 to create Core1
Numshards and replicationfact are filled in 2 2 to create Core1
Then look at the Cloud
The black chosen is the leader elected by ZK.
Access to other SOLR, the same effect
SOLR cluster Solrcloud (solr+zookeeper) Windows build