0
elasticsearch.service - Elasticsearch
   Loaded: loaded (/usr/lib/systemd/system/elasticsearch.service; enabled; vendo
   Active: failed (Result: exit-code) since Tue 2019-08-27 02:13:03 UTC; 3min 47
     Docs: http://www.elastic.co
  Process: 13227 ExecStart=/usr/share/elasticsearch/bin/elasticsearch -p ${PID_D
 Main PID: 13227 (code=exited, status=1/FAILURE)

Aug 27 02:12:39 ip-172-31-27-238 systemd[1]: Started Elasticsearch.
Aug 27 02:12:40 ip-172-31-27-238 elasticsearch[13227]: OpenJDK 64-Bit Server VM 
Aug 27 02:13:03 ip-172-31-27-238 systemd[1]: elasticsearch.service: Main process[1]: elasticsearch.service: Main process exited, code=exited, status=1/FAILURE exited, code=exited, status=1/FAILURE
Aug 27 02:13:03 ip-172-31-27-238 systemd[1]: elasticsearch.service: Failed with[1]: elasticsearch.service: Failed with result 'exit-code'.result 'exit-code'.

I have installed elasticsearch 7.3 on my EC2 ubuntu 18.04 server. I am trying to access it from another server. It worked fine before I made some changes to elasticsearch.yml. The change I made is like this.

# ---------------------------------- Network -----------------------------------
#
# Set the bind address to a specific IP (IPv4 or IPv6):
#
network.host: my elastic ip
#
# Set a custom port for HTTP:
#
http.port: 9200
#
# For more information, consult the network module documentation.

I have adjusted JVM heap min and max to 512m because I am using t2.micro. my reference: https://dev.to/dance2die/elasticsearch-installation-issue-on-a-free-tier-t2micro-aws-ec2-instance-1o3a) Everything worked fine when I curl localhost:9200 before changing network.host. Restarting elasticsearch seems not working. I need help thank you.

Jamie
  • 1

3 Answers3

0

There may be better information in the logs, but based on the changes you describe, I believe the problem can be identified regardless:

You say that you have specified an AWS Elastic IP as the address to bind to.
The issue here is that public IPv4 addresses in AWS (Elastic IP or otherwise) do not exist on the actual EC2 instance, instead these public addresses are handled by NAT in the cloudy bits.
This arguably quirky setup is essentially a way for dealing with the global IPv4 address starvation while still having a working isolated network segment for your own hosts (in that VPC).

You would want to specify the relevant address(es) that actually exist in that EC2 instance in the configuration. (Possibly using special values for convenience.)

And remember to keep access control in mind when you make it possible to connect from other hosts.

Håkan Lindqvist
  • 33,741
  • 5
  • 65
  • 90
0

Here is official ES on AWS doc. https://www.elastic.co/blog/running-elasticsearch-on-aws

Logs can give you more details, what I am suspecting is:

  1. Memory issue.
  2. Network mapping.
  3. Check if something already using resources.

And Many more.

asktyagi
  • 2,401
  • 1
  • 5
  • 19
0

I have found my answer here. https://stackoverflow.com/a/44240227/11981403 I guess setting network.host was not enough to access remotely. I had to add more codes as shown below.

transport.host: localhost 
transport.tcp.port: 9300 
http.port: 9200
network.host: 0.0.0.0
Jamie
  • 1