我正在使用solrJ向solr服务器添加文档。我有一个主/从设置。索引后,我通过http://URL/update?commit=true
进行提交,以便能够在主节点中进行搜索。但是对于复制,当我看到使用复制的索引版本详细信息时?command=details,我看到indexverion和replicatableindexversion不同。
`<arr name="commits">
<lst>
<long name="indexVersion">1346928051888</long>
<long name="generation">1907</long>
<arr name="filelist"></arr>
</lst>
</arr>
<str name="isMaster">true</str>
<str name="isSlave">false</str>
<long name="indexVersion">1346928051888</long>
<long name="generation">1907</long>
<lst name="master"><arr name="replicateAfter"><str>commit</str>
<str>startup</str></arr>
<str name="replicationEnabled">true</str>
<long name="replicatableIndexVersion">1346928046763</long>
<long name="replicatableGeneration">1</long></lst>
</lst>`
Because of this the slave is not replicating the commited document.
Here is the code i used for solrJ to add documents
Collection<SolrInputDocument> docs = new ArrayList<SolrInputDocument>();
SolrInputDocument doc = new SolrInputDocument();
doc.add(FIELDS);
docs.add(doc);
SolrInputDocument doc = new SolrInputDocument();
doc.add(FIELDS);
docs.add(doc);
SolrInputDocument doc = new SolrInputDocument();
doc.add(FIELDS);
docs.add(doc);
server.add(docs);
server.commit();
我是不是遗漏了什么?非常感谢您的帮助。感谢
我会尽量避免在提交&启动。它引起了一些问题仅在提交后尝试复制。
<requestHandler name="/replication" class="solr.ReplicationHandler" >
<lst name="master">
<str name="replicateAfter">commit</str>
<str name="confFiles">schema.xml,stopwords.txt,elevate.xml</str>
<str name="commitReserveDuration">00:00:10</str>
</lst>
<str name="maxNumberOfBackups">1</str>
</requestHandler>
它是这样工作的吗?