웹사이트 검색

Debian 11에 Apache Solr를 설치하는 방법


이 페이지에서

  1. 전제 조건
  2. 자바 설치
  3. Debian 11에 Apache Solr 설치
  4. Apache Solr 서비스 관리
  5. Apache Solr 컬렉션 만들기
  6. Apache Solr 웹 UI 액세스
  7. 결론

Apache Solr는 Apache Lucene 프로젝트의 오픈 소스 엔터프라이즈 검색 플랫폼입니다. 주요 기능에는 강력한 전체 텍스트 검색, 확장 가능하고 내결함성, 분산 인덱싱, 복제 및 로드 균형 조정 쿼리, 자동화된 장애 조치 및 복구, 중앙 집중식 구성 등이 포함됩니다. Java로 작성되었으며 인덱싱을 위해 Lucene 라이브러리를 사용합니다.

이 게시물에서는 Debian 11에 Apache Solr 검색 플랫폼을 설치하는 방법을 보여줍니다.

전제 조건

  • Debian 11을 실행하는 서버.\n
  • 루트 암호는 서버에서 구성됩니다.\n

자바 설치

Apache Solr은 Java로 작성되었습니다. 따라서 서버에 Java가 설치되어 있어야 합니다. 다음 명령을 사용하여 설치할 수 있습니다.

apt-get install default-jdk gnupg2 apt-transport-https wget -y

설치가 완료되면 다음 명령을 사용하여 Java 설치를 확인합니다.

java -version

다음 출력이 표시되어야 합니다.

openjdk version "11.0.12" 2021-07-20
OpenJDK Runtime Environment (build 11.0.12+7-post-Debian-2)
OpenJDK 64-Bit Server VM (build 11.0.12+7-post-Debian-2, mixed mode, sharing)

Debian 11에 Apache Solr 설치

이 튜토리얼을 작성할 당시 Apache Solr의 최신 버전은 8.9.0입니다. 다음 명령을 사용하여 다운로드할 수 있습니다.

wget https://downloads.apache.org/lucene/solr/8.9.0/solr-8.9.0.tgz

다운로드가 완료되면 다음 명령을 사용하여 다운로드한 파일의 압축을 풉니다.

tar xzf solr-8.9.0.tgz

다음으로 다음 명령을 사용하여 Apache Solr을 설치합니다.

bash solr-8.9.0/bin/install_solr_service.sh solr-8.9.0.tgz

Apache Solr이 설치되면 다음과 같은 결과가 표시됩니다.

Service solr installed.
Customize Solr startup configuration in /etc/default/solr.in.sh
? solr.service - LSB: Controls Apache Solr as a Service
     Loaded: loaded (/etc/init.d/solr; generated)
     Active: active (exited) since Sat 2021-09-18 15:28:56 UTC; 5s ago
       Docs: man:systemd-sysv-generator(8)
    Process: 4661 ExecStart=/etc/init.d/solr start (code=exited, status=0/SUCCESS)
        CPU: 7ms

Sep 18 15:28:47 debian11 systemd[1]: Starting LSB: Controls Apache Solr as a Service...
Sep 18 15:28:47 debian11 su[4663]: (to solr) root on none
Sep 18 15:28:47 debian11 su[4663]: pam_unix(su-l:session): session opened for user solr(uid=107) by (uid=0)
Sep 18 15:28:55 debian11 solr[4731]: Started Solr server on port 8983 (pid=4727). Happy searching!
Sep 18 15:28:56 debian11 systemd[1]: Started LSB: Controls Apache Solr as a Service.

기본적으로 Apache Solr은 포트 8983에서 수신합니다. 다음 명령을 사용하여 확인할 수 있습니다.

ss -antpl | grep 8983

다음 출력이 표시되어야 합니다.

LISTEN 0      50                      *:8983            *:*    users:(("java",pid=4727,fd=154))

Apache Solr 서비스 관리

Apache Solr를 시작하려면 다음 명령을 실행합니다.

systemctl start solr

Apache Solr를 중지하려면 다음 명령을 실행합니다.

systemctl stop solr

Apache Solr의 상태를 확인하려면 다음 명령을 실행합니다.

systemctl status solr

Apache Solr 컬렉션 만들기

Apache Solr 기능을 테스트하려면 다음 명령을 사용하여 새 Solr 컬렉션을 만듭니다.

su - solr -c "/opt/solr/bin/solr create -c newcollection -n data_driven_schema_configs"

샘플 출력:

Created new core 'newcollection'

Apache Solr 웹 UI에 액세스

이제 URL http://your-server-ip:8983을 사용하여 Apache Solr 웹 인터페이스에 액세스할 수 있습니다. 다음 화면에 Apache Solr 대시보드가 표시되어야 합니다.

왼쪽 창에서 Core Selector 내부의 mycollection을 클릭하여 이전 단계에서 만든 컬렉션의 통계를 봅니다.

결론

축하합니다! Debian 11에 Apache Solr를 성공적으로 설치했습니다. 이제 Apache Solr를 사용하여 고유한 검색 응용 프로그램을 만들 수 있습니다. 자세한 내용은 Apache Solr 설명서를 참조하십시오.