ご多用のところ恐れ入ります。下記の通り質問させてください。
※不足情報ある場合は大変お手数ですがコメントいただければ幸いです。
■質問内容
Docker版のFessをプロキシ経由でElasticCloudと接続したい場合に、プロキシ設定はどのように行えば良いでしょうか?
※また、原因がプロキシだと考えていますが、もしも違う可能性が考えられる場合はコメントいただきたいです。
■背景、補足情報
- 社内イントラネット内のサーバーにDocker版のFessを構築し、社外のElasticCloudにプロキシ経由で接続したい。
- Elastic CloudはElastic Cloudの利用方法を参考に構築し、Fessもこちらに記載のある「docker run」の方法でFess用のコンテナを作りました。
- 起動直後は、fess.logに下記のログが出ますが、その後はログは出ず、しばらくたってから下記のログが出たのちにFessコンテナがStopします。
{"@timestamp":"2023-05-09T09:02:20.511Z","log.level": "WARN","message":"[【接続したいElasticSearchエンドポイントURL】][green] node is not available. (ConnectException: Connection timed out)", "ecs.version": "1.2.0","service.name":"fess","event.dataset":"app","process.thread.name":"FesenNodeManager-1","log.logger":"org.codelibs.fesen.client.node.NodeManager"}
- しばらくたってからfess.logとserver_0.logに出るログ(ほぼ同じ内容が出力される)
[main] ERROR Failed to initialize Lasta Di.
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
* * * * * * * * * */
(中略)
Caused by: org.lastaflute.di.core.exception.IllegalMethodRuntimeException: [ESSR0060]Can not configure method(open) of org.codelibs.fess.es.client.SearchEngineClient, because org.lastaflute.di.exception.ContainerInitFailureException: Fesen (【接続したいElasticSerchのエンドポイントURL】) is not available. Check the state of your Fesen cluster (fesen) in 7701593ms.
(中略)
Caused by: org.codelibs.curl.CurlException: Failed to access to 【接続したいElasticSerchのエンドポイントURL】/_cluster/health/?wait_for_no_relocating_shards=false&wait_for_no_initializing_shards=false&wait_for_nodes=&wait_for_status=yellow&wait_for_active_shards=0&wait_for_active_shards=0&timeout=30s&master_timeout=30s
(中略)
Caused by: org.codelibs.curl.CurlException: Failed to access the response.
at org.codelibs.curl.CurlRequest$RequestProcessor.accept(CurlRequest.java:272) ~[curl4j-1.2.4.jar:?]
(中略)
Caused by: java.net.ConnectException: Connection timed out (Connection timed out)
(中略)
■既に試したこと、把握していること
-
プロキシの設定 (codelibs.org)はクロール先がイントラネット外部サイトである場合の設定方法だと認識
- fess.in.shにJava実行時の環境変数としてプロキシを設定する方法は実施済みだが、上手くいっていない。
■バージョン情報
Fess : 14.7.0
Elasticsearch : 8.6.2 # Elastic Cloud上に構築
コンテナ構築環境のOS : Linux
以上です、よろしくお願いします。
将来のリリースでは対応しようかとは思いますが、現時点では、fesen-httpclientに機能追加しないと、そこにプロキシは設定できないと思います。
もしかしたら、FESS_JAVA_OPTS="-Dhttps.proxyHost=... -Dhttps.proxyPort=..."
を設定すれば、通るかもしれませんが、試してみないとわからないですね…。
ご回答ありがとうございます。こちらはfess.in.shに下記のように追記するイメージでしょうか?
+ FESS_JAVA_OPTS="$FESS_JAVA_OPTS -Dhttp.proxyPort=【ポート番号】"
+ FESS_JAVA_OPTS="$FESS_JAVA_OPTS -Dhttp.proxyHost=【ホスト名】"
+ FESS_JAVA_OPTS="$FESS_JAVA_OPTS -Dhttp.proxyUser=【ユーザー】"
+ FESS_JAVA_OPTS="$FESS_JAVA_OPTS -Dhttp.proxyPassword=【パスワード】"
+ FESS_JAVA_OPTS="$FESS_JAVA_OPTS -Dhttps.proxyPort=【ポート番号】"
+ FESS_JAVA_OPTS="$FESS_JAVA_OPTS -Dhttps.proxyHost=【ホスト名】"
+ FESS_JAVA_OPTS="$FESS_JAVA_OPTS -Dhttps.proxyUser=【ユーザー】"
+ FESS_JAVA_OPTS="$FESS_JAVA_OPTS -Dhttps.proxyPassword=【パスワード】"
上記で試したところserver_0.logに下記の通り出力されました。
タイムアウトではなくなったのでプロキシに阻まれたことが原因ではなさそうですが、エラーになりました。やはり最初にコメントいただいた、fesen-httpclientへの機能追加(HttpClient.javaのrequestオブジェクトにproxyを設定できるようにする?)が必要でしょうか。
(中略)
INFO: No global web.xml found
May 11, 2023 12:56:54 AM org.apache.catalina.core.StandardContext filterStart
SEVERE: 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
* * * * * * * * * */
(中略)
Caused by: org.lastaflute.di.core.exception.IllegalMethodRuntimeException: [ESSR0060]Can not configure method(open) of org.codelibs.fess.es.client.SearchEngineClient, because org.lastaflute.di.exception.ContainerInitFailureException: Fesen (【ElasticSearchのエンドポイントURL】) is not available. Check the state of your Fesen cluster (fesen) in 60444ms.
(中略)
Caused by: org.lastaflute.di.exception.ContainerInitFailureException: Fesen (【ElasticSearchのエンドポイントURL】) is not available. Check the state of your Fesen cluster (fesen) in 60444ms.
(中略)
Caused by: org.codelibs.curl.CurlException: Failed to access to 【ElasticSearchのエンドポイントURL】/_cluster/health/?wait_for_no_relocating_shards=false&wait_for_no_initializing_shards=false&wait_for_nodes=&wait_for_status=yellow&wait_for_active_shards=0&wait_for_active_shards=0&timeout=30s&master_timeout=30s
(中略)
Caused by: org.codelibs.curl.CurlException: Failed to write a response.
at org.codelibs.curl.CurlRequest$RequestProcessor.writeContent(CurlRequest.java:367)
at org.codelibs.curl.CurlRequest$RequestProcessor.accept(CurlRequest.java:314)
at org.codelibs.curl.CurlRequest.lambda$execute$5(CurlRequest.java:258)
at org.codelibs.curl.CurlRequest.lambda$connect$4(CurlRequest.java:231)
... 6 more
Caused by: java.io.IOException: Stream closed
at java.base/java.io.BufferedInputStream.getInIfOpen(Unknown Source)
at java.base/java.io.BufferedInputStream.fill(Unknown Source)
at java.base/java.io.BufferedInputStream.read1(Unknown Source)
at java.base/java.io.BufferedInputStream.read(Unknown Source)
at java.base/java.io.FilterInputStream.read(Unknown Source)
at org.codelibs.curl.CurlRequest$RequestProcessor.writeContent(CurlRequest.java:341)
... 9 more
May 11, 2023 12:56:54 AM org.apache.catalina.core.StandardContext startInternal
SEVERE: One or more Filters failed to start. Full details will be found in the appropriate container log file
May 11, 2023 12:56:54 AM org.apache.catalina.core.StandardContext startInternal
SEVERE: Context [] startup failed due to previous errors
May 11, 2023 12:56:55 AM org.apache.catalina.loader.WebappClassLoaderBase clearReferencesThreads
WARNING: The web application [ROOT] appears to have started a thread named [FesenNodeManager-1] but has failed to stop it. This is very likely to create a memory leak. Stack trace of thread:
java.base@17.0.6/java.lang.Object.wait(Native Method)
java.base@17.0.6/java.util.TimerThread.mainLoop(Unknown Source)
java.base@17.0.6/java.util.TimerThread.run(Unknown Source)
May 11, 2023 12:56:55 AM org.apache.catalina.loader.WebappClassLoaderBase clearReferencesThreads
WARNING: The web application [ROOT] appears to have started a thread named [eshttp] but has failed to stop it. This is very likely to create a memory leak. Stack trace of thread:
java.base@17.0.6/jdk.internal.misc.Unsafe.park(Native Method)
java.base@17.0.6/java.util.concurrent.locks.LockSupport.parkUntil(Unknown Source)
java.base@17.0.6/java.util.concurrent.ForkJoinPool.awaitWork(Unknown Source)
java.base@17.0.6/java.util.concurrent.ForkJoinPool.runWorker(Unknown Source)
java.base@17.0.6/java.util.concurrent.ForkJoinWorkerThread.run(Unknown Source)
May 11, 2023 12:56:55 AM org.apache.catalina.loader.WebappClassLoaderBase clearReferencesObjectStreamClassCaches
WARNING: When running on Java 9 or later you need to add "--add-opens=java.base/java.io=ALL-UNNAMED" to the JVM command line arguments to enable ObjectStream cache memory leak protection. Alternatively, you can suppress this warning by disabling ObjectStream class cache memory leak protection.
May 11, 2023 12:56:55 AM org.apache.catalina.loader.WebappClassLoaderBase checkThreadLocalsForLeaks
WARNING: When running on Java 9 or later you need to add "--add-opens=java.base/java.lang=ALL-UNNAMED" to the JVM command line arguments to enable ThreadLocal memory leak detection. Alternatively, you can suppress this warning by disabling ThreadLocal memory leak detection.
May 11, 2023 12:56:55 AM org.apache.catalina.loader.WebappClassLoaderBase clearReferencesRmiTargets
WARNING: When running on Java 9 or later you need to add "--add-opens=java.rmi/sun.rmi.transport=ALL-UNNAMED" to the JVM command line arguments to enable RMI Target memory leak detection. Alternatively, you can suppress this warning by disabling RMI Target memory leak detection.
May 11, 2023 12:56:55 AM org.apache.coyote.AbstractProtocol start
INFO: Starting ProtocolHandler ["http-nio-8080"]
May 11, 2023 12:56:55 AM org.dbflute.tomcat.logging.BootLogger info
INFO: Boot successful: url -> http://localhost:8080
以上です、よろしくお願いします。
Dockerに環境変数として、FESS_JAVA_OPTSを渡せば良いと思います。
通信ができてはいないようなので、その設定が有効かどうかは判断できませんが、fesen-httpclientでプロキシ情報を渡すようにするのが確実だとは思います。
コメントありがとうございます。
Dockerに環境変数として、FESS_JAVA_OPTSを渡す方法では解決しませんでした。
fesen-httpclientの機能追加を待たせていただきたいと思います。
ご多用のところ、ご対応いただきありがとうございます。