Solr 한글 형태소 분석기가 4.5.1에서만 돌아간다고 하여 설치를 시작함


1. jetty 설치


http://redutan.blogspot.kr/2014/01/centos-6-jetty-9-jenkins.html


http://dcvan24.wordpress.com/2013/05/16/how-to-deploy-solr-4-3-on-jetty-9/


위의 두 링크를 참고로 하여 설치를 하였다.


jetty라는 사용자를 생성하고 jetty를 /srv/jetty 경로로 이동시킵니다. 이제 /srv/jetty 가 jetty 홈경로입니다. 그리고 권한까지 생성합니다.
# useradd jetty
# mv jetty /srv
# chown -R jetty:jetty /srv/jetty


서비스에 등록한다.
# ln -s /srv/jetty/bin/jetty.sh /etc/init.d/jetty
# chkconfig --add jetty
# chkconfig jetty on


8080 방화벽을 해제한다.
# vi /etc/sysconfig/iptables

# 방화벽에 추가할 내용
-A INPUT -m state --state NEW -m tcp -p tcp --dport 8080 -j ACCEPT
jetty를 기동하고 내용을 확인한다.
# service jetty start
# curl http://localhost:8080

환경 파일은 아래와 같이 설정한다. - solr의 설정까지 함께 들어 있으니 solr의 설정은 주석으로 막고 jetty구동 테스트를 하면 되겠다.

Create the settings file of jetty in /etc/default
vi /etc/default/jetty

and paste following in it.
JAVA_HOME=/usr/bin/java
JAVA=$JAVA_HOME
JETTY_HOME=/srv/jetty
JETTY_USER=jetty
#JETTY_ARGS=jetty.port=8081
JETTY_LOGS=/srv/jetty/logs
JAVA_OPTIONS="-Dsolr.solr.home=/srv/solr $JAVA_OPTIONS"


Then start it as a service.


2. solr

  우분투에 설치법 링크대로 설치를 한다 경로만 CentOS에 맞게 /srv에 설치를 하였다.

Extract the tarball of Solr to anywhere you like.
tar zxvf solr-4.3.0-src.tgz -C /tmp

Copy the .war package to webapps directory of $JETTY_HOME, copy solr directory in the example/ directory to a preferred directory as $SOLR_HOME, e.g /opt. dist/ and contrib/ are also necessary.
cp -a solr-4.3.0/dist/solr-4.3.0.war /srv/jetty/webapps/solr.war
cp -a solr-4.3.0/example/solr /srv/solr
cp -a solr-4.3.0/dist /srv/solr
cp -a solr-4.3.0/contrib /srv/solr

Also, you will need the context and some modules to have Solr run properly on Jetty.
cp -a solr-4.3.0/example/contexts/solr-jetty-context.xml /srv/jetty/webapps/solr.xml
cp -a solr-4.3.0/example/lib/ext/* /srv/jetty/lib/ext/

3. solr 환경 파일

   본문의 경로는 잘못 되어있다. 덧글에 있는것처럼 경로를 수정하며, 만약 제대로 되지 않는다면 구동시의 로그를 자세히 살펴보면 정확한 경로를 설정할 수 있게 알려준다.

Since the directory structure is changed, you need to edit solrconfig.xml to make solr able to read files in dist/ and contrib/. You also need to comment the non-existent-dir example to avoid warning.
vi /opt/solr/collection1/conf/solrconfig.xml
<!-- modify the path as following -->
...
<lib dir="../contrib/extraction/lib" regex=".*\.jar" />
<lib dir="../dist/" regex="solr-cell-\d.*\.jar" />
 
<lib dir="../contrib/clustering/lib/" regex=".*\.jar" />
<lib dir="../dist/" regex="solr-clustering-\d.*\.jar" />
 
<lib dir="../contrib/langid/lib/" regex=".*\.jar" />
<lib dir="../dist/" regex="solr-langid-\d.*\.jar" />
 
<lib dir="../contrib/velocity/lib" regex=".*\.jar" />
<lib dir="../dist/" regex="solr-velocity-\d.*\.jar" />
...

4. 테스트


chown -R jetty:jetty /srv/solr


service jetty restart

여기서 부터 삽질을 조금 했다.


주로 firefox를 사용했는데 dashboard에 내용이 나오지 않는것이였다. 어딘가 설정이 틀린지 알고 한참을 이리 저리 셋팅했는데 ( 지금 보니 adblock 때문인듯하다..예외등록하니 잘 나온다.)


혹시나 하고 chrome으로 보니 잘 보인다. ㅡ.ㅡ;;  IE11에서도 잘나온다.....


중간에 삽질 조금한거 빼면 다음번엔 30분 내외로 설치가 가능할 것 같다.