国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 學(xué)院 > 開發(fā)設(shè)計(jì) > 正文

Solr主從集群配置簡要說明

2019-11-14 23:23:34
字體:
供稿:網(wǎng)友
Solr主從集群配置簡要說明

  關(guān)于solr的集群主要分為主從和SolrCloud兩種。主從,比較適合以讀為主的場景。SolrCloud適合數(shù)據(jù)量大,時(shí)不時(shí)會(huì)有更新的情形。那么solr的主從配置很簡單。在solrconfig.xml中找到<requestHandler name="/replication" class="solr.ReplicationHandler" > 。這里的replication主要解決主從復(fù)制的。它主要實(shí)現(xiàn):在主進(jìn)行數(shù)據(jù)寫操作,在slave節(jié)點(diǎn)進(jìn)行讀操作。當(dāng)并發(fā)量大些,可以通過擴(kuò)展slave節(jié)點(diǎn)數(shù)來應(yīng)對,多個(gè)slave做一個(gè)反向代理和負(fù)載均衡(在本文中,就不做說明了,如有需要,可以使用nginx或者apache等負(fù)載軟件),供查詢使用。好了,先看看主節(jié)點(diǎn)配置:

  <requestHandler name="/replication" class="solr.ReplicationHandler" >     <!--       To enable simple master/slave replication, uncomment one of the        sections below, depending on whether this solr instance should be       the "master" or a "slave".  If this instance is a "slave" you will        also need to fill in the masterUrl to point to a real machine.    -->       <lst name="master">         <str name="replicateAfter">commit</str>         <str name="replicateAfter">startup</str>         <str name="confFiles">schema.xml,stopWords.txt,spellings.txt,synonyms.txt</str>       </lst>    <!--       <lst name="slave">         <str name="masterUrl">http://your-master-hostname:8983/solr</str>         <str name="pollInterval">00:00:60</str>       </lst>    -->

  

master 標(biāo)志該core 為主節(jié)點(diǎn)。復(fù)制的行為發(fā)生在commit、startup之后。cofFiles表示,向從節(jié)點(diǎn)復(fù)制的配置文件(記住,主從的solrconfig.xml配置不一樣,不要把solrconfig.xml也復(fù)制到從節(jié)點(diǎn)了)。  再看看slave節(jié)點(diǎn)的配置,slave配置很簡單,把上面的配置文件中master那段注釋掉。把slave那段放開即可。將masterUrl換成master的url,格式:http://your-master-host:port/solr/your_core_name。具體配置如下:
<requestHandler name="/replication" class="solr.ReplicationHandler" >     <!--       To enable simple master/slave replication, uncomment one of the        sections below, depending on whether this solr instance should be       the "master" or a "slave".  If this instance is a "slave" you will        also need to fill in the masterUrl to point to a real machine.    -->    <!--       <lst name="master">         <str name="replicateAfter">commit</str>         <str name="replicateAfter">startup</str>         <str name="confFiles">schema.xml,stopwords.txt</str>       </lst>    -->          <lst name="slave">         <str name="masterUrl">http://192.9.104.116:8090/solr/POI</str>         <str name="pollInterval">00:00:20</str>       </lst>    </requestHandler>

  

pollInterval 表示多久向master同步一次數(shù)據(jù),數(shù)據(jù)格式{時(shí)}:{分}:{秒}。這個(gè)要根據(jù)你的業(yè)務(wù)場景。如果更新比較頻繁,就把這個(gè)值調(diào)小點(diǎn),反之,就調(diào)大些。在同步數(shù)據(jù)時(shí),根據(jù)網(wǎng)絡(luò)和機(jī)器配置等不同,slave之間的數(shù)據(jù)會(huì)存在不同步的情況。如果,你對此有要求,需要注意了。總之,任何一種集群方案都不是萬能的。solr的主從模式目前存在諸多問題,比如:主節(jié)點(diǎn)有單點(diǎn)故障等等,希望后續(xù)的版本會(huì)有些改進(jìn)。


發(fā)表評論 共有條評論
用戶名: 密碼:
驗(yàn)證碼: 匿名發(fā)表
主站蜘蛛池模板: 含山县| 古蔺县| 江安县| 宁强县| 静安区| 德惠市| 许昌市| 闸北区| 阜阳市| 县级市| 探索| 北海市| 广州市| 永平县| 大冶市| 金坛市| 鹰潭市| 交城县| 历史| 安徽省| 嘉黎县| 桃园市| 兴山县| 湄潭县| 潍坊市| 延安市| 和平区| 乐山市| 阳东县| 清河县| 武穴市| 衡东县| 浪卡子县| 吴桥县| 博湖县| 新丰县| 潼南县| 凤凰县| 永吉县| 兴城市| 同江市|