3

I have a SpringBoot application deployed in PCF scaled to 12 instances. One or two instances are going down. I want to restart those 2 instances instead of restarting the application automatically. How do you restart a single instance automatically in PCF when it is going down or when it crashed?

I am using the following command to restart a single instance manually:

cf restart-app-instance APP_NAME INDEX
user152468
  • 3,202
  • 6
  • 27
  • 57

2 Answers2

2

There is nothing you need to do. The Cloud Foundry platform will monitor your application via the configured health check and automatically restart it.

If that's not happening, you would want to look into why it's not being restarted automatically and not try to hack together some other way of restarting it.

Daniel Mikusa
  • 13,716
  • 1
  • 22
  • 28
0

Can you try something.

  1. Delete the instance at the index:

cf curl DELETE /v2/apps/$(cf app APP_NAME --guid)/instances/INDEX_OF_THE_INSTANCE

Reference: http://apidocs.cloudfoundry.org/272/apps/terminate_the_running_app_instance_at_the_given_index.html

  1. Wait for sometime, so that CF can recreate the instance.

I have not tried this in my lab, and if I get any update I will post it here in comments.

Thank,

Chandan Patra

Chandan Patra
  • 491
  • 2
  • 9
  • 18