LoginSignup
4
7

More than 3 years have passed since last update.

Windows OS への Fess + 外部 Elasticsearch 導入手順

Last updated at Posted at 2021-01-26

Fess 公式サイトで配布されている ZIP パッケージは Elasticsearch が同梱されている為、ファイル展開後に即 Fess を利用できる。しかし、組込 Elasticsearch での本番運用は推奨されておらず、下記のように管理画面に注意喚起が表示されてしまう。
image.png
その為、別途 Elasticsearch の導入が必要である。

環境情報

  • Windows10 Pro 64bit
  • Java SE Development Kit 11.0.10
  • Fess 13.9.3
  • Elasticsearch 7.9.3
    • elasticsearch-analysis-fess 7.9.0
    • elasticsearch-analysis-extension 7.9.1
    • elasticsearch-configsync 7.9.0
    • elasticsearch-dataformat 7.9.0
    • elasticsearch-minhash 7.9.1

Fess と Elasticsearch のバージョンは下記の動作確認済の組み合わせを使用する。
https://fess.codelibs.org/ja/downloads.html

補足

当初、何も考えず最新の JDK 15.0.2 をインストールしていた為、Fess 起動時にエラーが発生した。
Fess のインストール要件は Java 11 である点に注意が必要。
https://fess.codelibs.org/ja/13.9/install/install.html

以下が fess.bat 実行時に発生したエラーの一例。

java.lang.NoClassDefFoundError: Could not initialize class org.codehaus.groovy.vmplugin.v7.Java7
        at org.codehaus.groovy.vmplugin.VMPluginFactory.<clinit>(VMPluginFactory.java:43)
        at org.codehaus.groovy.reflection.GroovyClassValueFactory.<clinit>(GroovyClassValueFactory.java:35)
        at org.codehaus.groovy.reflection.ClassInfo.<clinit>(ClassInfo.java:107)
        at org.codehaus.groovy.reflection.ReflectionCache.getCachedClass(ReflectionCache.java:95)
        at org.codehaus.groovy.reflection.ReflectionCache.<clinit>(ReflectionCache.java:39)
        at org.codehaus.groovy.runtime.metaclass.MetaClassRegistryImpl.registerMethods(MetaClassRegistryImpl.java:210)
        at org.codehaus.groovy.runtime.metaclass.MetaClassRegistryImpl.<init>(MetaClassRegistryImpl.java:108)
        at org.codehaus.groovy.runtime.metaclass.MetaClassRegistryImpl.<init>(MetaClassRegistryImpl.java:86)
        at groovy.lang.GroovySystem.<clinit>(GroovySystem.java:36)
        at org.codehaus.groovy.runtime.InvokerHelper.<clinit>(InvokerHelper.java:86)
        at groovy.lang.GroovyObjectSupport.getDefaultMetaClass(GroovyObjectSupport.java:59)
        at groovy.lang.GroovyObjectSupport.<init>(GroovyObjectSupport.java:32)
        at groovy.lang.Binding.<init>(Binding.java:36)
        at org.codelibs.fess.util.GroovyUtil.evaluate(GroovyUtil.java:40)
        at org.codelibs.fess.job.impl.GroovyExecutor.execute(GroovyExecutor.java:31)
        at org.codelibs.fess.app.job.ScriptExecutorJob.run(ScriptExecutorJob.java:91)
        at org.lastaflute.job.LaJobRunner.actuallyRun(LaJobRunner.java:265)
        at org.lastaflute.job.LaJobRunner.doRun(LaJobRunner.java:232)
        at org.lastaflute.job.LaJobRunner.run(LaJobRunner.java:182)
        at org.lastaflute.job.cron4j.Cron4jTask.runJob(Cron4jTask.java:371)
        at org.lastaflute.job.cron4j.Cron4jTask.actuallyExecute(Cron4jTask.java:355)
        at org.lastaflute.job.cron4j.Cron4jTask.lambda$doExecute$6(Cron4jTask.java:258)
        at org.lastaflute.job.cron4j.Cron4jTask.synchronizedNeighborRunning(Cron4jTask.java:328)
        at org.lastaflute.job.cron4j.Cron4jTask.doExecute(Cron4jTask.java:246)
        at org.lastaflute.job.cron4j.Cron4jTask.execute(Cron4jTask.java:151)
        at it.sauronsoftware.cron4j.RomanticCron4jNativeTaskExecutor$RomanticRunner.run(RomanticCron4jNativeTaskExecutor.java:121)
        at java.base/java.lang.Thread.run(Thread.java:832)

JDK 導入

JDK のインストール

Windows x64 Installer
jdk-11.0.10_windows-x64_bin.exe

image.png

環境変数・パスの設定

コントロールパネル > システム > システムの詳細設定 > 環境変数

以下の内容で新規環境変数 JAVA_HOME を登録する。その後、環境変数 Path%JAVA_HOME%\bin を追記する。

変数名 変数値
JAVA_HOME C:\Program Files\Java\jdk-11.0.10

Elasticsearch 導入

Elasticsearch のインストール

elasticsearch-7.9.3-windows-x86_64.zip

C:\elasticsearch-7.9.3 に展開。

プラグインのインストール

以下のプラグインをコマンドプロンプトからインストールする。

  • elasticsearch-analysis-fess
  • elasticsearch-analysis-extension
  • elasticsearch-configsync
  • elasticsearch-dataformat
  • elasticsearch-minhash

プラグインのバージョン指定は以下を参照。
https://fess.codelibs.org/ja/13.9/install/install.html

C:/elasticsearch-7.9.3/bin/elasticsearch-plugin install org.codelibs:elasticsearch-analysis-fess:7.9.0

image.png

C:/elasticsearch-7.9.3/bin/elasticsearch-plugin install org.codelibs:elasticsearch-analysis-extension:7.9.1

image.png

C:/elasticsearch-7.9.3/bin/elasticsearch-plugin install org.codelibs:elasticsearch-configsync:7.9.0

image.png

C:/elasticsearch-7.9.3/bin/elasticsearch-plugin install org.codelibs:elasticsearch-dataformat:7.9.0

image.png

C:/elasticsearch-7.9.3/bin/elasticsearch-plugin install org.codelibs:elasticsearch-minhash:7.9.1

image.png

設定の追加

elasticsearch-7.9.3\config\elasticsearch.yml
configsync.config_path: C:/elasticsearch-7.9.3/config/

Fess 導入

Fess のインストール

fess-13.9.3.zip

C:\fess-13.9.3 に展開。

設定の変更

118行目のコメントアウト(REM)を解除する。

fess-13.9.3\bin\fess.in.bat
REM External elasticsearch cluster
REM set FESS_JAVA_OPTS=%FESS_JAVA_OPTS% -Dfess.es.http_address=http://localhost:9200
REM set FESS_JAVA_OPTS=%FESS_JAVA_OPTS% -Dfess.dictionary.path=%ES_HOME%/config/

 ↓ 変更

fess-13.9.3\bin\fess.in.bat
REM External elasticsearch cluster
set FESS_JAVA_OPTS=%FESS_JAVA_OPTS% -Dfess.es.http_address=http://localhost:9200
REM set FESS_JAVA_OPTS=%FESS_JAVA_OPTS% -Dfess.dictionary.path=%ES_HOME%/config/

起動

Elasticsearch ⇒ Fess の順に起動する。

Elasticsearch の起動と確認

C:\elasticsearch-7.9.3\bin\elasticsearch.bat を実行する。

略
[2021-01-21T10:02:21,286][INFO ][o.e.n.Node                 ] [hoge] started
[2021-01-21T10:02:29,003][INFO ][o.e.c.r.a.AllocationService] [hoge] Cluster health status changed from [RED] to [GREEN] (reason: [shards started [[.configsync][0]]]).
[2021-01-21T10:02:29,061][INFO ][o.c.e.c.s.ConfigSyncService] [hoge] ConfigFileUpdater is started at 1m intervals.

Elasticsearch 起動状態の確認
http://localhost:9200/

{
  "name": "hoge",
  "cluster_name": "elasticsearch",
  "cluster_uuid": "hoge",
  "version": {
    "number": "7.9.3",
    "build_flavor": "default",
    "build_type": "zip",
    "build_hash": "hoge",
    "build_date": "2020-10-16T10:36:16.141335Z",
    "build_snapshot": false,
    "lucene_version": "8.6.2",
    "minimum_wire_compatibility_version": "6.8.0",
    "minimum_index_compatibility_version": "6.0.0-beta1"
  },
  "tagline": "You Know, for Search"
}

Elasticsearch プラグイン導入状態の確認
http://localhost:9200/_cat/plugins?v&s=component&h=name,component,version,description&pretty

name component          version description
hoge analysis-extension 7.9.1   This plugin provides an analysis library.
hoge analysis-fess      7.9.0   FessAnalysis Plugin for Elasticsearch
hoge configsync         7.9.0   ConfigSync plugin syncs up with configuration files in .configsync index.
hoge dataformat         7.9.0   This plugin provides several response formats.
hoge minhash            7.9.1   This plugin provides b-bit minhash algorism.

Fess の起動と確認

C:\fess-13.9.3\bin\fess.bat を実行する。

http://localhost:8080/
localhost_8080_.png
Fess 検索画面が表示されることを確認する。

参考

https://qiita.com/RoG/items/10563df2fc40999d2367
https://news.mynavi.jp/itsearch/article/bizapp/4320

4
7
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
4
7