搜索引擎(Solr-部署詳解)

Solr兩種部署模式介紹

Solr的兩種部署模式java

Solr程序包安裝好後,能夠以兩種模式來啓動solr服務器:node

1.Standalone Serverweb

   獨立服務器模式 適用於數據規模不大的場景服務器

2.SolrCloud架構

  分佈式集羣模式 適用於數據規模大,高可靠、高可用、高併發的場景併發

 

獨立服務器模式詳解

獨立服務器模式架構分佈式

說明:高併發

一、每一個solr服務器實例(啓動的一個solr服務器進程)都有一個solr主目錄(系統變量名爲:solr.solr.home)。啓動服務器實例時須爲實例指定主目錄(默認爲:server/solr目錄)。post

二、solr主目錄中存放該服務器實例託管的內核。性能

三、一個solr服務器實例中可託管多個內核。

Solr主目錄介紹

啓動服務器實例命令:

bin/solr start [options]
bin/solr start -help
bin/solr restart [options]
bin/solr restart -help

注意:重啓要用和啓動時同樣的options

bin/solr start –s xxxdir –p port

查看本機上運行的solr服務實例的狀態

bin/solr status

中止solr服務實例

bin/solr stop [options]    bin/solr stop –p port
bin/solr stop -help        bin/solr stop -all

core  內核詳解

回顧:內核是什麼?---索引

內核:是在Solr服務器中的具體惟一命名的、可管理和可配置的索引。一臺solr服務器能夠託管一個或多個內核。

內核的典型用途:區分不一樣模式的文檔

回顧:如何建立內核?

core 內核管理

建立內核

bin/solr create [options]
bin/solr create –help
bin/solr create_core [options]
bin/solr create_core -help

-c <name> 內核的名字(必需).
-d <confdir> 內核配置目錄。默認_default.
-p <port> 建立命令要發送到的solr服務實例的端口。如未指定則獲取本機運行的solr服務實例列表的第一個。

bin/solr create –c mycore –p 8983

卸載、加載、重載內核

刪除內核

bin/solr delete [options]       bin/solr delete –c corename –p port
bin/solr delete -help

core 內核目錄結構

內核配置文件目錄

 

SolrCloud分佈式集羣模式詳解

爲何須要分佈式集羣模式? 

源於需求:

1.索引數據量大
         如何存儲?
         如何保證搜索性能?

2.如何保證高可靠、高可用?

3.如何應對高併發、實時響應需求?

索引將被如何存儲?

分割成多個片存儲到集羣的不一樣節點上,每一個分片有備份,存儲在集羣的不一樣節點上。

獨立服務器上索引叫內核,那集羣上索引叫什麼?

solrCloud中以 collection(集合)來稱呼索引,內核存儲的是集合分片(shard)的備份(replication)

SolrCloud分佈式集羣架構 

分佈式集羣模式啓動

1.zookeeper

獨立的zookeeper,則需先啓動zookeeper
內嵌的zookeeper,則先啓動包含zookeeper的solrNode

2.solrNode

內嵌的zookeeper的第一個solrNode節點服務啓動:

bin/solr start –c –p port –s solrhome (啓動的zookeeper實例的端口爲 slor實例的端口+1000)

其餘solr節點的啓動:

bin/solr start –c –p port –s solrhome –z zkhost:port 

分佈式集羣模式部署練習

在咱們的電腦上部署一個兩個節點的集羣

步驟1:建立兩個solr主目錄,如

F:\test\solrCloud\node1\solr
F:\test\solrCloud\node2\solr
node1/solr目錄下須要zk的配置文件,到example\cloud\node1\solr 下拷貝 zoo.cfg

步驟2:啓動第一個內嵌有zk的solrNode

bin/solr start –c –s F:/test/solrCloud/node1/solr

步驟3:啓動第二個solrNode

bin/solr start –c  -p 7001 –s F:/test/solrCloud/node2/solr –z localhost:9983

分佈式集羣的web管理控制檯的變化

建立集合 collection

集合—分片數2---備份因子2

bin/solr create –c collection01 –d _default –shards 2 –replicationFactor 2 –p 8983

bin/solr create –c collection02 –d sample_techproducts_configs –shards 2 –replicationFactor 2 –p 8983

卸載、加載、重載集合

刪除集合

bin/solr delete –c collectonname –p port

提交數據到集合中

Linux/Mac
solr-7.3.0:$ bin/post -c techproducts example/exampledocs/* 
Windows
solr-7.3.0> java -jar -Dc=techproducts -Dauto example\exampledocs\post.jar example\exampledocs\*

在web管理控制檯中使用collection / core

總結

SolrCloud zookeeper solrNode       主目錄 Collection  集合         shard   分片          replication   備份      --->   內核

相關文章
相關標籤/搜索