Linux下手把手教你搭建Solr集羣與使用

目錄

一、solr集羣架構

二、安裝步驟

0、環境準備

1、Zookeeper集羣搭建

2、Solr集羣的搭建

三、使用solrJ管理集羣

一、solr集羣架構

二、安裝步驟

0、環境準備

  •     CentOS-6.5-i386-bin-DVD1.iso

  •      jdk-7u72-linux-i586.tar.gz

  •     apache-tomcat-7.0.47.tar.gz

  •     zookeeper-3.4.6.tar.gz

  •     solr-4.10.3.tgz

1、Zookeeper集羣搭建

第一步:需要安裝jdk環境。

https://blog.csdn.net/qq_36326332/article/details/88345181

第二步:把zookeeper的壓縮包上傳到服務器。

[root@shuchang131 ~]# ll

總用量 309428

-rw-r--r--.  1 root root   8234674 9月  11 14:59 apache-tomcat-7.0.47.tar.gz

drwxr-xr-x.  3 root root      4096 9月  11 17:06 IK Analyzer 2012FF_hf1

-rw-r--r--.  1 root root 139463702 9月  11 14:59 jdk-7u55-linux-i586.tar.gz

-rw-r--r--.  1 root root 150010621 9月  11 14:59 solr-4.10.3.tgz.tgz

drwxr-xr-x. 10 1000 1000      4096 2月  20 2014 zookeeper-3.4.6

-rw-r--r--.  1 root root  17699306 9月  12 02:10 zookeeper-3.4.6.tar.gz

第三步:解壓縮。

[root@shuchang131 ~]# tar -zxvf zookeeper-3.4.6.tar.gz

第四步:把zookeeper複製三份。

[root@shuchang131 ~]# mkdir /usr/local/solr-cloud

[root@shuchang131 ~]# cp -r zookeeper-3.4.6 /usr/local/solr-cloud/zookeeper01

[root@shuchang131 ~]# cp -r zookeeper-3.4.6 /usr/local/solr-cloud/zookeeper02

[root@shuchang131 ~]# cp -r zookeeper-3.4.6 /usr/local/solr-cloud/zookeeper03

第五步:在每個zookeeper目錄下創建一個data目錄。

[root@shuchang131 ~]# mkdir /usr/local/solr-cloud/zookeeper01/data

[root@shuchang131 ~]# mkdir /usr/local/solr-cloud/zookeeper02/data

[root@shuchang131 ~]# mkdir /usr/local/solr-cloud/zookeeper03/data

第六步:在data目錄下創建一個myid文件,文件名就叫做“myid”。內容就是每個實例的id。例如1、2、3

[root@shuchang131 ~]# cd /usr/local/solr-cloud/zookeeper01/data/

[root@shuchang131 data]# echo 1 >> myid

[root@localhost data]# ll

total 4

-rw-r--r--. 1 root root 2 Apr  7 18:23 myid

[root@shuchang131 data]# cat myid

1

[root@shuchang131 ~]# cd /usr/local/solr-cloud/zookeeper02/data/

[root@shuchang131 data]# echo 2 >> myid

[root@shuchang131 data]# ll

total 4

-rw-r--r--. 1 root root 2 Apr  7 18:23 myid

[root@shuchang131 data]# cat myid

2

[root@shuchang131 ~]# cd /usr/local/solr-cloud/zookeeper03/data/

[root@shuchang131 data]# echo 3 >> myid

[root@localhost data]# ll

total 4

-rw-r--r--. 1 root root 2 Apr  7 18:23 myid

[root@localhost data]# cat myid

3

第七步:修改配置文件。把conf目錄下的zoo_sample.cfg文件改名爲zoo.cfg

[root@shuchang131 data]# cd /usr/local/solr-cloud/zookeeper01/conf/

[root@shuchang131 conf]# mv  zoo_sample.cfg zoo.cfg

[root@shuchang131 conf]#  vim  zoo.cfg

dataDir=/usr/local/solr-cloud/zookeeper01/data/
# the port at which the clients will connect
clientPort=2181
#autopurge.purgeInterval=1
server.1=192.168.25.130:2881:3881
server.2=192.168,25.130:2882:3882
server.3=192.168.25.130:2883:3883

[root@shuchang131 data]# cd /usr/local/solr-cloud/zookeeper02/conf/

[root@shuchang131 conf]# mv  zoo_sample.cfg zoo.cfg

[root@shuchang131 conf]#  vim  zoo.cfg

dataDir=/usr/local/solr-cloud/zookeeper02/data/
# the port at which the clients will connect
clientPort=2182
#autopurge.purgeInterval=1
server.1=192.168.25.130:2881:3881
server.2=192.168,25.130:2882:3882
server.3=192.168.25.130:2883:3883

[root@shuchang131 data]# cd /usr/local/solr-cloud/zookeeper03/conf/

[root@shuchang131 conf]# mv  zoo_sample.cfg  zoo.cfg

[root@shuchang131 conf]#  vim  zoo.cfg

dataDir=/usr/local/solr-cloud/zookeeper03/data/
       # the port at which the clients will connect
       clientPort=2183
       #autopurge.purgeInterval=1
       server.1=192.168.25.130:2881:3881
       server.2=192.168,25.130:2882:3882
       server.3=192.168.25.130:2883:3883

 

 

 

第八步:啓動每個zookeeper實例。

       單個啓動示例:

[root@shuchang131 solr-cloud]# /usr/local/solr-cloud/zookeeper01/bin/zkServer.sh start

[root@shuchang131 solr-cloud]# /usr/local/solr-cloud/zookeeper02/bin/zkServer.sh start

[root@shuchang131 solr-cloud]# /usr/local/solr-cloud/zookeeper03/bin/zkServer.sh start

批處理腳本啓動

[root@shuchang131 solr-cloud]# vim start-all-zookeeper.sh

cd zookeeper01/bin

./zkServer.sh start

cd ../../

cd zookeeper02/bin

./zkServer.sh start

cd ../../

cd zookeeper03/bin

./zkServer.sh start

cd ../../

[root@shuchang131 solr-cloud]# chmod u+x start-all-zookeeper.sh 

[root@shuchang131 solr-cloud]# ./start-all-zookeeper.sh 

查看zookeeper的狀態:

[root@shuchang131 solr-cloud]# /usr/local/solr-cloud/zookeeper01/bin/zkServer.sh status

[root@shuchang131 solr-cloud]# /usr/local/solr-cloud/zookeeper02/bin/zkServer.sh status

[root@shuchang131 solr-cloud]# /usr/local/solr-cloud/zookeeper03/bin/zkServer.sh status 

2、Solr集羣的搭建

第一步:創建四個tomcat實例。每個tomcat運行在不同的端口。8180、8280、8380、8480

[root@shuchang131 local]# ll

總用量 24

drwxr-xr-x.  9 root root 4096 9月  11 15:02 apache-tomcat-7.0.47

drwxr-xr-x.  8 uucp  143 4096 3月  18 2014 jdk1.7.0_55

drwxr-xr-x.  4 root root 4096 9月  11 08:35 redis

drwxr-xr-x.  4 root root 4096 9月  11 15:48 solr

drwxr-xr-x.  8 root root 4096 9月  11 15:09 solr-4.10.3

drwxr-xr-x. 13 root root 4096 9月  12 03:41 solr-cloud

[root@shuchang131 local]# cp apache-tomcat-7.0.47  /usr/local/solr-cloud/tomcat01

[root@shuchang131 local]# vim /usr/local/solr-cloud/tomcat01/conf/server.xml 

<Server port="8105" shutdown="SHUTDOWN">

<Connector port="8109" protocol="AJP/1.3" redirectPort="8443" />

 <Connector port="8180" protocol="HTTP/1.1"
               connectionTimeout="20000"
               redirectPort="8443" />

[root@shuchang131 local]# cp apache-tomcat-7.0.47  /usr/local/solr-cloud/tomcat02

[root@shuchang131 local]# vim /usr/local/solr-cloud/tomcat02/conf/server.xml 

<Server port="8205" shutdown="SHUTDOWN">

<Connector port="8209" protocol="AJP/1.3" redirectPort="8443" />

 <Connector port="8280" protocol="HTTP/1.1"
               connectionTimeout="20000"
               redirectPort="8443" />

[root@shuchang131 local]# cp apache-tomcat-7.0.47  /usr/local/solr-cloud/tomcat03

[root@shuchang131 local]# vim /usr/local/solr-cloud/tomcat03/conf/server.xml 

<Server port="8305" shutdown="SHUTDOWN">

<Connector port="8309" protocol="AJP/1.3" redirectPort="8443" />

 <Connector port="8380" protocol="HTTP/1.1"
               connectionTimeout="20000"
               redirectPort="8443" />

[root@shuchang131 local]# cp apache-tomcat-7.0.47  /usr/local/solr-cloud/tomcat04

[root@shuchang131 local]# vim /usr/local/solr-cloud/tomcat04/conf/server.xml 

<Server port="8405" shutdown="SHUTDOWN">

<Connector port="8409" protocol="AJP/1.3" redirectPort="8443" />

 <Connector port="8480" protocol="HTTP/1.1"
               connectionTimeout="20000"
               redirectPort="8443" />

第二步:部署solr的war包。把單機版的solr工程複製到集羣中的tomcat中。

第三步:爲每個solr實例創建一個對應的solrhome。使用單機版的solrhome複製四份。

【第二、三步驟參考】:https://blog.csdn.net/qq_36326332/article/details/101079249

第四步:需要修改solr的web.xml文件。把solrhome關聯起來。

[root@shuchang131 local]# vim /usr/local/solr-cloud/tomcat01/webapps/solr/WEB-INF/web.xml

 <env-entry>
       <env-entry-name>solr/home</env-entry-name>
       <env-entry-value>/usr/local/solr-cloud/solrhome01</env-entry-value>

       <env-entry-type>java.lang.String</env-entry-type>
    </env-entry>

[root@shuchang131 local]# vim /usr/local/solr-cloud/tomcat02/webapps/solr/WEB-INF/web.xml

 <env-entry>
       <env-entry-name>solr/home</env-entry-name>
       <env-entry-value>/usr/local/solr-cloud/solrhome02</env-entry-value>

       <env-entry-type>java.lang.String</env-entry-type>
    </env-entry>

[root@shuchang131 local]# vim /usr/local/solr-cloud/tomcat03/webapps/solr/WEB-INF/web.xml

 <env-entry>
       <env-entry-name>solr/home</env-entry-name>
       <env-entry-value>/usr/local/solr-cloud/solrhome03</env-entry-value>

       <env-entry-type>java.lang.String</env-entry-type>
    </env-entry>

[root@shuchang131 local]# vim /usr/local/solr-cloud/tomcat04/webapps/solr/WEB-INF/web.xml

 <env-entry>
       <env-entry-name>solr/home</env-entry-name>
       <env-entry-value>/usr/local/solr-cloud/solrhome04</env-entry-value>

       <env-entry-type>java.lang.String</env-entry-type>
    </env-entry>

第五步:配置solrCloud相關的配置。每個solrhome下都有一個solr.xml,把其中的ip及端口號配置好。

[root@shuchang131 local]# cp solr   /usr/local/solr-cloud/solrhome01

[root@shuchang131 local]# vim  /usr/local/solr-cloud/solrhome01/solr.xml 

<solr>

  <solrcloud>
             <str name="host">192.168.25.130</str>
   
          <int name="hostPort">8180</int>
          </solrcloud>

</solr>

[root@shuchang131 local]#cp solr   /usr/local/solr-cloud/solrhome02

[root@shuchang131 local]# vim  /usr/local/solr-cloud/solrhome02/solr.xml 

<solr>

  <solrcloud>
             <str name="host">192.168.25.130</str>
   
          <int name="hostPort">8280</int>
          </solrcloud>

</solr>

[root@shuchang131 local]#cp solr   /usr/local/solr-cloud/solrhome03

[root@shuchang131 local]# vim  /usr/local/solr-cloud/solrhome03/solr.xml 

<solr>

  <solrcloud>
             <str name="host">192.168.25.130</str>
   
          <int name="hostPort">8380</int>
          </solrcloud>

</solr>

[root@shuchang131 local]#cp solr   /usr/local/solr-cloud/solrhome04

[root@shuchang131 local]# vim  /usr/local/solr-cloud/solrhome04/solr.xml 

<solr>

  <solrcloud>
             <str name="host">192.168.25.130</str>
   
          <int name="hostPort">8480</int>
          </solrcloud>

</solr>

第六步:讓zookeeper統一管理配置文件。需要把solrhome/collection1/conf目錄上傳到zookeeper。上傳任意solrhome中的配置文件即可。

 

使用工具上傳配置文件:[root@shuchang131 local]# /root/solr-4.10.3/example/scripts/cloud-scripts/zkcli.sh

[root@shuchang131 local]# ./zkcli.sh -zkhost 192.168.25.130:2181,192.168.25.130:2182,192.168.25.130:2183 -cmd upconfig -confdir /usr/local/solr-cloud/solrhome01/collection1/conf -confname myconf

查看zookeeper上的配置文件:

使用zookeeper目錄下的bin/zkCli.sh命令查看zookeeper上的配置文件:

[root@shuchang131 bin]# ./zkCli.sh

[zk: localhost:2181(CONNECTED) 0] ls /

[configs, zookeeper]

[zk: localhost:2181(CONNECTED) 1] ls /configs

[myconf]

[zk: localhost:2181(CONNECTED) 2] ls /configs/myconf

[admin-extra.menu-top.html, currency.xml, protwords.txt, mapping-FoldToASCII.txt, _schema_analysis_synonyms_english.json, _rest_managed.json, solrconfig.xml, _schema_analysis_stopwords_english.json, stopwords.txt, lang, spellings.txt, mapping-ISOLatin1Accent.txt, admin-extra.html, xslt, synonyms.txt, scripts.conf, update-script.js, velocity, elevate.xml, admin-extra.menu-bottom.html, clustering, schema.xml]

[zk: localhost:2181(CONNECTED) 3]

退出:

[zk: localhost:2181(CONNECTED) 3] quit

使用以下命令連接指定的zookeeper服務:

./zkCli.sh -server 192.168.25.130:2183

第七步:修改tomcat/bin目錄下的catalina.sh 文件,關聯solr和zookeeper。

把此配置添加到配置文件中:

JAVA_OPTS="-DzkHost=192.168.25.130:192.168.25.130:192.168.25.130:2183"

第八步:啓動每個tomcat實例。要包裝zookeeper集羣是啓動狀態。

 

第九步:訪問集羣

http://192.168.25.130:8180/solr/#/~cloud

 

 

第十步:創建新的Collection進行分片處理。

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

第十一步:刪除不用的Collection。

http://192.168.25.130:8180/solr/admin/collections?action=DELETE&name=collection1

三、使用solrJ管理集羣

使用步驟:查詢文檔:單機版

第一步:把solrJ相關的jar包添加到工程中。

第二步:創建一個SolrServer對象,需要使用CloudSolrServer子類。構造方法的參數是zookeeper的地址列表。

第三步:需要設置DefaultCollection屬性。

第四步:創建一SolrInputDocument對象。

第五步:向文檔對象中添加域

第六步:把文檔對象寫入索引庫。

第七步:提交。

package com.e3mall.solrj;

import java.util.List;
import java.util.Map;

import org.apache.solr.client.solrj.SolrQuery;
import org.apache.solr.client.solrj.SolrServer;
import org.apache.solr.client.solrj.impl.HttpSolrServer;
import org.apache.solr.client.solrj.response.QueryResponse;
import org.apache.solr.common.SolrDocument;
import org.apache.solr.common.SolrDocumentList;
import org.apache.solr.common.SolrInputDocument;
import org.junit.Test;

public class TestSolrJ {
	/**
	 * 
	 * @Description: 增改Solr文檔
	 * @author WSC 
	 * @date 2019年9月23日  
	 * @throws Exception
	 * void
	 */
	@Test
	public void addDocument() throws Exception {// 添加和更新文檔
		// 創建一個SolrServer對象,創建一個連接。參數solr服務的url
		SolrServer solrServer = new HttpSolrServer("http://192.168.25.130:8080/solr/collection1");
		// 創建一個文檔對象SolrInputDocument
		SolrInputDocument doc = new SolrInputDocument();
		// 向文檔對象中添加域。文檔中必須包含一個id域,所有域的名稱必須在schema.xml中定義
		doc.addField("id", "doc1");
		doc.addField("item_title", "測試商品02");
		doc.addField("item_price", 1002);
		// 把文檔寫入索引庫
		solrServer.add(doc);
		// 提交
		solrServer.commit();
	}

	/**
	 * 
	 * @Description: 刪除Solr文檔
	 * @author WSC 
	 * @date 2019年9月23日  
	 * @throws Exception
	 * void
	 */
	@Test
	public void deleteDocument() throws Exception {// 刪除文檔
		SolrServer httpSolrServer = new HttpSolrServer("http://192.168.25.130:8080/solr/collection1");
		// 刪除文檔
		// httpSolrServer.deleteById("doc1");
		httpSolrServer.deleteByQuery("id:doc1");
		// 提交
		httpSolrServer.commit();
	}

	/**
	 * 
	 * @Description: 簡單查詢Solr文檔
	 * @author WSC 
	 * @date 2019年9月23日  
	 * @throws Exception
	 * void
	 */
	@Test
	public void queryIndex() throws Exception {
		// 創建索引庫對象
		SolrServer solrServer = new HttpSolrServer("http://192.168.25.130:8080/solr/collection1");
		// 創建一個SolrQuery對象
		SolrQuery solrQuery = new SolrQuery();
		// 設置查詢條件
		// solrQuery.setQuery("*:*");
		solrQuery.set("q", "*:*");
		// 執行查詢,SolrResponse對象
		QueryResponse queryResponse = solrServer.query(solrQuery);
		// 取文檔列表。去查詢結果的總記錄數
		SolrDocumentList documentList = queryResponse.getResults();
		System.out.println("獲取查詢結果的總記錄數:" + documentList.getNumFound());
		// 遍歷文檔列表,區域中的內容
		for (SolrDocument solrDocument : documentList) {
			System.out.println(solrDocument.get("id"));
			System.out.println(solrDocument.get("item_title"));
			System.out.println(solrDocument.get("item_sell_point"));
			System.out.println(solrDocument.get("item_price"));
			System.out.println(solrDocument.get("item_image"));
			System.out.println(solrDocument.get("item_category_name"));
			System.out.println("---------------------------------------------");
		}
	}

	/**
	 * 
	 * @Description: 複雜查詢Solr文檔
	 * @author WSC 
	 * @date 2019年9月23日  
	 * @throws Exception
	 * void
	 */
	@Test
	public void queryIndexFuZa() throws Exception {
		// 創建索引庫對象
		SolrServer solrServer = new HttpSolrServer("http://192.168.25.130:8080/solr/collection1");
		// 創建一個SolrQuery對象
		SolrQuery solrQuery = new SolrQuery();
		// 設置查詢條件
		solrQuery.setQuery("手機");
		solrQuery.setStart(0);
		solrQuery.setRows(20);
		solrQuery.set("df", "item_title");
		solrQuery.setHighlight(true);
		solrQuery.addHighlightField("item_title");
		solrQuery.setHighlightSimplePre("<em>");
		solrQuery.setHighlightSimplePost("</em>");
		// 執行查詢,SolrResponse對象
		QueryResponse queryResponse = solrServer.query(solrQuery);
		// 取文檔列表。去查詢結果的總記錄數
		SolrDocumentList documentList = queryResponse.getResults();
		System.out.println("獲取查詢結果的總記錄數:" + documentList.getNumFound());
		// 遍歷文檔列表,區域中的內容
		for (SolrDocument solrDocument : documentList) {
			System.out.println(solrDocument.get("id"));
			// 取高亮顯示
			Map<String, Map<String, List<String>>> highlighting = queryResponse.getHighlighting();
			List<String> list = highlighting.get(solrDocument.get("id")).get("item_title");
			String title;
			if (list != null && list.size() > 0) {
				title = list.get(0);
			} else {
				title = solrDocument.get("item_title").toString();
			}
			System.out.println(title);
			System.out.println(solrDocument.get("item_sell_point"));
			System.out.println(solrDocument.get("item_price"));
			System.out.println(solrDocument.get("item_image"));
			System.out.println(solrDocument.get("item_category_name"));
			System.out.println("---------------------------------------------");
		}
	}

}

使用步驟:集羣版        創建一個CloudSolrServer對象,其他處理和單機版一致。

package com.e3mall.solrj;

import java.util.List;
import java.util.Map;

import org.apache.solr.client.solrj.SolrQuery;
import org.apache.solr.client.solrj.impl.CloudSolrServer;
import org.apache.solr.client.solrj.response.QueryResponse;
import org.apache.solr.common.SolrDocument;
import org.apache.solr.common.SolrDocumentList;
import org.apache.solr.common.SolrInputDocument;
import org.junit.Test;

public class TestSolrCloud {

	@Test
	public void testAddDocument() throws Exception {
		// 創建一個集羣的連接,應該使用CloudSolrServer創建。參數zkHost:zookeeper的地址列表
		CloudSolrServer cloudSolrServer = new CloudSolrServer("192.168.25.130:2181,192.168.25.130:2182,192.168.25.130:2183");
		// 創建一個defaultCollection屬性
		cloudSolrServer.setDefaultCollection("collection2");
		// 創建一個文檔對象
		SolrInputDocument document = new SolrInputDocument();
		// 向文檔中添加域
		document.setField("id", "solrCloud01");
		document.setField("item_title", "測試商品01");
		document.setField("item_price", 123);
		// 把文檔寫入索引庫
		cloudSolrServer.add(document);
		// 提交
		cloudSolrServer.commit();
	}

	@Test
	public void testQueryDocument() throws Exception {
		// 創建一個CloudSolrServer
		CloudSolrServer cloudSolrServer = new CloudSolrServer("192.168.25.130:2181,192.168.25.130:2182,192.168.25.130:2183");
		// 設置一個默認的Collection
		cloudSolrServer.setDefaultCollection("collection2");
		// 創建查詢對象SolrQuery
		SolrQuery solrQuery = new SolrQuery();
		// 設置查詢條件
		solrQuery.setQuery("商品01");
		solrQuery.set("df", "item_title");
		solrQuery.setHighlight(true);
		solrQuery.addHighlightField("item_title");
		solrQuery.setHighlightSimplePre("<em style=\"color:red\">");
		solrQuery.setHighlightSimplePost("</em>");
		// 執行查詢
		QueryResponse queryResponse = cloudSolrServer.query(solrQuery);
		// 獲取查詢結果
		SolrDocumentList solrDocumentList = queryResponse.getResults();
		Map<String, Map<String, List<String>>> highlighting = queryResponse.getHighlighting();
		long numFound = solrDocumentList.getNumFound();
		System.out.println("查詢結果總記錄數:" + numFound);
		for (SolrDocument solrDocument : solrDocumentList) {
			System.out.println(solrDocument.get("id"));
			System.out.println(solrDocument.get("item_title"));
			System.out.println(solrDocument.get("item_price"));
			System.out.println(highlighting.get(solrDocument.get("id")).get("item_title"));
		}
	}

}

把搜索功能切換到集羣版

<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans" xmlns:context="http://www.springframework.org/schema/context"
	xmlns:p="http://www.springframework.org/schema/p" xmlns:aop="http://www.springframework.org/schema/aop"
	xmlns:tx="http://www.springframework.org/schema/tx" xmlns:dubbo="http://code.alibabatech.com/schema/dubbo"
	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
	xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-4.2.xsd
	http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-4.2.xsd
	http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-4.2.xsd http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-4.2.xsd
	http://code.alibabatech.com/schema/dubbo http://code.alibabatech.com/schema/dubbo/dubbo.xsd
	http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util-4.2.xsd">
	<!-- 單機版SolrJ:HttpSolrServer -->
	<!-- <bean id="httpSolrServer" class="org.apache.solr.client.solrj.impl.HttpSolrServer">
		<constructor-arg name="baseURL" value="${SOLR_URL}" />
		<constructor-arg name="baseURL" value="http://192.168.25.130:8080/solr/collection1"/>
	</bean> -->

	<!-- 集羣版SolrJ:CloudSolrServer -->
	<bean id="cloudSolrServer" class="org.apache.solr.client.solrj.impl.CloudSolrServer">
		<!-- <constructor-arg name="zkHost" value="192.168.25.130:2181,192.168.25.130:2182,192.168.25.130:2183" /> -->
		<constructor-arg name="zkHost" value="${SOLR_CLOUD_URL}" />
		<!-- <constructor-arg index="0" value="${SOLR_CLOUD_URL}" /> -->
		<property name="defaultCollection" value="collection2"></property>
	</bean>
</beans>

 

 

 

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章