The preparatory work

  1. We need to download the versions of Solr and ZooKeeper from the website in advance. Here I choose Solr 7.72 and ZooKeeper version 3.4.14
  2. Upload the tar file we downloaded to the server and unzip it
  3. Since Solr depends on the JDK, we installed the corresponding JDK on the server, and I chose JDK 1.8 here

Install the ZooKeeper cluster

First, we set up a ZooKeeper cluster on three servers.

/usr/local/ ZooKeeper -3.4.14/log =/usr/local/ ZooKeeper -3.4.14/log =/usr/local/ ZooKeeper -3.4.14/log =/usr/local/ ZooKeeper -3.4.14/log Which the clients will connect ClientPort =2181 Server.1 = Server.2 = 2.2.2:2888:3888 Server. 3 =

Set up the same configuration on each of the three servers, which is in the conf folder after unzipping ZooKeeper. At the same time, we create the data folder in the specified dataDir directory, in the folder, create the myid file, according to the current server IP and we wrote in the configuration file server.x, fill the corresponding number into the myid file, save. Then start three ZooKeepers in turn.

After successful startup, we execute status

You can see the status of the corresponding server, ZooKeeper, and whether it is the leader node. If the above figure appears, the ZooKeeper cluster is successfully built

Install the Solr cluster

For the installation of the Solr cluster, we adopt the Jetty approach provided by Solr. We first uploaded the downloaded Solr packages to our corresponding three ZooKeeper servers.

We need to modify the solr package in this

The configuration contents are as follows:

  1. The size of the JVM used by Solr
  2. The GC related
  3. ZooKeeper’s cluster address
  4. The Intranet IP of the Solr node
  5. Whether JMX remoting is allowed
  6. Solr port

Next we start to create the configuration for the collection we need: fields, word splitters, dictionaries, and so on

/ usr/local/solr – 7.7.2 / server/solr/configsets

Assuming our Solr is installed in the above directory, we upload the Collection configuration file we need to create to one of the three nodes. It doesn’t really matter where the location is, because the actual location of our configuration file is in the ZooKeeper repository.

The files we uploaded are as follows:

The main configuration of the field and the field type, whether the storage, word splitter are in

managed-schemaFile storage, detailed configuration can open the file to see the comments.

In the/usr/local/solr – 7.7.2 / server/solr/configsets _default/conf with the default configuration file

Once configured, we need to use a command to upload the folder to the ZooKeeper repository

Solr zk upconfig -d/usr/local/solr - 7.7.2 / server/solr/configsets search_all/conf / -n search_all - z,2.2. 2.2:2181,3.3. 3.3:2181

Then start the three Solr nodes

At this point, the Solr cluster is complete