⇧ amazing...
Elasticsearch、Logstash、Kibanaをインストールしたので起動確認
前回、
⇧ Elasticsearch、Logstash、Kibanaをインストールしてみたのですが、何故か、WSL 2(Windows SubSystem for Linux 2)のUbuntuを再起動したら、Elasticsearchのサービスが起動していなかったので、起動しようと試みたのですが、
⇧ 起動しない...
Elasticsearchのログを確認してみた。
sudo vi /var/log/elasticsearch/elasticsearch.log
[2022-12-30T10:26:09,455][WARN ][i.n.u.i.PlatformDependent] [Toshinobu-PC] Failed to get the temporary directory; falling back to: /tmp [2022-12-30T10:26:10,475][ERROR][o.e.b.Elasticsearch ] [Toshinobu-PC] fatal exception while booting Elasticsearch java.security.AccessControlException: access denied ("java.io.FilePermission" "/tmp" "read") at java.security.AccessControlContext.checkPermission(AccessControlContext.java:485) ~[?:?] at java.security.AccessController.checkPermission(AccessController.java:1068) ~[?:?] at java.lang.SecurityManager.checkPermission(SecurityManager.java:411) ~[?:?] at java.lang.SecurityManager.checkRead(SecurityManager.java:751) ~[?:?] at sun.nio.fs.UnixPath.checkRead(UnixPath.java:780) ~[?:?] at sun.nio.fs.UnixFileSystemProvider.checkAccess(UnixFileSystemProvider.java:294) ~[?:?] at java.nio.file.Files.createDirectories(Files.java:772) ~[?:?] at org.elasticsearch.ingest.geoip.DatabaseNodeService.initialize(DatabaseNodeService.java:157) ~[?:?] at org.elasticsearch.ingest.geoip.IngestGeoIpPlugin.createComponents(IngestGeoIpPlugin.java:123) ~[?:?] at org.elasticsearch.node.Node.lambda$new$16(Node.java:709) ~[elasticsearch-8.5.3.jar:?] at org.elasticsearch.plugins.PluginsService.lambda$flatMap$0(PluginsService.java:252) ~[elasticsearch-8.5.3.jar:?] at java.util.stream.ReferencePipeline$7$1.accept(ReferencePipeline.java:273) ~[?:?] at java.util.stream.ReferencePipeline$3$1.accept(ReferencePipeline.java:197) ~[?:?] at java.util.AbstractList$RandomAccessSpliterator.forEachRemaining(AbstractList.java:722) ~[?:?] at java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:509) ~[?:?] at java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:499) ~[?:?] at java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:575) ~[?:?] at java.util.stream.AbstractPipeline.evaluateToArrayNode(AbstractPipeline.java:260) ~[?:?] at java.util.stream.ReferencePipeline.toArray(ReferencePipeline.java:616) ~[?:?] at java.util.stream.ReferencePipeline.toArray(ReferencePipeline.java:622) ~[?:?] at java.util.stream.ReferencePipeline.toList(ReferencePipeline.java:627) ~[?:?] at org.elasticsearch.node.Node.<init>(Node.java:724) ~[elasticsearch-8.5.3.jar:?] at org.elasticsearch.node.Node.<init>(Node.java:318) ~[elasticsearch-8.5.3.jar:?] at org.elasticsearch.bootstrap.Elasticsearch$2.<init>(Elasticsearch.java:214) ~[elasticsearch-8.5.3.jar:?] at org.elasticsearch.bootstrap.Elasticsearch.initPhase3(Elasticsearch.java:214) ~[elasticsearch-8.5.3.jar:?] at org.elasticsearch.bootstrap.Elasticsearch.main(Elasticsearch.java:67) ~[elasticsearch-8.5.3.jar:?]
⇧ なんか、エラー出てるし...
⇧ 上記サイト様を参考に、対応してみる。
⇧ tmpファイルの権限は意味がなかった...
ログを確認。
sudo journalctl --unit elasticsearch
-- Logs begin at Thu 2022-12-29 21:10:25 JST, end at Fri 2022-12-30 11:27:15 JST. -- Dec 29 21:45:41 Toshinobu-PC systemd[1]: Starting Elasticsearch... Dec 29 21:46:00 Toshinobu-PC systemd[1]: Started Elasticsearch. Dec 29 22:55:05 Toshinobu-PC systemd-entrypoint[818]: ERROR: Elasticsearch exited unexpectedly Dec 29 22:55:05 Toshinobu-PC systemd[1]: elasticsearch.service: Main process exited, code=exited, status=137/n/a Dec 29 22:55:05 Toshinobu-PC systemd[1]: elasticsearch.service: Failed with result 'exit-code'. -- Reboot -- Dec 30 09:57:08 Toshinobu-PC systemd[1]: Starting Elasticsearch... Dec 30 09:58:37 Toshinobu-PC systemd[1]: Starting Elasticsearch... -- Reboot -- Dec 30 10:09:56 Toshinobu-PC systemd[1]: Starting Elasticsearch... Dec 30 10:10:40 Toshinobu-PC systemd[1]: Starting Elasticsearch... Dec 30 10:11:35 Toshinobu-PC systemd[1]: Starting Elasticsearch... Dec 30 10:13:00 Toshinobu-PC systemd[1]: Starting Elasticsearch... Dec 30 10:13:35 Toshinobu-PC systemd[1]: Starting Elasticsearch... -- Reboot -- Dec 30 10:18:04 Toshinobu-PC systemd[1]: Starting Elasticsearch... Dec 30 10:21:27 Toshinobu-PC systemd-entrypoint[266]: ERROR: Elasticsearch exited unexpectedly Dec 30 10:21:27 Toshinobu-PC systemd[1]: elasticsearch.service: Main process exited, code=exited, status=137/n/a Dec 30 10:21:27 Toshinobu-PC systemd[1]: elasticsearch.service: Failed with result 'exit-code'. Dec 30 10:21:27 Toshinobu-PC systemd[1]: Failed to start Elasticsearch. Dec 30 10:24:39 Toshinobu-PC systemd[1]: Starting Elasticsearch... Dec 30 10:25:56 Toshinobu-PC systemd[1]: elasticsearch.service: start operation timed out. Terminating. Dec 30 10:26:04 Toshinobu-PC systemd[1]: elasticsearch.service: Failed with result 'timeout'. Dec 30 10:26:04 Toshinobu-PC systemd[1]: Failed to start Elasticsearch. Dec 30 10:52:50 Toshinobu-PC systemd[1]: Starting Elasticsearch... Dec 30 10:54:05 Toshinobu-PC systemd[1]: elasticsearch.service: start operation timed out. Terminating. Dec 30 10:54:08 Toshinobu-PC systemd[1]: elasticsearch.service: Failed with result 'timeout'. Dec 30 10:54:08 Toshinobu-PC systemd[1]: Failed to start Elasticsearch. Dec 30 11:00:41 Toshinobu-PC systemd[1]: Starting Elasticsearch... Dec 30 11:00:43 Toshinobu-PC systemd-entrypoint[1697]: Exception in thread "main" java.lang.RuntimeException: starting java failed with [1] Dec 30 11:00:43 Toshinobu-PC systemd-entrypoint[1697]: output: Dec 30 11:00:43 Toshinobu-PC systemd-entrypoint[1697]: # Dec 30 11:00:43 Toshinobu-PC systemd-entrypoint[1697]: # There is insufficient memory for the Java Runtime Environment to continue. Dec 30 11:00:43 Toshinobu-PC systemd-entrypoint[1697]: # Native memory allocation (mmap) failed to map 4294967296 bytes for committing reserved memory. Dec 30 11:00:43 Toshinobu-PC systemd-entrypoint[1697]: # An error report file with more information is saved as: Dec 30 11:00:43 Toshinobu-PC systemd-entrypoint[1697]: # /var/log/elasticsearch/hs_err_pid1721.log Dec 30 11:00:43 Toshinobu-PC systemd-entrypoint[1697]: error: Dec 30 11:00:43 Toshinobu-PC systemd-entrypoint[1697]: OpenJDK 64-Bit Server VM warning: INFO: os::commit_memory(0x0000000700000000, 4294967296, 0) failed; error='Not enough space' (errno=12) Dec 30 11:00:43 Toshinobu-PC systemd-entrypoint[1697]: at org.elasticsearch.server.cli.JvmOption.flagsFinal(JvmOption.java:113) Dec 30 11:00:43 Toshinobu-PC systemd-entrypoint[1697]: at org.elasticsearch.server.cli.JvmOption.findFinalOptions(JvmOption.java:80) Dec 30 11:00:43 Toshinobu-PC systemd-entrypoint[1697]: at org.elasticsearch.server.cli.MachineDependentHeap.determineHeapSettings(MachineDependentHeap.java:59) Dec 30 11:00:43 Toshinobu-PC systemd-entrypoint[1697]: at org.elasticsearch.server.cli.JvmOptionsParser.jvmOptions(JvmOptionsParser.java:140) Dec 30 11:00:43 Toshinobu-PC systemd-entrypoint[1697]: at org.elasticsearch.server.cli.JvmOptionsParser.determineJvmOptions(JvmOptionsParser.java:92) Dec 30 11:00:43 Toshinobu-PC systemd-entrypoint[1697]: at org.elasticsearch.server.cli.ServerProcess.createProcess(ServerProcess.java:214) Dec 30 11:00:43 Toshinobu-PC systemd-entrypoint[1697]: at org.elasticsearch.server.cli.ServerProcess.start(ServerProcess.java:108) Dec 30 11:00:43 Toshinobu-PC systemd-entrypoint[1697]: at org.elasticsearch.server.cli.ServerProcess.start(ServerProcess.java:91) Dec 30 11:00:43 Toshinobu-PC systemd-entrypoint[1697]: at org.elasticsearch.server.cli.ServerCli.startServer(ServerCli.java:234) Dec 30 11:00:43 Toshinobu-PC systemd-entrypoint[1697]: at org.elasticsearch.server.cli.ServerCli.execute(ServerCli.java:91) Dec 30 11:00:43 Toshinobu-PC systemd-entrypoint[1697]: at org.elasticsearch.common.cli.EnvironmentAwareCommand.execute(EnvironmentAwareCommand.java:54) Dec 30 11:00:43 Toshinobu-PC systemd-entrypoint[1697]: at org.elasticsearch.cli.Command.mainWithoutErrorHandling(Command.java:85) Dec 30 11:00:43 Toshinobu-PC systemd-entrypoint[1697]: at org.elasticsearch.cli.Command.main(Command.java:50) Dec 30 11:00:43 Toshinobu-PC systemd-entrypoint[1697]: at org.elasticsearch.launcher.CliToolLauncher.main(CliToolLauncher.java:64) Dec 30 11:00:43 Toshinobu-PC systemd[1]: elasticsearch.service: Main process exited, code=exited, status=1/FAILURE Dec 30 11:00:43 Toshinobu-PC systemd[1]: elasticsearch.service: Failed with result 'exit-code'.
⇧ メモリー関係でエラーになってるっぽい。
⇧ 上記サイト様を参考に、設定を行う。
sudo vi /etc/elasticsearch/jvm.options
変更して、保存。
Elasticsearchを再起動。
⇧ 起動できました。
Elasticsearch 8 からは、セキュリティの仕様が変わったらしいので、
⇧ 上記サイト様を参考に、パスワードを更新します。
sudo /usr/share/elasticsearch/bin/elasticsearch-reset-password -u elastic -i
Elasticsearchへの疎通確認。
curl -k -u elastic https://10.255.255.16:9200
Logstashを自動起動されるようにしておきます。
sudo systemctl enable logstash.service
sudo systemctl start logstash.service
sudo systemctl status logstash.service
とりあえず、Elasticsearch、Logstash、Kibanaの各サービスが起動されるようにはなったということで。
WSL 2(Windows SubSystem for Linux 2)の問題なのか、Elasticsearchのサービスが普通に動いてくれないのが気になりますな...
そもそも、/etc/elasticsearch/jvm.optionsのメモリの設定がコメントアウトされていたり、分からんことが多いですな...
毎度モヤモヤ感が半端ない...
今回はこのへんで。