Scenario

The service shows as running but does not answer

The init script says running and refuses to start. Meanwhile nobody listens on the port. Find out whom it believes.

Monitoring has been reporting orders-api down since the middle of the night. You log in and ask the init script first. It says the service is running. Monitoring disagrees, and so does your own request. Nobody touched the machine overnight, at least not by hand.

The symptom

Three commands, and their answers contradict each other.

$ sudo service orders-api status
orders-api is running

$ curl -sS --max-time 3 http://localhost:8080/
curl: (7) Failed to connect to localhost port 8080 after 0 ms: Couldn't connect to server

$ sudo service orders-api start
$ echo $?
1

status says running. Port 8080 refuses: curl's code 7 means nobody accepted the connection, there is no listener on that address:port pair. And start exits silently with code 1, without even its usual orders-api started. Three claims about one service, and together they do not add up. Your job is to work out what each of them is really saying.

What you have to end up with

Four conditions. http://localhost:8080/ answers orders-api ok. The file /run/orders-api.pid exists, the number in it is the pid of a live orders-api process, and that very process holds port 8080. The backup agent that runs on the same machine is still alive: it has no part in this story. And /usr/local/bin/orders-api and /etc/init.d/orders-api are unchanged: what gets repaired is the sta

Free with account

Finish this lesson with a free account

This lesson is free once you sign in. Create an account to keep reading and open the lab.

Create a free account

Already have an account? Sign in