From what I researched, the preferred architecture for microservices is polyglot persistence pattern. (http://martinfowler.com/bliki/PolyglotPersistence.html ). You could further read about this on following pages:
As per the best practices, each micro-service should have one database private to it. There are different ways to achieve the above objective. Some of them are listed below:
- Same database system for different services. In this following could be done:
- Different set of tables specific to microservice in the same database
- Different database schema but in the same database server
- Different database server
- Each service can use different database systems. For example, RDBMS, MongoDB etc.
Following diagram represents one datastore per microservice. (courtesy: MartinFowler page on MSA)
Following is another page representing MSA best practices from NetFlix. It highlights creating separate datastore for each microservice.