我按照这里的步骤安装并使elasticsearch工作。
我有一个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命令检查了可用内存
首先,你应该enable journalctl
,以便我们可以获得有关正在发生的事情的一些见解。
由于它似乎是一个内存问题(你的VPS上有1GB而ES预先配置了1GB堆),你有两个选择:
config/jvm.options
的堆