Microservice database migration guide

By: Edson Yanaga

Updated: 2/15/2017

Code is easy, State is hard. Learning how to deal with your monolithic relational databases in a microservices structure is key to keeping pace in a quickly changing workplace. There are many approaches available, and this book takes you through nine different strategies for integrating data from your monolithic application into a microservice architecture.

This book explains how to:

  • Deploy new code without disrupting user activity with zero downtime migrations.

  • Evolve your relational database by keeping specific versions of application code and database schemas in the same code repository.

  • Understand how CRUD patterns and CQRS works, and the differences between them, including the consistency models involved in distributed systems.

  • Distribute and integrate your relational database into microservices.

Book Cover

Access new microservice databases now


Deployment strategies and solutions

Traditional deployment architectures have the clients issuing requests directly to your server deployment, as pictured in Figure 2-1.

Unless your platform provides you with some sort of “hot deployment,” you’ll need to undeploy your application’s current version and then deploy the new version to your running system. This will result in an undesirable amount of downtime. More often than not, it adds up to the time you need to wait for your application server to reboot, as most of us do that anyway in order to clean up anything that might have been left by the previous version.

To allow our deployment architecture to have zero downtime, we need to add another component to it. For a typical web application, this means that instead of allowing users to directly connect to your application’s process servicing requests, we’ll now have another process receiving the user’s requests and forwarding them to your application. This new addition to the architecture is usually called a proxy or a load balancer, as shown in Figure 2-2.

Access new microservice databases now


Figure 2.1 Figure 2.2