I got this status info by this command
sudo /etc/init.d/elasticsearch status
elasticsearch.service - Elasticsearch Loaded: loaded (/usr/lib/systemd/system/elasticsearch.service; enabled; vendor preset: enabled) Active: active (running) since Fri 2017-08-04 19:19:13 IST; 49s ago Docs: http://www.elastic.co Process: 9974 ExecStartPre=/usr/share/elasticsearch/bin/elasticsearch-systemd-pre-exec (code=exited, status=0/SUCCESS) Main PID: 9978 (java) CGroup: /system.slice/elasticsearch.service └─9978 /usr/bin/java -Xms2g -Xmx2g -XX:+UseConcMarkSweepGC -XX:CMSInitiatingOcc... Aug 04 19:19:13 joy systemd[1]: Starting Elasticsearch... Aug 04 19:19:13 joy systemd[1]: Started Elasticsearch.
But when I do
curl -XGET "localhost:9200"
curl -XGET 'localhost:9200/?pretty'
Then I am getting error as
curl: (7) Failed to connect to localhost port 9200: Connection refused
Any help would be appreciated. Thanks