SOLR cluster construction under Linux cluster

Source: Internet
Author: User
Tags solr zookeeper

First introduce the system architecture:

* This figure represents three SOLR instances, each of which consists of two cores, forming a solrcloud

* The index set consists of two shard (Shard1 and Shard2), Shard1 and Shard2 are composed of three cores, one L eader two Replication,leader are elected by zookeeper, The zookeeper controls the consistent index data on each of the three cores on each shard, addressing high availability and high concurrency issues.

* Collection is an index structure in the Solrcloud cluster, which is divided into one or more shard (shards), the same configuration is used before Shard, for example, a product information search can create a collection,collection=shard1 +shard2+.....+shardx

* Core provides indexing and search services, one shard needs to consist of one or more cores, since collection consists of multiple Shard, so collection is typically made up of multiple cores

* Master is the primary node in the Master-slave structure (usually the primary server), slave is the slave node in the Master-slave structure (usually from the server or the standby server). The data stored by master and slave under the same shard is consistent for high-availability purposes.

The following diagram is the SOLR cluster architecture to be built next

Need to implement zookeeper high availability. Need to build a cluster. The recommendation is an odd number of nodes. Requires three zookeeper servers.

7 servers are required to build the SOLR cluster.

Build pseudo-distributed: requires three zookeeper nodes and requires four Tomcat nodes.

Environment Preparation:

1.JDK

2.tomcat

3.zookeeper

4.solr

Let's start with the detailed steps of the cluster

This omits the installation of the JDK, tomcat,solr,zookeeper the decompression

* Copy three copies of zookeeper extracted files to/usr/local/solr-cloud

* Create a data directory under each zookeeper

* Create a myID file in each zookeeper data directory with the ID of each instance, respectively 1,2.3

* Rename the Zoo_sample.cfg file under the Conf directory to zoo.cfg

* Modify ZOO.CFG configuration file

DataDir points to the current zookeeper data directory

ClientPort ensure that there is no conflict between zookeeper

The last server.1=xxx place is the ID of the created myID file.

* Create a quick start mode called start-zookeeper-all.sh, start each zookeeper

To modify the permissions of a startup file before starting

* Create four Tomcat instances with each tomcat running on a different port: 8180, 8280, 8380, 8480

Modify the port number of Tomcat

Modify the port number (altogether three places)

Every tomcat has to be changed.

* Deploy SOLR's war package to each Tomcat WebApps below (I use SOLR's folder, the Solr.war file extracted after tomcat boot)

Create a Solrhome,solrhome source reference for each SOLR instance (Linux deployment Solr)

* Link the solrhome.

Modify the Solr.xml file inside the Solrhome

Host represents the current node

Hostpart represents the port number of the solrhome corresponding Tomcat

* Associate each of SOLR and Solrhome

Modify the Web. XML within each Tomcat under SOLR project

Associating a Solrhome

*zookeeper centrally manage profiles, so this step is to upload the configuration file

Enter the extracted solr.tar.gz folder to locate the zkcli.sh file

Uploading a configuration file using tools

Execute the following command:

./zkcli.sh-zkhost 192.168.25.133:2181,192.168.25.133:2182,192.168.25.133:2183-cmd upconfig-confdir/usr/local/ Solr-cloud/solrhome01/collection1/conf-confname myconf

Then in the Zookeeper01 inside the bin directory has zkcli.sh file, start this file, enter a command to see

That's the file we just uploaded.

* Next related to the relationship between SOLR and zookeeper

Modify the catalina.sh below tomcat01

To join the initialization configuration:

All four tomcat have to be added.

* Start this four Tomcat to ensure that the zookeeper cluster is in the boot state

Write a program that launches Tomcat

Modify Query Permissions

To start Tomcat:

Accessing the error in the browser:

HTTP Status 503-server is shutting down or failed to initialize

It is found that the initialization parameter configuration in the catalina.sh error,

Modify:

Java_opts= "-dzkhost=192.168.25.133:2181,192.168.25.133:2182,192.168.25.133:2183"

Reboot, Access:

Seeing this means half the success.

Because Collection1 is monolithic, there is no high-usability we say, so delete this and create a new collection for Shard processing.

http://192.168.25.133:8180/solr/admin/collections?action=create&name=collection2&numshards=2& replicationfactor=2

11th Step: Delete the unused collection.

Http://192.168.25.133:8180/solr/admin/collections?action=DELETE&name=collection1

This is not deleted before

That means success.

SOLR cluster construction under Linux cluster

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.