搞了好几天,终于搞定,solr 主备配置,基于https的方式下。
主机的solrconfig.xml
<requestHandler name="/replication" class="solr.ReplicationHandler" >
<lst name="master">
<str name="enable">true</str>
<str name="replicateAfter">startup</str>
<str name="replicateAfter">commit</str>
<str name="confFiles">schema.xml,stopwords.txt</str>
</lst>
<lst name="slave">
<str name="enable">false</str>
<str name="masterUrl">https://192.168.0.232:443/solr/collection1/replication</str>
<str name="pollInterval">00:00:60</str>
</lst>
</requestHandler>
备机的solrconfig.xml
<requestHandler name="/replication" class="solr.ReplicationHandler" >
<lst name="master">
<str name="enable">false</str>
<str name="replicateAfter">commit</str>
<str name="confFiles">schema.xml,stopwords.txt</str>
</lst>
<lst name="slave">
<str name="enable">true</str>
<str name="masterUrl">https://192.168.0.229:443/solr/replication</str>
<str name="pollInterval">00:00:10</str>
</lst>
</requestHandler>
特别注意:因为是基于https的方式,所以证书,所以我在tomcat启动的时候将证书加载
修改tomcat 的 catalina.sh 文件
在文件上面加入下面的两面话
export JAVA_OPTS="$JAVA_OPTS -Djavax.net.ssl.trustStore=/usr/local/tomcat/.keystore"
export JAVA_OPTS="$JAVA_OPTS -Djavax.net.ssl.trustStorePassword=sortec123!@#"
/usr/local/tomcat/.keystore 为,证书的路径
sortec1233!@#为,证书的密码