0

Given

I run multiple application servers running optionally behind a load balancer. The application servers share a single SQL Db. Pretty conventional setup I think.

Imagine a sw upgrade package is made available for the app. The upgrade includes changes both to the app and to the Db schema.

Problem

An admin starts installing the upgrade on the first application server. This results the app server and the Db schema to be updated to the new version.

Once the Db update is running, the remaining app servers should somehow be notified they should stop using the Db until they receive the upgrade. I wonder are there known solutions to that?

Technology in use

  • Application servers: Linux daemons running behind lighttpd-1.4.35 on Ubuntu 16
  • Db: MySQL-5.7 on top of Ubuntu 16
  • Load balancer: not decided on it yet (suggestions are welcome)
Vitaly P
  • 123
  • 3

1 Answers1

2

This can not be answered in a general way. It depends on the application itself and the type of changes you are doing. For example, some DB changes should not affect a running application (if done appropriately) like adding a new column to an existing table or add a new table. Others can affect like removing an existing column or renaming it.

Of course, the safest solution is to stop the application completely, do the required changes to application and DB, and start the application again. This may or may not be feasible according to your requirements.

If no or minimal downtime is desired, you have to provide two running independent copies at the same time. Do the upgrade on one copy (application + DB + any other dependencies) while keeping users access to the second copy. Upgrade the second copy after starting the first copy and redirecting users to first upgraded copy.

Khaled
  • 36,533
  • 8
  • 72
  • 99
  • I also thought of Db duplication approach you described. However may result an inconsistent state between the new (upgraded) app and the old app. A little downtime by completely stopping the apps would be more acceptable than such a inconsistent state. – Vitaly P Mar 30 '17 at 14:35