【问题标题】:cannot get elasticsearch service to run in ubuntu 17?无法在 ubuntu 17 中运行 elasticsearch 服务?
【发布时间】:2018-06-10 10:26:34
【问题描述】:

我正在按照此处的步骤安装并让 elasticsearch 正常工作。

https://www.digitalocean.com/community/tutorials/how-to-install-and-configure-elasticsearch-on-ubuntu-16-04

我有一个 ubuntu 17,我以具有 sudo 权限的非 root 用户身份登录。

我做了以下步骤

sudo apt-get update

wget https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-6.1.1.deb

sudo dpkg -i elasticsearch-6.1.1.deb

sudo systemctl enable elasticsearch.service

sudo systemctl start elasticsearch

最后当我使用测试时

curl -X GET 'http://localhost:9200'

我收到以下错误

curl: (7) Failed to connect to localhost port 9200: Connection refused

当我这样做时

service --status-all

我没有在服务列表中看到 elasticsearch 服务。

请注意,我已经安装了 ufw,并且打开了以下端口

To                         Action      From
--                         ------      ----
22/tcp                     ALLOW       Anywhere
443/tcp                    ALLOW       Anywhere
80/tcp                     ALLOW       Anywhere
22/tcp (v6)                ALLOW       Anywhere (v6)
443/tcp (v6)               ALLOW       Anywhere (v6)
80/tcp (v6)                ALLOW       Anywhere (v6)

这是否会阻止 9200 端口,但这似乎不太可能,因为应该允许内部通信。

更新:

这是我使用 sudo journalctl -f

得到的输出
-- Logs begin at Fri 2017-12-29 10:27:23 +0545. --
Dec 30 13:31:40  elasticsearch[29595]: #
Dec 30 13:31:40  elasticsearch[29595]: # There is insufficient memory for the Java Runtime Environment to continue.
Dec 30 13:31:40  elasticsearch[29595]: # Native memory allocation (mmap) failed to map 986513408 bytes for committing reserved memory.
Dec 30 13:31:40  elasticsearch[29595]: # An error report file with more information is saved as:

我使用 free -m 命令检查了空闲内存

【问题讨论】:

  • 您正在下载 6.1.1 但安装的是 2.3.1?
  • 抱歉,这只是一个错字。我已经更正了我使用的命令。
  • 你在/var/log/elasticsearch看到了什么?
  • 我刚刚检查过,那个文件夹是空的。
  • 我也禁用了 ufw,但仍然出现同样的错误。

标签: ubuntu elasticsearch


【解决方案1】:

首先,您应该enable journalctl,以便我们了解正在发生的事情。

由于这似乎是内存问题(您的 VPS 上有 1GB 并且 ES 预配置了 1GB 堆),您有两种选择:

  1. 减少config/jvm.options中的堆
  2. 或增加您的 VPS 内存

【讨论】:

  • 谢谢瓦尔!问题是我的 vps 的内存低于最低要求。我在 config/jvm.options 中将最小和最大堆大小从 1gb 更改为 500m,现在它运行良好。
  • 太棒了,很高兴它有帮助!
  • 它不仅有帮助。它挽救了一天!我感激不尽。
猜你喜欢
  • 1970-01-01
  • 2016-05-15
  • 1970-01-01
  • 2020-05-16
  • 1970-01-01
  • 2012-10-15
  • 2017-09-22
  • 2022-07-27
  • 1970-01-01
相关资源
最近更新 更多