2

I've installed Wasabi as instructed here: https://github.com/intuit/wasabi

My Wasabi is running on Google Cloud, Ubuntu 16.04.

The problem is that after some time, Cassandra is crashing and not restarting automatically.

When I go to /api/v1/ping, I get this:

{"componentHealths":[{"componentName":"Experiments Cassandra","healthy":false,"detailedMessage":"PoolTimeoutException: [host=172.18.0.2(172.18.0.2):9160, latency=20000(20000), attempts=1]Timed out waiting for connection"},{"componentName":"MySql","healthy":true}],"version":"wasabi-api-1.0.20161107232436-SNAPSHOT-development-${scmBranch}-${buildNumber}-201701111439"}

Is it possible to restart container automatically when it crashes?

Silver Ringvee
  • 5,037
  • 5
  • 28
  • 46

1 Answers1

1

You can use the restart flag. From man docker run:

--restart="no"
        Restart policy to apply when a container exits (no,
        on-failure[:max-retry], always, unless-stopped).

You can try it creating a container with --restart=always, and then later kill that container from the host (you can use something like docker inspect --format '{{.State.Pid}}' CONTAINER_NAME to find the pid of the container). It should restart right after the kill.

Also note that if you use docker to stop/kill the container (ex docker kill) it will not be restarted.

Salem
  • 12,808
  • 4
  • 34
  • 54
  • Thanks! I've made the change, but running `docker inspect --format '{{.State.Pid}}' wasabi-cassandra` returns `4189` and `docker ps` says it's up for 10min, shouldn't the count start from 0 after killing? – Silver Ringvee Jan 26 '17 at 13:44
  • I think it will not restart the time. You can run again the inspector command and the given PID should be different – Salem Jan 26 '17 at 13:46
  • Ran `docker inspect --format '{{.State.Pid}}' wasabi-cassandra` got `4189`, waited for a while, ran `docker inspect --format '{{.State.Pid}}' wasabi-cassandra` again and still got `4189`, also `docker inspect -f "{{ .RestartCount }}" wasabi-cassandra` is 0 – Silver Ringvee Jan 26 '17 at 13:50
  • Mmm interesting... Do your servicre logs anything at startup time that can be used to check the container has restarted? – Salem Jan 26 '17 at 13:56
  • yes, and nothing is logged on `docker inspect --format '{{.State.Pid}}' wasabi-cassandra` – Silver Ringvee Jan 26 '17 at 14:02
  • You must be doing something wrong, or using an older docker verison. I have tried those steps and both the pid changes and uptime is also right. Are you sure you killed the process (`sudo kill -9 PID`)? – Salem Jan 27 '17 at 19:35
  • Okay, so I just had to rebuild my containers after making the changes. Now it working perfectly fine, thanks! – Silver Ringvee Jan 31 '17 at 08:20