Microservice and Containerization Patterns > State & Data Access Patterns > Shared Isolated Database
Shared Isolated Database (Erl, Naserpour)
How can a microservice gain efficient data access to a shared database when implementing a dedicated copy of the shared database is not possible?
Problem
Solution
Application
The database is deployed in its own container, allowing it to be scaled and managed independently of the microservices or any other consumer programs.
The shared database is deployed in its own container and encapsulated by a service API providing generic data access functions. Microservice A and Microservice B are also stored in separate containers. Now the database and both microservices can be scaled and managed independently.
This pattern can be applied by logically isolating database tables and can further be applied in conjunction with the Leader Node Election pattern, as explained in the complete pattern description.