Unable to run ElasticSearch as a service on Ubuntu

2019-01-22 09:40发布

问题:

I'm trying to get ElasticSearch up and running following the normal setup guide.

Everything is running fine on my Macbook but I'm trying to do the same on an Ubuntu 11.04 server.

Running /usr/local/elasticsearch/bin/elasticsearch -f works and I get a response from curl http://localhost:9200.

However this is what I get when I try to start ElasticSearch as a service (I've installed the service wrapper):

$ rcelasticsearch start

Starting ElasticSearch...
Waiting for ElasticSearch.............................
WARNING: ElasticSearch may have failed to start.

Sure enough rcelasticsearch status says ElasticSearch is not running and localhost:9200 cannot be reached.

Any ideas what might be the problem?

Edit: The service log says:

Launching a JVM...
JVM exited while loading the application.
Error occurred during initialization of VM
Could not reserve enough space for object heap

回答1:

The server instance didn't have enough memory for the default ElasticSearch service wrapper settings. To fix this I edited /usr/local/elasticsearch/bin/service/elasticsearch.conf and changed ES_HEAP_SIZE from 1024 to 512