1、下载.zip文件
2、在tomcat 下的webapps目录下,新增solr文件夹
3、将solr-8.1.1\server\solr-webapp\webapp文件夹下的所有内容复制到solr文件夹下
4、新建solrhome文件夹,将solr-8.1.1\server\solr下的全部文件copy到solrhome 中
5、.将solr-8.1.1\server\lib\ext的全部jar和solr-8.1.1\server\lib 中的metrics-core等五个jar包拷贝到E:apache_tomcat8\webapps\solr\WEB-INF\lib下 如果不想找solr-8.1.1\server\lib 下的包 ,可以全部拷贝过去
6、配置apache-tomcat-9.0.19\webapps\solr\WEB-INF 下的 web.xml
<env-entry> <env-entry-name>solr/home</env-entry-name> <env-entry-value>D:/solrhome</env-entry-value> <--自己的路径--> <env-entry-type>java.lang.String</env-entry-type> </env-entry>
并且将以下代码注释掉
<-- <security-constraint> <web-resource-collection> <web-resource-name>Disable TRACE</web-resource-name> <url-pattern>/</url-pattern> <http-method>TRACE</http-method> </web-resource-collection> <auth-constraint/> </security-constraint> <security-constraint> <web-resource-collection> <web-resource-name>Enable everything but TRACE</web-resource-name> <url-pattern>/</url-pattern> <http-method-omission>TRACE</http-method-omission> </web-resource-collection> </security-constraint>-->
7、新增class文件 并且在class下新增 jetty-logging.properties log4j.properties
jetty-logging.properties 内容为:
org.eclipse.jetty.util.log.class=org.eclipse.jetty.util.log.Slf4jLog
log4j.properties 中的内容为:
# Logging level
solr.log=logs
#log4j.rootLogger=INFO, file, CONSOLE
log4j.rootLogger=INFO, file
#log4j.appender.CONSOLE=org.apache.log4j.ConsoleAppender
#log4j.appender.CONSOLE.layout=org.apache.log4j.EnhancedPatternLayout
#log4j.appender.CONSOLE.layout.ConversionPattern=%-4r %-5p (%t) [%X{collection} %X{shard} %X{replica} %X{core}] %c{1.} %m%n
#- size rotation with log cleanup.
log4j.appender.file=org.apache.log4j.RollingFileAppender
log4j.appender.file.MaxFileSize=4MB
log4j.appender.file.MaxBackupIndex=9
#- File to log to and log format
log4j.appender.file.File=${solr.log}/solr.log
log4j.appender.file.layout=org.apache.log4j.EnhancedPatternLayout
log4j.appender.file.layout.ConversionPattern=%d{yyyy-MM-dd HH:mm:ss.SSS} %-5p (%t) [%X{collection} %X{shard} %X{replica} %X{core}] %c{1.} %m%n
log4j.logger.org.apache.zookeeper=WARN
log4j.logger.org.apache.hadoop=WARN
# set to INFO to enable infostream log messages
log4j.logger.org.apache.solr.update.LoggingInfoStream=OFF
8、启动tomcat,访问localhost:8080/solr/index.html