APM Server transport error (ECONNREFUSED): connect ECONNREFUSED 127.0.0.1:8200

I have installed apm-server and setup apm-server.yml as bellow for nodeJs Agent

output.elasticsearch:
  hosts: ["localhost:9200"]
  username: "elastic"
  password: "elastic"

then run service apm-server start .

configured Node side as bellow

var apm = require('elastic-apm-node').start({
    serviceName: 'MyApp',
    serverUrl: 'http://localhost:8200'
  })

Checked status

APM Server status : You have correctly setup APM Server

Agent status : Data successfully received from one or more agents

It's worked last night and showed charts on kibana dashboard.but now i'm getting bellow error on my Console and No services found on dashboard

[ERROR] APM Server transport error (ECONNREFUSED): connect ECONNREFUSED 127.0.0.1:8200

Kibana - 7.3.1
apm-server - 7.3.1
elasticsearch - 7.3.1

I have checked apm-server logs directory.but there is no any log file.

and tried curl -i http://localhost:8200.it's says
curl: (7) Failed to connect to localhost port 8200: Connection refused.

Kindly help me on this please.

Hi,

Is the process running? what does ps -ef | grep apm-server say?

If it is not running, can you try sudo -u apm-server apm-server -e ? What does stdout/stderr say?

Thank you @jalvz. sudo -u apm-server apm-server -e worked for me.

Glad to hear! You initially mentioned that service apm-server status was showing an error. If you kill that sudo -u apm-server apm-server -e and try again with server apm-server start, does it work?
Do you find a log file /var/log/apm-server/apm-server ?