Many services will need to retain state in some form or another. Making your services as “stateless” as possible is something you should strive for. That said, you do need to keep state somewhere, ideally outside of your service instances. This is where databases come into play.
An important rule with databases in relation to microservices is that you don’t want to allow any other teams to directly connect to your database. The database should be so far out of reach from your consumers that they shouldn’t even know what kind of databases you are using. If a consumer ever does happen upon ...