Tomcat7 + Solr4.10ã®ç°å¢æ§ç¯
Solrã¯5.0ããã¹ã¿ã³ãã¢ãã³ãªãµã¼ãã¼ã¢ããªã±ã¼ã·ã§ã³ã«ãªãã¾ããããTomcatã®ä¸ã§åããããæã®ããã«Tomcat7 + Solr4.10ã®ç°å¢æ§ç¯æé ãæ®ãã¦ããã¾ããä»åã¯ã½ã¼ã¹ãããã«ããã¾ãã
Solr5.0ã®ç°å¢æ§ç¯ã¯ãã¡ãï¼
CentOS7にSolr5.0を入れる手順 - サナギわさわさ.json
ä»åã¯CentOS7ã使ç¨ãã¦ãã¾ãã
Tomcat7ã®ã¤ã³ã¹ãã¼ã«ã¨ãµã¼ãã¹ç»é²
CentOS7ã§ã¯å ¬å¼ãªãã¸ããªã«Tomcat7ãå ¥ã£ã¦ããã®ã§ãä½ãèããªãã¦ãã¤ã³ã¹ãã¼ã«ã§ãã¾ãã
yum install java-1.7.0-openjdk* yum install tomcat firewall-cmd --zone=public --add-port=8080/tcp --permanent systemctl restart firewalld.service systemctl enable tomcat.service systemctl start tomcat
http://localhost:8080/ã«ã¢ã¯ã»ã¹ã§ããäºã確èª
Solrã®ã½ã¼ã¹ããã¦ã³ãã¼ã
Solrã®ã³ã³ãã¤ã«ã«ä½¿ãantã¨ivyãä¸ç·ã«ãã¦ã³ãã¼ããã¾ãã
yum install wget wget -P /usr/local/ http://archive.apache.org/dist/lucene/solr/4.10.2/solr-4.10.2-src.tgz wget -P /usr/local/ http://ftp.kddilabs.jp/infosystems/apache//ant/binaries/apache-ant-1.9.4-bin.tar.gz wget -P /usr/local/ http://ftp.tsukuba.wide.ad.jp/software/apache//ant/ivy/2.4.0/apache-ivy-2.4.0-bin.tar.gz cd /usr/local/ tar zxvf solr-4.10.2-src.tgz tar zxvf apache-ant-1.9.4-bin.tar.gz tar zxvf apache-ivy-2.4.0-bin.tar.gz cp apache-ivy-2.4.0/ivy-2.4.0.jar to apache-ant-1.9.4/lib/
ç°å¢å¤æ°ã®è¨å®
ãã¼ã¸ã§ã³ã«åããã¦é©åã«è¨å®ãã¦ãã ããã
export ANT_HOME=/usr/local/apache-ant-1.9.4 export JAVA_HOME=/usr/lib/jvm/java-1.7.0-openjdk-1.7.0.75-2.5.4.2.el7_0.x86_64/ export PATH=${PATH}:/${ANT_HOME}/bin/
æ¥æ¬èªå¯¾å¿
ããã©ã«ãè¨å®ã§ã¯æ¥æ¬èªãæååããã¦æ¤ç´¢ã«ãããããªãå ´åãããã®ã§SetCharacterEncodingFilterãå
¥ãã¾ãã
詳ããã¯ãã¡ãã®ãµã¤ããåèã«ãã¦ãã ããã
tomcat7とsolr3.5.0のセットアップ(日本語の文字化け対策も) - Flicker's Style++
mkdir -p solr-4.10.2/solr/webapps/web/WEB-INF/classes/filters
classes/filtersç´ä¸ã«SetCharacterEncodingFilter.classãé
ç½®
solr/webapps/web/WEB-INF/web.xmlã«ä»¥ä¸ã追è¨
ã<filter> <filter-name>Set Character Encoding</filter-name> <filter-class>filters.SetCharacterEncodingFilter</filter-class> <init-param> <param-name>encoding</param-name> <param-value>UTF-8</param-value> </init-param> </filter> <filter-mapping> <filter-name>Set Character Encoding</filter-name> <url-pattern>/*</url-pattern> </filter-mapping>
etc/tomcat/server.xmlãä¿®æ£
<Connector port="8080" protocol="HTTP/1.1" connectionTimeout="20000" redirectPort="8443" URIEncoding="UTF-8" useBodyEncodingForURI="true" />
Solrã®ã³ã³ãã¤ã«
cd /usr/local/solr-4.10.2 ant clean ant compile #solr-4.10.2ç´ä¸ã«solrãã£ã¬ã¯ããªãã§ããäºãç¢ºèª cd solr ant dist #solrç´ä¸ã«distãã£ã¬ã¯ããªãã§ããäºã確èª
loggingè¨å®
Solrã¯SLF4Jããã°åºåã«ä½¿ã£ã¦ãããTomcat7ã§ã¯ãã®è¨å®ããã¡ãã§ãã¦ãããªãã¨Solrãèµ·åãã¾ãããä»åã¯SLF4J+Apache log4jã§è¨å®ãã¾ãã
cp solr-4.10.2/solr/example/lib/ext/* /usr/share/tomcat/lib cp solr-4.10.2/solr/example/resources/log4j.properties /usr/share/tomcat7/lib
log4j.propertiesã®ä¸èº«ã¯é©å½ã«ç·¨éãã¦ãã ããã
Warãã¡ã¤ã«ã®é ç½®ã¨è²ã
Warãã¡ã¤ã«ã®é
ç½®
cp solr-4.10.2/solr/dist/solr-4.10.2-SNAPSHOT.war to /var/lib/tomcat/webapps/solr.war
solr.homeç¨ã®ãã£ã¬ã¯ããªãä½æããç´ä¸ã«solr.xmlãé ç½®
mkdir /var/lib/solr/home chmod -R a+w /var/lib/solr/home vi /var/lib/solr/home/solr.xml <?xml version="1.0" encoding="UTF-8" ?> <solr persistent="false"> <cores adminPath="/admin/cores"> <core name="test" instanceDir="test" config="solrconfig.xml" schema="schema.xml"/> </cores> </solr>
/etc/tomcat/tomcat.confãä¿®æ£
JAVA_OPTS="${JAVA_OPTS} -Djavax.sql.DataSource.Factory=org.apache.commons.dbcp.BasicDataSourceFactory -Dsolr.solr.home=/var/lib/solr/home"
coreç¨ã®ãã£ã¬ã¯ããªä½æ
mkdir /var/lib/solr/home/test mkdir /var/lib/solr/home/test/conf mkdir /var/lib/solr/home/test/data chmod -R a+x /var/lib/solr/home/test/data cp solr-4.10.2/solr/example/solr/collection1/conf/* /var/lib/solr/home/test/conf/
conf/schema.xmlã¨conf/solrconfig.xmlã¯å¥½ããªããã«ç·¨éãã¦ãã ããã
è¨å®ã¯ä»¥ä¸ã§ãããã¨ã¯service tomcat restart
ã§ãhttp://localhost:8080/solrã«ã¢ã¯ã»ã¹ãã¦ç®¡çç»é¢ã«ã³ã¢ã表示ããã¦ããã°æåã§ãã
ãµã³ãã«ãã¼ã¿ã®ç»é²ãæ¤ç´¢æ©è½ã®ç¢ºèªã«é¢ãã¦ã¯ã
CentOS7にSolr5.0を入れる手順 - サナギわさわさ.jsonã®çµç¤ã«æ¸ãã¦ããã¾ãã®ã§ããã¡ããåç
§ãã¦ãã ããããç²ããã¾ã§ããã