2013년 12월 19일 목요일

Managing Solr Cores

solr를 운영하다 보면 하나의 core 보다는 여러개의 core를 운영하는 경우가 많다. 여기서는 이러한 solr의 core를 쉽게 관리할 수 있는 방법을 다룬다.

core의 관리는 HTTP를 통해 이루어 지며 이러한 편리성은 다른 어플리케이션에 쉽게 이식될 수 있다. 또한 core 관리를 위한 특정 commad 수행시 적용을 위해 solr를 restart 하지 않고 runtime 상태에서 적용되게 할 수 있다.
이를 위해서는 solr home 디렉토리의 solr.xml 파일에서 persistent="false"로 설정이 되어야 한다.

아래는 core 관리를 위한 명령들이며, 모두 solr 서버를 재시작 하지 않고(on the fly) 적용할 수 있다.

STATUS


모든 core의 또는 특정 core의 상태를 확인할 수 있다.
  http://localhost:8983/solr/admin/cores?action=STATUS&core=core0

schema.xml, solrconfig.xml 등의 정보가 수정되었을 경우 reload 한다.

MERGE


Multi-core로 나뉘어진 인덱싱 데이터를 재인덱싱 하지 않고 single index로 merge 한다.
Before solr1.4
After solr3.3

위의 명령은 core1과 core2를 core0로 merge한다.
이 명령을 실행하기 이전에 core1과 core2에 대해 commit 명령이 호출되어야 한다. 이는 해당 core에 대해 merge 작업이 완료될 때까지 write를 막기 위해서 IndexWriter를 닫는 것이다. merge가 완료되면 core0에 대해 commit 명령을 호출함으로써 검색이 가능한 상태가 된다.

[INFO]
"The above command will merge the indexes of core1 and core2 into core0.
The path for this command is the 'adminPath' defined in solr.xml (default is /admin/cores).
Before executing this command, one must make sure to call commit on core1 and core2 (in order to close IndexWriter) and no writes should happen on core1 and core2 until the merge command completes. Failure to do so may corrupt the core0 index. Once the merge is completed, a commit should be called on core0 to make the changes visible to searchers."

   http://127.0.0.1:8983/solr2/jptr01/update?optimize=true

NOTE: In this example core0 must exist and have a compatible schema with core1 and core2. The 'mergeindexes' command will not create a new core named 'core0' if it does not already exist.

댓글 없음:

댓글 쓰기