首页 > 代码库 > Solr 4 Study notes (part1)
Solr 4 Study notes (part1)
Installation:
Jetty:
Modify solr.xml
<?xml version=”1.0”?>
<!DOCTYPEConfigure PUBLIC ” -//Jetty//Configurer//EN” http://www.eclipse.org/jetty/configure.dtd>
<Configure class=”org.eclipse.jetty.webapp.WebAppContext”>
<Set name=”contextPath”>/solr</Set>
<Setname=”war”><SystemProperty name=”jetty.home”/>/webapps/solr.war</Set>
<Setname=”defaultsDescriptor”><SystemProperty name=”jetty.home”/>/etc/webdefault.xml</Set>
<Setname=”tempDirectory”><Property name=”jetty.home” default=”.”/>/temp</Set>
</Configure>
Copy solr.xml to <jettyinstallation>/context
Copy jetty.xml, webdefault.xml, logging.properties from <solrdistribution>/etc to <jetty installation>/etc
Copy schema.xml, solrconfig.xml, solr.xml etc to<solr.home> directory
For multi-core configuration
In solr.xml:
<solr persistent=”true”>
<cores adminPath=”/admin/cores” defaultCoreName=”collection1”>
<core name=”collection1”instanceDir=”collection1”/>
</cores>
</solr>
Copy schema.xml, solrconfig.xml to <solr.home>/<collectiondir>/conf
Modify /etc/default/jetty file, add -Dsolr.solr.home=xxx
Tomcat:
Change tomcat server.xml: connector’s url encoding toUTF-8
<Connector port=”8080” protocol=”HTTP/1.1”connectionTimeout=”20000” redirectPort=”8443”URIEncoding=”UTF-8”/>
Create solr.xml in $TOMCAT_HOME/conf/Catalina/localhost
<Context path=”/solr” docBase=”/usr/share/tomcat/webapps/solr.war”debug=”0” crossContext=”true”>
<Environment name=”solr/home”type=”java.lang.String” value=http://www.mamicode.com/”usr/share/solr” override=”true”/>
</Context>
Copy schema.xml, solrconfig.xml, solr.xml etc to<solr.home> directory
For multi-core configuration
In solr.xml:
<solr persistent=”true”>
<cores adminPath=”/admin/cores” defaultCoreName=”collection1”>
<core name=”collection1”instanceDir=”collection1”/>
</cores>
</solr>
Copy schema.xml, solrconfig.xml to <solr.home>/<collectiondir>/conf
Solr cloud requirement:
_version_ field
<field name=”_version_” type=”long” indexed=”true”stored=”true” multiValued=”false”/>
solr.ReplicationHandler
<requestHandler name=”/replication” class=”solr.ReplicationHandler”/>
solr.RealTimeGetHandler
<requestHandler name=”/get” class=”solr.RealTimeGetHandler”>
<lstname=”defaults”>
<str name=”omitHeader”>true</str>
</lst>
</requestHandler>
<updateLog>
<strname=”dir”>${solr.data.dir:}</str>
</updateLog>
solr.xml
<solr persistent=”true”>
<cores adminPath=”/admin/cores … host=”localhost”hostPort=”xxx” zkClientTimeout=”xxxx”>
</solr>
Directory Implementation:
<directoryFactory name=”DirectoryFactoryclass=”xxxxxxx”/>
Solr.StandardDirectoryFactory | Solr make decision on underlining implementation |
Solr.SimpleFSDirectoryFactory | Does not scale well with high number of threads |
Solr.NIOFSDirectoryFactory | Scale well with many threads, but does not work well on Windows |
Solr.MMapDirectoryFactory | Good for 64 bit linux system if near realtime searching is not needed |
Solr.NRTCachingDirectoryFactory | Good for near real-time indexing and searching |
Solr.RAMDirectoryFactory | Entirely in memory and not support replication Used for auto-completion or unit testing |
Solr 4 Study notes (part1)