Zookeeper cluster,
Preface
When the solr data volume is small and the concurrency is small, one solr server is sufficient to cope with it. If the solr data volume is large and the concurrency is large, one solr cannot cope with it, whether to cluster solr. The zookeeper cluster must be implemented first, because zookeeper serves as the configuration information center of the solr cluster.
Cluster Introduction
The zookeeper Cluster also has a voting mechanism. The difference is that it does not vote for whether other servers are suspended, but decides who is the master server and who is the slave server. Therefore, it is best to use an odd number of computers in a cluster. I don't have multiple computers, so I can only create a pseudo cluster here.
Zookeeper Cluster
I. decompress and copy three identical directory files
2. modify the configuration information in each folder
1.Create a data folder and assign the id
Switch to the zookeeper1 folder and run the Add folder command.
mkdir data
Then you need to assign an id to this zookeeper.
Run the following command:
echo 1 >./data/myid
You can use
Cat./data/myid command for verification
Zookeeper2 and zookeeper3 are modified in the same way. The difference is that different values need to be assigned to the myid. For example:
The myid of zookeeper2 is assigned 2, and the myid of zookeeper3 is assigned 3.
2.Configuration Modification
Zookeeper1:
1-> respective data file directories
2-> the port number. zookeeper1 can be left unchanged. zookeeper2 and zookeeper3 must be changed to 2182,2183.
3-> zookeeper Server ip address in the cluster. Here, zookeeper2 and zookeeper3 only need to be copied.
Note that the ip address here has two port numbers.
The first port number is used for zookeeper communication.
The second port number is used for zookeeper voting.
Iii. Start
1.One-click Start
Before starting, create a startup text to avoid manual start.
In the solr-cloud directory, run
root@wubi:/usr/java/solr-cloud# vim start-up.sh
Copy the following parts
cd /usr/java/solr-cloud/zookeeper1/bin./zkServer.sh startcd ../../zookeeper2/bin./zkServer.sh startcd ../../zookeeper3/bin./zkServer.sh start
Modify the permission of this file:
root@wubi:/usr/java/solr-cloud# chmod u+x start-up.sh
2.Start
3.Verify
You can run the following command to check which zookeeper is the master and which one is the slave.
Here we can see that zookeeper2 is the master, and others are the slave.