FESS と Elasticsearch との連携でエラー

FESS v11.2.1 + Elasticsearch v5.4.2 をWindows7上で実装してみた。

社内用なので、FESSに内蔵されてるElasticsearchでもと思ったけど、

今後別のサービスで連携させることもあるかもなので別途設置。

基本的には公式サイトの下記で説明されてる通り。

http://fess.codelibs.org/ja/11.2/install/install.html

ただ、Windowsだと若干設定が違うようでFESS起動すると下記エラーが出まくり!!

重大: Exception starting filter lastaPrepareFilter 
org.lastaflute.di.exception.ContainerInitFailureException: Look! Read the message below. 
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * 
Failed to initialize the container. 
 
[Path] 
esclient.xml 
 
[Namespace] 
null 
 
[Included by] 
esflute_config.xml 
esflute_user.xml 
esflute_log.xml 
* * * * * * * * * */ 
 at org.lastaflute.di.core.meta.impl.LaContainerImpl.throwContainerInitFailureException(LaContainerImpl.java:463)
 at org.lastaflute.di.core.meta.impl.LaContainerImpl.init(LaContainerImpl.java:415)
 at org.lastaflute.di.core.meta.impl.LaContainerImpl.doInit(LaContainerImpl.java:431)
 at org.lastaflute.di.core.meta.impl.LaContainerImpl.init(LaContainerImpl.java:413)
 at org.lastaflute.di.core.meta.impl.LaContainerImpl.doInit(LaContainerImpl.java:431)
 at org.lastaflute.di.core.meta.impl.LaContainerImpl.init(LaContainerImpl.java:413)
 at org.lastaflute.di.core.meta.impl.LaContainerImpl.doInit(LaContainerImpl.java:431)
 at org.lastaflute.di.core.meta.impl.LaContainerImpl.init(LaContainerImpl.java:413)
 at org.lastaflute.di.core.factory.SingletonLaContainerFactory.init(SingletonLaContainerFactory.java:66)
 at org.lastaflute.web.container.WebLastaContainerInitializer.doInitContainer(WebLastaContainerInitializer.java:81)
 at org.lastaflute.web.container.WebLastaContainerInitializer.initialize(WebLastaContainerInitializer.java:45)
 at org.lastaflute.web.servlet.filter.LastaPrepareFilter.initializeContainer(LastaPrepareFilter.java:136)
 at org.lastaflute.web.servlet.filter.LastaPrepareFilter.init(LastaPrepareFilter.java:94)
 at org.apache.catalina.core.ApplicationFilterConfig.initFilter(ApplicationFilterConfig.java:279)
 at org.apache.catalina.core.ApplicationFilterConfig.getFilter(ApplicationFilterConfig.java:260)
 at org.apache.catalina.core.ApplicationFilterConfig.<init>(ApplicationFilterConfig.java:105)
 at org.apache.catalina.core.StandardContext.filterStart(StandardContext.java:4572)
 at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5215)
 at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
 at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1403)
 at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1393)
 at java.util.concurrent.FutureTask.run(FutureTask.java:266)
 at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
 at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
 at java.lang.Thread.run(Thread.java:748)
Caused by: org.lastaflute.di.core.exception.IllegalMethodRuntimeException: [ESSR0060]Can not configure method(open) of org.codelibs.fess.es.client.FessEsClient, because [fess.update] IndexNotFoundException[no such index] 
 at org.lastaflute.di.core.assembler.AbstractMethodAssembler.invoke(AbstractMethodAssembler.java:61)
 at org.lastaflute.di.core.assembler.DefaultInitMethodAssembler.assemble(DefaultInitMethodAssembler.java:40)
 at org.lastaflute.di.core.deployer.SingletonComponentDeployer.assemble(SingletonComponentDeployer.java:57)
 at org.lastaflute.di.core.deployer.SingletonComponentDeployer.deploy(SingletonComponentDeployer.java:41)
 at org.lastaflute.di.core.deployer.SingletonComponentDeployer.init(SingletonComponentDeployer.java:35)
 at org.lastaflute.di.core.meta.impl.ComponentDefImpl.init(ComponentDefImpl.java:83)
 at org.lastaflute.di.core.meta.impl.LaContainerImpl.doInit(LaContainerImpl.java:434)
 at org.lastaflute.di.core.meta.impl.LaContainerImpl.init(LaContainerImpl.java:413)
 ... 23 more
Caused by: [fess.update] IndexNotFoundException[no such index] 
 at org.elasticsearch.cluster.metadata.IndexNameExpressionResolver$WildcardExpressionResolver.infe(IndexNameExpressionResolver.java:660)
 at org.elasticsearch.cluster.metadata.IndexNameExpressionResolver$WildcardExpressionResolver.innerResolve(IndexNameExpressionResolver.java:617)
 at org.elasticsearch.cluster.metadata.IndexNameExpressionResolver$WildcardExpressionResolver.resolve(IndexNameExpressionResolver.java:567)
 at org.elasticsearch.cluster.metadata.IndexNameExpressionResolver.concreteIndices(IndexNameExpressionResolver.java:164)
 at org.elasticsearch.cluster.metadata.IndexNameExpressionResolver.concreteIndexNames(IndexNameExpressionResolver.java:139)
 at org.elasticsearch.cluster.metadata.IndexNameExpressionResolver.concreteIndexNames(IndexNameExpressionResolver.java:72)
 at org.elasticsearch.action.admin.indices.get.TransportGetIndexAction.checkBlock(TransportGetIndexAction.java:63)
 at org.elasticsearch.action.admin.indices.get.TransportGetIndexAction.checkBlock(TransportGetIndexAction.java:47)
 at org.elasticsearch.action.support.master.TransportMasterNodeAction$AsyncSingleAction.doStart(TransportMasterNodeAction.java:134)
 at org.elasticsearch.action.support.master.TransportMasterNodeAction$AsyncSingleAction.start(TransportMasterNodeAction.java:126)
 at org.elasticsearch.action.support.master.TransportMasterNodeAction.doExecute(TransportMasterNodeAction.java:104)
 at org.elasticsearch.action.support.master.TransportMasterNodeAction.doExecute(TransportMasterNodeAction.java:54)
 at org.elasticsearch.action.support.TransportAction$RequestFilterChain.proceed(TransportAction.java:170)
 at org.elasticsearch.action.support.TransportAction.execute(TransportAction.java:142)
 at org.elasticsearch.action.support.HandledTransportAction$TransportHandler.messageReceived(HandledTransportAction.java:64)
 at org.elasticsearch.action.support.HandledTransportAction$TransportHandler.messageReceived(HandledTransportAction.java:54)
 at org.elasticsearch.transport.RequestHandlerRegistry.processMessageReceived(RequestHandlerRegistry.java:69)
 at org.elasticsearch.transport.TcpTransport$RequestHandler.doRun(TcpTransport.java:1488)
 at org.elasticsearch.common.util.concurrent.AbstractRunnable.run(AbstractRunnable.java:37)
 at org.elasticsearch.common.util.concurrent.EsExecutors$1.execute(EsExecutors.java:109)
 at org.elasticsearch.transport.TcpTransport.handleRequest(TcpTransport.java:1445)
 at org.elasticsearch.transport.TcpTransport.messageReceived(TcpTransport.java:1329)
 at org.elasticsearch.transport.netty4.Netty4MessageChannelHandler.channelRead(Netty4MessageChannelHandler.java:74)
 at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:363)
 at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:349)
 at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:341)
 at io.netty.handler.codec.ByteToMessageDecoder.fireChannelRead(ByteToMessageDecoder.java:293)
 at io.netty.handler.codec.ByteToMessageDecoder.fireChannelRead(ByteToMessageDecoder.java:280)
 at io.netty.handler.codec.ByteToMessageDecoder.callDecode(ByteToMessageDecoder.java:396)
 at io.netty.handler.codec.ByteToMessageDecoder.channelRead(ByteToMessageDecoder.java:248)
 at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:363)
 at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:349)
 at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:341)
 at io.netty.channel.ChannelInboundHandlerAdapter.channelRead(ChannelInboundHandlerAdapter.java:86)
 at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:363)
 at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:349)
 at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:341)
 at io.netty.channel.DefaultChannelPipeline$HeadContext.channelRead(DefaultChannelPipeline.java:1334)
 at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:363)
 at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:349)
 at io.netty.channel.DefaultChannelPipeline.fireChannelRead(DefaultChannelPipeline.java:926)
 at io.netty.channel.nio.AbstractNioByteChannel$NioByteUnsafe.read(AbstractNioByteChannel.java:129)
 at io.netty.channel.nio.NioEventLoop.processSelectedKey(NioEventLoop.java:642)
 at io.netty.channel.nio.NioEventLoop.processSelectedKeysPlain(NioEventLoop.java:527)
 at io.netty.channel.nio.NioEventLoop.processSelectedKeys(NioEventLoop.java:481)
 at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:441)
 at io.netty.util.concurrent.SingleThreadEventExecutor$5.run(SingleThreadEventExecutor.java:858)
 ... 1 more

試行錯誤した結果、FESSで設定したElasticsearchのディレクトリを正しく参照できてないからっぽい。

ということで行った修正を載せとく。

前提条件としてFESS, Elasticsearchはそれぞれ単独では動く状態。

で、まずはこれ。

FESS にアクセスするために、/etc/elasticsearch/elasticsearch.yml に下記の設定を加えます。

configsync.config_path: /var/lib/elasticsearch/config

そもそもElasticsearchのv5.4.2は(v5.3.3も)はファイルの場所が異なり、

Windowsだけかもしれないけど、/config/elasticsearch.ymlで存在する。

そして、WindowsはCドライブとかあるのでこんな感じで修正。

configsync.config_path: "c:/elasticsearch/config"

続いてFESS側の設定。

Fess でElasticsearchクラスタへ接続するためには、起動オプションで指定します。 Windows環境では fess-<version>\bin\fess.in.batを変更します。 elasticss.dictionary.pathにはelasticsearch.ymlに設定したconfigsync.config_pathの値を設定してください。

set FESS_PARAMS=%FESS_PARAMS% -Dfess.es.http_address=http://localhost:9200
set FESS_PARAMS=%FESS_PARAMS% -Dfess.es.transport_addresses=localhost:9300
set FESS_PARAMS=%FESS_PARAMS% -Dfess.dictionary.path="c:/<elasticsearch-<version>/data/"

これ、なんか全然違う。

Windows版(?)はこちら。

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.es.transport_addresses=localhost:9300
REM set FESS_JAVA_OPTS=%FESS_JAVA_OPTS% -Dfess.dictionary.path=%ES_HOME%/config/

まず91行目辺りにあるES_HOMEを下記のように修正。

set ES_HOME="c:/elasticsearch"

続いて最下部にある3行のコメントアウトを取る。

REM External elasticsearch cluster
set FESS_JAVA_OPTS=%FESS_JAVA_OPTS% -Dfess.es.http_address=http://localhost:9200
set FESS_JAVA_OPTS=%FESS_JAVA_OPTS% -Dfess.es.transport_addresses=localhost:9300
set FESS_JAVA_OPTS=%FESS_JAVA_OPTS% -Dfess.dictionary.path=%ES_HOME%/config/

これで動いた\(^o^)/

 

※しかし、マシンのスペック的に厳しく・・・本番稼働には至りませんでした・・。

 

コメントを残す

メールアドレスが公開されることはありません。 * が付いている欄は必須項目です

CAPTCHA