Solr (6) Cluster and solr Cluster

Source: Internet
Author: User
Tags solr

Solr (6) Cluster and solr Cluster
Preface

As the number of users increases, the amount of space and concurrency increases, leading to the failure of a solr server. At this time, the solr cluster must be under.

Cluster Architecture

 

Indexing and searching tasks are performed by multiple servers.

The solution is to split the index data by shard (sharding). Each shard is completed by multiple servers.

When an index or search request comes, the index is operated on different shard servers.

SolrCloud requires solr to be deployed based on zookeeper. zookeeper is a cluster management software. solrCloud must be composed of multiple servers. Zookeeper is used for coordinated management. Multiple shards are added to the same index database.

 

Zookeeper cluster:

See zookeeper Cluster

Solr cluster Construction

1. Copy tomcat and solrhome

Create a folder named solr-cloud. Copy tomcat and solrhome from solr single-host to the solr-cloud folder.

 

Ii. tomcat Modification

1. Port Modification

In the solr-cloud folder, run the following command:

Vim./tomcat1/conf/server. xml

Query and modify the three ports:

1 ).

2 ).

3 ).

Modify the second value of the port to the corresponding value for other tomcat servers,

For example: 8280/8209/8309/8305/8409/8405/, 8480.

2. modify web. xml

Modify the webapps/solr/WEB-INF/web. xml file separately-associate solrhome with solr

<env-entry>       <env-entry-name>solr/home</env-entry-name>       <env-entry-value>/usr/java/solr-cloud/solrhome1</env-entry-value>       <env-entry-type>java.lang.String</env-entry-type></env-entry>

Tomcat2->/usr/java/solr-cloud/solrhome2

Tomcat3->/usr/java/solr-cloud/solrhome3

Tomcat4->/usr/java/solr-cloud/solrhome4

3. Modify catalina. sh

Modify JAVA_OPTS to associate tomcat with zookeeper.

Modify tomcat/bin/catalina. sh files respectively

Join:

JAVA_OPTS="-DzkHost=192.168.0.102:2181,192.168.0.102:2182,192.168.0.102:2183"

 

3. solrhome Modification

1. Modify the solr. xml file under solrhome1

Host is the ip address of the computer deployed at tomcat1, and hostport is the port number modified after tomcat1.

Solrhome2 (192.168.0.102, 8280)

Solrhome3 (192.168.0.102, 8380)

Solrhome4 (192.168.0.102, 8480)

 

2. Upload the solrhome/core1/conf directory

Upload the conf directory to zookeeper and the configuration file is managed by zookeeper. You only need to upload the configurations in any solrhome.

Switch to the solr decompressed Directory:/usr/java/solr/solr-6.6.2/server/scripts/cloud-scripts

Run the following command:

./zkcli.sh -zkhost 192.168.0.102:2181,192.168.0.102:2182,192.168.0.102:2183 -cmd upconfig -confdir /usr/java/solr-cloud/solrhome1/core1/conf -confname myconf

After executing this command, you can go to the zookeeper directory to verify whether the command is successful.

Run the./zkCli. sh command in the zookeeper1/bin directory to view the configuration file information on zookeeper.

 

4. start tomcat

Create a file to start tomcat with one click.

Vim start-tomcat.sh.

Modify file permissions

Chmod u + x start-tomcat.sh

Then execute the./start-tomcat.sh command.

It cannot be seen from here whether it is true or not. You can view logs or access logs.

Tail-f/usr/java/solr-cloud/tomcat1/logs/catalina. out

OK. Now you can see the page. Open http: // localhost: 8180/solr/index.html #/in the browser #/

A cloud directory is added to the menu.

 

5. multipart

http://127.0.0.1:8180/solr/admin/collections?action=CREATE&name=core2&numShards=2&replicationFactor=2

Directly access the above address in the browser.

If the org. apache. solr. handler. dataimport. DataImportHandler error is reported, copy the jar package of dataimport to tomcat/webapps/solr/WEB-INF/lib.

At this time, refresh the solr/index.html page.

You will find that there is another core in core1 and it is sharded. There was only one primary solr, and now there are two primary solr.

We don't need core1 now. We can delete it. How can we delete it?

http://127.0.0.1:8180/solr/admin/collections?action=DELETE&name=core1

It is also directly accessed through a browser.

Let's take a look at the index.html page.

 

Core1 is deleted.

 

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.