In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-18 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/01 Report--
This article will explain in detail how to build windows solrcloud pseudo-distribution for you. The editor thinks it is very practical, so I share it with you as a reference. I hope you can get something after reading this article.
I. Overview
Windows solrcloud pseudo-distribution has been installed several times in recent months, referring to other blogs, which I have summed up myself, including some notes and some wrong solutions.
II. Environment
System: windows server 2008 64-bit
Software: jdk-7u80-windows-x64, apache-tomcat-7.0.70, solr-4.10.3, zookeeper-3.4.6
Note: different versions of solr have different configurations.
III. Deployment steps
One server deploys 3 nodes.
3.1standalone Tomcat+Solr
Step 1: create the solrCloud directory under the root directory of the D disk. Extract the apache-tomcat-7.0.70.tar.gz to the SolrCloud directory and rename it to tomcat-server_1. Extract the solr-4.10.3.zip and copy the solr folder in the solr-4.10.3/example/solr directory to the SolrCloud directory and rename it solr_home_1. As shown below:
Step 2: copy solr-4.10.3\ example\ webapps\ solr.war to the tomcat-server_1/webapps directory.
Step 3: modify the catalina.bat file in the D:\ solrCloud\ tomcat-server_1\ bin directory and add the startup parameters of tomcat, which are as follows:
Set JAVA_OPTS=-Dsolr.solr.home=D:/SolrCloud/solr_home_1
The second way to configure solr/home is in D:\ SolrCloud\ tomcat-server_1\ webapps\ solr\ WEB-INF\ web.xml:
Solr/home
D:\\ SolrCloud\\ solr_home_1
Java.lang.String
There are actually three ways to set up solr/home: 1, set it in the web.xml of solr, attach parameters when tomcat starts, and the method of this article.
In the second method, you must start tomcat first, and then decompress solr.war before you can find solr\ WEB-INF.
Step 4: if the solr version is less than 4.3, the stand-alone solr version can be started at this time, but we are 4.10.3. Start tomcat-server_1 and find that there will be an error. At this point, you will find that D:\ SolrCloud\ tomcat-server_1\ webapps\ solr.war has been extracted into the solr file directory. You can delete D:\ SolrCloud\ tomcat-server_1\ webapps\ solr.war here or not, which I recommend.
Step 5: copy all jar packages under solr-4.10.3\ solr-4.10.3\ example\ lib\ ext to the D:\ SolrCloud\ tomcat-server_1\ webapps\ solr\ WEB-INF\ lib directory
Step 6: create the classes directory in D:\ SolrCloud\ tomcat-server_1\ webapps\ solr\ WEB-INF, copy the log4j.properties file in the\ solr-4.10.3\ example\ resources directory to the classes file you just created, and modify line 16:
Log4j.appender.file.File=../solr_logs/solr.log
Note: the log path is self-defined.
Step 7: start tomcat and type: http://localhost:8080/solr/ in the browser to verify that the configuration is successful. If the configuration is successful, the browser page is as follows:
3.2 configure multiple Tomcat+solr to run at the same time
Step 1: make two copies of tomcat-server_1, name it tomcat-server_2,tomcat-server_3;, copy two copies of solr_home_1, and name it solr_home_2,solr_home_3. The catalogue is as follows:
Step 2: in order for three tomcat to start on one machine at the same time, you need to modify the port information of tomcat, that is, modify the parameters whose location is in D:\ solrCloud\ tomcat-server_*\ conf\ server.xml. The modification scheme is as follows:
Shutdown portHTTP/1.1 PortAJP/1.3 porttomcat-server_1800580808009tomcat-server_2801580818019tomcat-server_3802580828029
Step 3: modify the solrhome in each tomcat server catalina.bat file
Modify tomcat-server_2 to set JAVA_OPTS=-Dsolr.solr.home=D:/solrCloud/solr_home_2
Modify tomcat-server_3 to set JAVA_OPTS=-Dsolr.solr.home=D:/solrCloud/solr_home_3
Step 4: verify that the modification is successful and start three Tomcat in turn. And enter the following URL in the browser:
Http://localhost:8080/solr/
Http://localhost:8081/solr/
Http://localhost:8082/solr/
If all have normal access to the admin page of solr, then the configuration is successful. Otherwise, you need to check what's wrong or missing.
3. Configure ZooKeeper clusters
The content of this section is not related to the previous tomcat+solr.
Step 1: extract zookeeper-3.4.6.tar.gz to the D:/solrCloud directory and rename it to zk-server_1.
Step 2: change the zoo_sample.cfg in the D:\ solrCloud\ zk-server_1\ conf\ directory to zoo.cfg. And write the following configuration parameters:
TickTime=2000
InitLimit=5
SyncLimit=2
DataDir=D:/SolrCloud/zk-server_1/data
ClientPort=2181
DataLogDir=D:/SolrCloud/zk-server_1/logs
Server.1=127.0.0.1:2888:3888
Server.2=127.0.0.1:2889:3889
Server.3=127.0.0.1:2890:3890
And create the corresponding data and logs directories as configured. You can't start normally without creating a directory. Create the file myid in the data directory (no suffix is required), write the number 1 in the myid file, and save exit.
Step 3: make 2 copies of zk-server_1 and name them zk-server_2 and zk-server_3 respectively. Then modify the dataDir and dataLogDir and clientPort of zoo.cfg under the conf directory of each zk-server. The modification scheme is as follows:
DataDirdataLogDirclientPortzk-server_1/conf/zoo.cfgD:/solrCloud/zk-server_1/dataD:/solrCloud/zk-server_1/logs2181zk-server_2/conf/zoo.cfgD:/solrCloud/zk-server_2/dataD:/solrCloud/zk-server_2/logs2182zk-server_3/conf/zoo.cfgD:/solrCloud/zk-server_3/dataD:/solrCloud/zk-server_3/logs2183
And modify the contents of the myid file in each data directory. Zk-server_1 is 1, zk-server_2 is 2, ZK talk serverables 3 is 3.
Step 4: start the three zk-server (D:\ SolrCloud\ zk-server_*\ bin\ zkServer.cmd). And verify that the configuration is successful. Note: there is an abnormal message when connecting the first station, never mind, and so on, there will be no abnormal connection.
3.4.Configuring Tomcat+solr+zookeeper clusters
The previous tomcat+solr can be started and accessed, and the zookeeper can also be started and accessed. Then we need to connect them.
The first step: modify the solr.xml configuration information of solr_home_*, and change the hostPort to the corresponding tomcat port.
Solr_home_1/solr.xml
Solr_home_2/solr.xml
${jetty.port:8081}
Solr_home_3/solr.xml
${jetty.port:8082}
Step 2: modify the parameter information of catalina.bat in tomcat-server_*.
The tomcat-server_1 parameter information is as follows:
Set JAVA_OPTS=-Dsolr.solr.home=D:/solrCloud/solr_home_1-Dbootstrap_confdir=D:/solrCloud/solr_home_1/collection1/conf-Dcollection.configName=myconf-DnumShards=3-DzkHost=127.0.0.1:2181127.0.0.1:2182127.0.0.1:2183
The parameter information of tomcat-server_2 is as follows:
Set JAVA_OPTS=-Dsolr.solr.home=D:/solrCloud/solr_home_2-DzkHost=127.0.0.1:2181127.0.0.1:2182127.0.0.1:2183
The parameter information of tomcat-server_3 is as follows:
Set JAVA_OPTS=-Dsolr.solr.home=D:/solrCloud/solr_home_3-DzkHost=127.0.0.1:2181127.0.0.1:2182127.0.0.1:2183
Parameter explanation:-DnumShards=3 represents three shards. Because of the three nodes, the system defaults to one shard per node.
Step 3: since zookeeper has been started, tomcat-server_1 first, and then start other tomcat-server. When the startup is complete, enter in the browser:
Http://localhost:8080/solr/#/~cloud
Http://localhost:8081/solr/#/~cloud
Http://localhost:8082/solr/#/~cloud
As shown below:
Note: in step 3, when you start tomcat cluster mode for the first time, you must first tomcat-server_1 and then start other tomcat-server, which I have tested many times. Because there is a parameter of DnumShards=3 in tomcat-server_1, the cluster will know that the collection needs to be divided into three shard. If you start other tomcat-server first, and finally start tomcat-server_1, the cluster will default to only one shard for three backups.
3.5: error processing
Since I refer to other blog posts in this step, I encountered an error. As long as tomcat is configured with zookeeper, it cannot be started and can be started on a stand-alone machine. The error is probably as follows: org.apache.solr.common.SolrException: Could not load config for solrconfig.xml
The first line of the window report message indicates an error, which probably means: shard1 is already registered
Reason: because we keep starting tomcat,zookeeper during installation, and modify the startup file of tomcat, zookeeper has recorded the shard1 information, and tomcat-server_* registers when it starts.
Solution: clear the following directory
D:\ SolrCloud\ zk-server_1\ data\ version-2
D:\ SolrCloud\ zk-server_2\ data\ version-2
D:\ SolrCloud\ zk-server_3\ data\ version-2
Then restart zookeeper and restart tomcat.
How to avoid this error: the real cause of this error is the tomcat-server_1 parameter test configuration
Set JAVA_OPTS=-Dsolr.solr.home=D:/solrCloud/solr_home_1-Dbootstrap_confdir=D:/solrCloud/solr_home_1/collection1/conf-Dcollection.configName=myconf-DnumShards=3-DzkHost=127.0.0.1:2181127.0.0.1:2182127.0.0.1:2183
If we do not configure the red part when configuring, we can create our own collection.
Http://localhost:8080/solr/admin/collections?action=CREATE&name= collection 1&numShards=3
This is the end of the article on "how to build windows solrcloud pseudo-distribution". I hope the above content can be of some help to you, so that you can learn more knowledge. if you think the article is good, please share it for more people to see.
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.