プロジェクト

全般

プロフィール

Growiで全文検索できないときの対処方法

バージョン 1 (手動人形, 2023/08/09 20:56) → バージョン 2/3 (手動人形, 2023/08/09 20:57)

{{TOC}}

### 概要

![]( picture636-1.png)

サーバのパッケージアップデート後、Growiで全文検索ができない現象が発生しました。

### 状況確認

- elasticsearch状況確認

```bash
systemctl status elasticsearch.service
```

- 状況確認結果

```bash

● elasticsearch.service - Elasticsearch
Loaded: loaded (/lib/systemd/system/elasticsearch.service; enabled; vendor preset: enabled)
Active: failed (Result: exit-code) since Wed 2023-08-09 20:32:57 JST; 12min ago
Docs: https://www.elastic.co
Process: 992 ExecStart=/usr/share/elasticsearch/bin/systemd-entrypoint -p ${PID_DIR}/elasticsearch.pid --quiet (code=exited, status=1/FAI>
Main PID: 992 (code=exited, status=1/FAILURE)

8月 09 20:32:56 chisato.lyco.reco systemd-entrypoint[992]: at org.elasticsearch.bootstrap.Elasticsearch.execute(Elasticsearch.java:1>
8月 09 20:32:56 chisato.lyco.reco systemd-entrypoint[992]: at org.elasticsearch.cli.EnvironmentAwareCommand.execute(EnvironmentAware>
8月 09 20:32:56 chisato.lyco.reco systemd-entrypoint[992]: at org.elasticsearch.cli.Command.mainWithoutErrorHandling(Command.java:11>
8月 09 20:32:56 chisato.lyco.reco systemd-entrypoint[992]: at org.elasticsearch.cli.Command.main(Command.java:77)
8月 09 20:32:56 chisato.lyco.reco systemd-entrypoint[992]: at org.elasticsearch.bootstrap.Elasticsearch.main(Elasticsearch.java:125)
8月 09 20:32:56 chisato.lyco.reco systemd-entrypoint[992]: at org.elasticsearch.bootstrap.Elasticsearch.main(Elasticsearch.java:80)
8月 09 20:32:56 chisato.lyco.reco systemd-entrypoint[992]: For complete error details, refer to the log at /var/log/elasticsearch/elasticsea>
8月 09 20:32:57 chisato.lyco.reco systemd[1]: elasticsearch.service: Main process exited, code=exited, status=1/FAILURE
8月 09 20:32:57 chisato.lyco.reco systemd[1]: elasticsearch.service: Failed with result 'exit-code'.
8月 09 20:32:57 chisato.lyco.reco systemd[1]: Failed to start Elasticsearch.
lines 1-17/17 (END)
```
→ ElasticSearchがうまく稼働していない事象を確認。

### 原因調査

- ElasticSearchのログ確認

```bash
sudo tail -50 /var/log/elasticsearch/elasticsearch.log
``` ---

- ログ抜粋

```bash
[2023-08-09T20:32:56,947][ERROR][o.e.b.ElasticsearchUncaughtExceptionHandler] [chisato.lyco.reco] uncaught exception in thread [main]
org.elasticsearch.bootstrap.StartupException: java.lang.IllegalArgumentException: Plugin [analysis-icu] was built for Elasticsearch version 7.17.10 but version 7.17.12 is running
at org.elasticsearch.bootstrap.Elasticsearch.init(Elasticsearch.java:173) ~[elasticsearch-7.17.12.jar:7.17.12]

```

と、パッケージ更新時にElasticSearchが上がったのに、その中のプラグインが対応していないためこの事象が発生です。

### 対処

1. 入っていたプラグインをアンインストール
1. 最新バージョンのプラグインを再インストール
1. プラグイン再インストール後にElasticSearch起動

と、割と単純な作業です。

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

```bash
sudo /usr/share/elasticsearch/bin/elasticsearch-plugin remove analysis-icu
sudo /usr/share/elasticsearch/bin/elasticsearch-plugin remove analysis-kuromoji
```
- プラグインの再インストール

```bash
sudo /usr/share/elasticsearch/bin/elasticsearch-plugin install analysis-icu
sudo /usr/share/elasticsearch/bin/elasticsearch-plugin install analysis-kuromoji
```

- ElasticSearch起動

```bash
sudo systemctl restart elasticsearch.service
# 環境によってはサービス起動まで時間が掛かります
```

- ElasticSearch起動確認

```bash
systemctl status elasticsearch.service
```

```bash
● elasticsearch.service - Elasticsearch
Loaded: loaded (/lib/systemd/system/elasticsearch.service; enabled; vendor preset: enabled)
Active: active (running) since Wed 2023-08-09 20:53:39 JST; 27s ago
Docs: https://www.elastic.co
Main PID: 2930 (java)
Tasks: 93 (limit: 9152)
Memory: 786.6M
CGroup: /system.slice/elasticsearch.service
├─2930 /usr/share/elasticsearch/jdk/bin/java -Xshare:auto -Des.networkaddress.cache.ttl=60 -Des.networkaddress.cache.negative.tt>
└─3114 /usr/share/elasticsearch/modules/x-pack-ml/platform/linux-x86_64/bin/controller

8月 09 20:53:14 chisato.lyco.reco systemd[1]: Starting Elasticsearch...
8月 09 20:53:39 chisato.lyco.reco systemd[1]: Started Elasticsearch.
```

起動を確認。

### Growiで事象の解消確認

1. Growiアプリにブラウザでアクセスします。
1. 管理者権限でログインします。
1. 設定>Elasticsearch管理を進み、以下のように接続されていればOKです。

![](picture636-2.png)
トップへ
クリップボードから画像を追加 (サイズの上限: 50 MB)