Using a relational database and a key-value store in combination

喜你入骨 提交于 2019-12-24 02:47:33

问题


The requirements for the project I'm working seem to point to using both a relational database (e.g. postgre, MySQL) in combination with a key-value store (e.g. HBase, Cassandra). Our data almost breaks nicely into one of the two data models with the exception of a small amount of interdependence.

This is not an attempt to cram a relational database into a key-value store; they are independent of each other.

Are there any serious reasons to not do this?


回答1:


I work in SQL DBMS territory, so take that bias into account, but...

As with Shiraz Bhaiji, I worry about the "except for a small amount of interdependence". There are a number of things to think about, the answers to which will help you determine what to do.

  • What happens if something goes wrong with the interdependence? (Customers lose money - then you need to use a DBMS throughout; you lose money - probably the same; someone gets reported as having 3045 points when they really have 3046 - maybe it doesn't matter.)
  • How hard is it to fix up the 'mess' when something goes wrong?
  • How much of the work is on the key-value store and how much is on the DBMS?
  • Can the interdependence be removed by moving some stuff from key-value store to DBMS?
  • How slow is the DBMS when used as a key-value store? (Are you sure there's no way to bring it close enough to parity?)
  • What happens in disaster recovery scenarios? Synchronized backups?

If you have adequate answers to these and related questions, then it is OK to go with the mixed setup - you've thought it through, weighed the risks, formed a judgement, and it is reasonable to go ahead. If you don't have answers, get them.




回答2:


It should work fine.

There are a couple of things you need to be aware of / watch out for:

  • Your program is now responsible for the data consistency between the stores, not the relational model.
  • Depending on your technology you may or may not have transactions that span the data stores. Here you might have to program some manual clean up work in the case of a failure.



回答3:


When you say key-value store are you meaning like in a session or a cache type of implementation? There are always reasons to do such things...reading from and writing to a database is generally your most resource intensive operation. More details?



来源:https://stackoverflow.com/questions/1076818/using-a-relational-database-and-a-key-value-store-in-combination

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!