Step 3) Zend_Search_Lucene

_undefined 2007. 3. 5. 16:30 posted by deneb

최종 목표 - LAMP(Linux 2.6.x, Apache 2.2.x, MySQL 5.0.x, PHP 5.1.x) 환경 + Zend_Search_Lucene

ZSL

현재 적용해야할 사이트는 php 기반의 사이트다. 이 사이트는 인덱싱화에 있어서 아무런 문제는 없지만 너치와 연계하여 사용하는 것에는 무리가 따른다. 검색하여 인덱싱에 있어서 동기화의 작업이 복잡해 지거나 아예 시간에 따른 수동화로 하거나 검색 결과를 출력하는데 있어서도 사용자-php-jsp-php-사용자 라는 구조를 가지게 되므로써 사용에 따른 효율성만 떨어지게 된다.

그렇다면 해결점은 더 빠른 언어로 만들어진 웹 검색 가능한 솔루션 이거나 아니면 아예 php로 만들어진 루씬을 만드는 것이다. 전자에 있어서는 펄, 파이선, C#, C++로 만들어진 루씬이 있지만 너치와 같은 웹검색 솔루션은 없다. 그렇다면 후자인 php로 만드는 것인데 이는 더 큰 비용이 들기 때문에 php로 만들어진 루씬을 찾아보기로 했다. 찾아본 결과가 Zend_Search_Lucene이다.
Zend_Search_Lucene는 Zend 사의 Zend Framework의 포함된 하나의 검색 인터페이스다. Zend사는 php 관련 솔루션을 공급하는 회사로 대표적으로 php4 이상에 기본적으로 들어가있는 Zend Engine이다. 이 회사에서 Zend Platform을 내놓고 기반이되는 Zend Framework를 내놓았다. 최근에 웹기반개발이 확산 되면서 스크립트 언어들이 인정을 받고 대세인 시대가 되었다. 파이썬, Ajax, 루비 종류 등 다양하게 개발된 스크립트 언어가 나왔고 하나의 축으로 자리잡게 되었다. 허나 기존 php만으로도 구현 할 수 있기에 그 방법론으로 php 기반의 플랫폼을 내놓고 있고 이런 플랫폼은 벌써 10개도 넘는 것으로 안다.

http://www.phpriot.com/d/articles/php/search/zend-search-lucene/index.html 에서 Zend_Search_Lucene을 통한 검색 및 결과를 보여줬다.

1. 설치 환경
PHP 5.1.4 이상의 환경

2. Zend Framework
홈페이지에서 ZendFramework-0.8.0 다운 및 설치
php의 include_path 지정
사용 권한 등 변경

3. 테스트
간단한 indexing 파일 생성과 검색 결과에 대한 테스트 완료

남은 과제 아직 WebDB, crawling에 대해서는 php 실력이 부족한 관계로 차후에 시도해 보려함

참고사항;
ZendFramework-0.8.0
PHPUnit
Pear

Step 2) 너치 온 루씬(Nutch on Lucene)

_undefined 2007. 3. 5. 15:23 posted by deneb

이전 단계의 문제점을 해결하기 위해서는
우선 알아야 할 것이
1. 루씬은 TEXT 파일만 인덱싱 할 수 있다.
2. 루씬은 특정 사이트에 대해서 해석후 텍스트 파일로 만들 수 없다. (crawling)
3. 루씬은 특정 사이트의 하위페이지를 알아낼 수 없다. (WebDB)
4. 루씬은 웹용 검색 서블릿을 제공하지 않는다. (Servlet)

즉, 루씬은 컴퓨터 내에 특정 디렉토리(설정에 따라 그 하위도)내에 있는 TEXT 파일을 검색하여 내에 가지고 단어를 인덱싱화 하여 DB파일로 저장하고 질의를 통해서 그 결과를 알려줄 뿐 웹에서 사용할 검색엔진은 아니라는 것이다.
그렇다면 루씬의 인덱싱 파일화는 기본으로 가지고 세 가지의 문제점을 해결 할 것을 제공하면 되는 것이다.
이런 필요성 때문에 루씬을 기반으로 나온 프로젝트 중의 하나가 너치(Nutch)다.

너치는 Apache Tomcat 기반으로 돌아가는 웹 검색 엔진이다. crawling, WebDB에 대해 돌아가고 그에 더불어 Tomcat과 연계하여 검색 Servlet 페이지를 포함한다.

1. 너치 구동
Java 1.4.x 이상
Tomcat 4.x 이상

Tomcat 6.1 설치

2. 너치 설치
즉, 루씬은 컴퓨터 내에 특정 디렉토리(설정에 따라 그 하위도)내에 있는 TEXT 파일을 검색하여 내에 가지고 단어를 인덱싱화 하여 DB파일로 저장하고 질의를 통해서 그 결과를 알려줄 뿐 웹에서 사용할 검색엔진은 아니라는 것이다.
그렇다면 루씬의 인덱싱 파일화는 기본으로 가지고 세 가지의 문제점을 해결 할 것을 제공하면 되는 것이다.
이런 필요성 때문에 루씬을 기반으로 나온 프로젝트 중의 하나가 너치(Nutch)다.

너치는 Apache Tomcat 기반으로 돌아가는 웹 검색 엔진이다. crawling, WebDB에 대해 돌아가고 그에 더불어 Tomcat과 연계하여 검색 Servlet 페이지를 포함한다.

1. 너치 구동
Java 1.4.x 이상
Tomcat 4.x 이상

Tomcat 6.1 설치

2. 너치 설치
nutch-0.8.1 설치

3. 테스트
사내 사이트를 WebDB 및 인덱싱 화 완료
192.168.0.101:8080 에서 검색 결과 완료
(현재 tomcat 문제로 closed)

3. 테스트
사내 사이트를 WebDB 및 인덱싱 화 완료
192.168.0.101:8080 에서 검색 결과 완료

4. 문제점
사이트에 대한 기본적인 WebDB화 인덱싱 화에 대해서는 문제가 없지만 가장 큰 문제는 JVM 하에서 사용할 수 있다는 것이다.

'_undefined' 카테고리의 다른 글

Step 3) Zend_Search_Lucene  (0) 2007.03.05
Step 1) 루씬 온 리눅스(Lucene on Linux)  (0) 2007.03.05
Vundo(adware/virtumundo) 조심하세요.  (4) 2007.02.23

Step 1) 루씬 온 리눅스(Lucene on Linux)

_undefined 2007. 3. 5. 12:12 posted by deneb

최종 목표 - LAMP(Linux 2.6.x, Apache 2.2.x, MySQL 5.0.x, PHP 5.1.x) 환경 + Lucene+ Nutch

淚信? 淚神?

1. 리눅스를 깔자
CENT OS 4.4 설치

2. 자바 개발 환경을 만들자
기본적으로 gcj(gcc에 포함된 jre 기능을 하는 것)가 자꾸 방해를 한다.
JDK 1.4 혹은 1.5, 그 이후 버전으로 변경 하고 gcj 등이 관련된 심볼릭 링크들을 정리
/etc/profile에 JAVA_HOME 및 jar 파일 등을 PATH, CLASSPATH 에 추가
JUnit 4.1 설치 (배포버전)
/etc/profile에 JUNIT_HOME 및 jar 파일 등을 CLASSPATH 에 추가
Ant 1.6.2 혹은 그 이후 버전 (src 빌드)
/etc/profile에 ANT_HOME 및 jar 파일 등을 CLASSPATH 에 추가
Javacc 4.0 설치 (src 빌드)
/etc/profile에 JAVACC_HOME 및 jar 파일 등을 CLASSPATH 에 추가
Lucene 2.1.0 (배포버전)
/etc/profile에 LUCENE_HOME 및 jar 파일 등을 CLASSPATH 에 추가
- src 버전으로 ant를 이용하여 빌드를 해봤으나 2.1.1-dev 버전이 생기는 탓으로 찜찜한 기분에 배포버전을 사용하기로 함

3. 테스트
test를 위한 jar 파일을 CLASSPATH에 등록하고
java org.apache.lucene.demo.IndexFiles {full-path-to-lucene}/src 등을 수행 완료
java org.apache.lucene.demo.SearchFiles 검색 완료

4. 남은 문제들
쉘에서 cl 모드로 인덱스 생성 및 질의를 통한 검색은 문제없이 되었으나 실질적인 문제는 웹을 통하여 문서에 대한 url 값을 가져오는 것이 문제였다.

'_undefined' 카테고리의 다른 글

Step 3) Zend_Search_Lucene  (0) 2007.03.05
Step 2) 너치 온 루씬(Nutch on Lucene)  (0) 2007.03.05
Vundo(adware/virtumundo) 조심하세요.  (4) 2007.02.23

출처 : http://tunelinux.pe.kr/gboard/bbs/board.php?bo_table=tip&wr_id=75&page=

RHN 에 지식기반정보가 있습니다.
rhn 등록되어있는 사용자만이 접속할 수 있지요.

한번 테스팅해볼만한 내용이네요.
문제해결을 위하여.

그리고 시스템의 정보를 수집하기 위한 sysreport 라는 프로그램이 있습니다. rhn등을 이용하여 설치하면 되고 위 명령만 치면 시스템의 주요정보를 모읍니다.

Solution Found
Issue:
My system had a kernel panic, an oops message, or is freezing for no apparent reason. How can I find out what is causing this?
Resolution:         Last update: 08-17-04
Resolving a kernel panic or a kernel oops is not a simple task. First off, in order for Red Hat to understand the cause of this, we will need to see the panic or oops message in its entirety. Below you will find our \"Profiling\" document, it contains the information that Red Hat requires in order to best troubleshoot a kernel panic or kernel oops related to a system crash.

We do recommend that you are running the latest kernel available for your release version and that have your system completely updated.

To further debug this problem we will need the following information:
The output from the following commands:

    * sysreport
    * lspci -vv
    * lsmod
    * cat /proc/meminfo
    * cat /proc/cpuinfo
    * uname -a


Please note, sysreport is an application that may not be installed on your system. If you do not have it installed, please install the sysreport RPM in one of the following ways:

    * Run: up2date sysreport if your system is registered with RHN, this will download and install the package for you.
    * Locate the sysreport package on your installation CD's and install the package with: rpm -ivh sysreport-version#.rpm - where version# will match the files version number on your installation CD.


If possible, please run these commands when the slow down is occuring, or as close as possible to a reproduceable crash. That being said, we do recognize that this is not always possible, but the information is still needed.

    * OOPS messages:

      If your machine crashes with an OOPS message, similar to the following:

Unable to handle kernel NULL pointer dereference at virtual address
00000018
*pde = 0f992001
Oops: 0000
CPU:    1
EIP:    0010:[]    Not tainted
Using defaults from ksymoops -t elf32-i386 -a i386
EFLAGS: 00010207
eax: 00000000   ebx: c87a1ed0   ecx: c02de5e0   edx: f3de3b00
esi: c87a1eb4   edi: 00000000   ebp: 00000007   esp: c3f5bfa0
ds: 0018   es: 0018   ss: 0018
Process kswapd (pid: 11, stackpage=c3f5b000)
Stack: 00000000 fffffe5d 00000245 00085992 00000001 00000000 000000c0 000000c0
       0008e000 c0136c51 000000c0 00000000 c3f5a000 00000006 c0136ce5 000000c0
       00000000 00010f00 c3ff1fb8 c0105000 c0105866 00000000 c0136c90 c02f5fc0
Call Trace: [] do_try_to_free_pages [kernel] 0x11
[] kswapd [kernel] 0x55
[] stext [kernel] 0x0
[] kernel_thread [kernel] 0x26
[] kswapd [kernel] 0x0
Code: f7 40 18 06 00 00 00 75 f0 8b 40 28 39 d0 75 f0 31 d2 85 d2


>>EIP; c0136177    <=====

Trace; c0136c51
Trace; c0136ce5
Trace; c0105000 <_stext+0/0>
Trace; c0105866
Trace; c0136c90
Code;  c0136177
00000000 <_EIP>:
Code;  c0136177    <=====
   0:   f7 40 18 06 00 00 00      testl  $0x6,0x18(%eax)   <=====
Code;  c013617e
   7:   75 f0                     jne    fffffff9 <_EIP+0xfffffff9>
c0136170
Code;  c0136180
   9:   8b 40 28                  mov    0x28(%eax),%eax
Code;  c0136183
   c:   39 d0                     cmp    %edx,%eax
Code;  c0136185
   e:   75 f0                     jne    0 <_EIP>
Code;  c0136187
  10:   31 d2                     xor    %edx,%edx
Code;  c0136189
  12:   85 d2                     test   %edx,%edx


      We will need the full output from the OOPS message, which can be obtained in one of the following ways:

          o Copied down by hand (or from a digital picture), please remember we need the complete message and that this may sometimes be the only way to get the oops message.
          o Setting up a serial console to capture the message. This can be accomplished by connecting a null modem cable to the serial port of the machine and adding:

            console=ttyS0,115200 console=tty0

            to either the kernel line of grub or in an \"append=\" statement for lilo. Once this is done, on the other machine the null modem is attached to, run a terminal emulator such as \"minicom\" (linux) or \"hyperterminal\" (windows).

    * Mysterious Hangs, Freezes and Slowdowns:

      For hangs and freezes, we would like you to capture some information by enabling the sysrq key. This can be enabled by editing the file /etc/sysctl.conf and changing the line to read:

      kernel.sysrq = 1

      Enable it immediately by saving the file and running:

      # sysctl -p

      Once this is enabled, we will need the output from the following key combinations:
          o alt-sysrq-t
          o alt-sysrq-p
          o alt-sysrq-m
      * Please note that sysrq is the PrintScreen key.

      Please run alt-sysrq-p multiple times so that we can be sure to get output from all CPUs on the machine. Also, run alt-sysrq-m last as it has a possiblity of locking the box up harder then it already is. You may wish to use a serial console to capture the information. You will also want to ensure that we have at least 1 alt-sysrq-p from each CPU, denoted by a CPU: # line in the output. Note the first CPU is number 0.

    * Slowdowns:

      For general slowdowns we will first need to know the following:
          o What kind of load is the box under?
          o Are you running anything to produce this load?
          o If you stop running whatever may cause the load, does the slowness immediately go away?

            Next, we would like you to follow the following steps to gather some data for our engineers:

            1. Enable kernel profiling by turning on nmi_watchdog and allocating the kernel profile buffer. For example, add the following two items to the \"kernel\" line of /boot/grub/grub.conf (using grub):

                  profile=2 nmi_watchdog=1

            as in the following example:

                  kernel /vmlinuz-2.4.9-e.27smp ro profile=2 nmi_watchdog=1

            If using LILO, add the following to the global section (before the first image= line) of lilo.conf:
                  append=\"profile=2 nmi_watchdog=1\"
            and run lilo -v as root.
            Now you should be able to reboot.

            2. Create a shell script containing the following lines:

#!/bin/sh
while /bin/true; do
  echo;date
  /usr/sbin/readprofile -v -m /boot/System.map | sort -nr +2 | head -15
  /usr/sbin/readprofile -r
  sleep 5
done

          o Make the system demonstrate the aberrant behavior.
          o Run the following three commands simultaneously:

                  Execute the readprofile shell script above, redirecting its output to a file.
                  Execute vmstat 5 and redirect its output to a second file.
                  Execute top -d5 and redirect its output to a third file.

          o Attach the output files (preferably in gzip'd tar file format) to a web ticket that either you or a Red Hat Engineer has opened.


      You can open a web ticket with Red Hat support by logging into your www.redhat.com account in the Support and Docs section and selecting the Web Support button located under the \"Active Support Entitlements\" section.