我可以使用卡桑德拉来存储对象? [英] Can I use Cassandra to store objects?
问题描述
我的应用程序是这样工作的。
My application works like this.
一个数据库(MySQL的)那里有一个命令。该命令是一个对象(包括领域许多领域一样整数ANS字符串)。有是与数据库交互,并从数据库获取的命令并执行一些操作的Web服务。
A database(Mysql) where there is a command. The command is an object(consists of fields many fields like ints ans strings). There is a webservice which interact with the database and get the command from the db and performs some operation.
我是如何存储命令到数据库的方法是剥离所有领域以及到分贝插入它们。
The way how I am storing the command into db is by stripping all the fields and inserting them in to the db.
我可以使用卡桑德拉到位的mysql和存储命令对象?
Can I use cassandra in place of mysql and store the command object?
推荐答案
你为什么想从中involes关系数据库当前解决方案移开?我不会(信不信由你),建议改变你的数据存储为时过早。
Why do you want to move away from your current solution which involes a relational database? I wouldn't (believe it or not) recommend to change your datastore premature.
如果您是经验的问题,要更换你的关系数据库,那么我会建议调查的 Apache的卡桑德拉
If your are experience problems and want to replace your relational database, then I would recommend to investigate Apache Cassandra.
如果您发现卡桑德拉有趣,我建议看起来是这样的一个数据模型:
If you find Cassandra interesting I would suggest a data model that looks something like this:
Commands = { // this is a ColumnFamily (CF)
commandObject1: { // this is the key to this Row inside the CF
// now we have an infinite # of columns in this row
field1: "value1",
field2: "value2",
field3: "value3"
}, // end row
commandObject2: { // this is the key to another row in the CF
// now we have another infinite # of columns in this row
field1: "value1",
field2: "value2",
field3: "value3"
field4: "value4",
field5: "value5"
},
}
(感谢阿林(和他出色的博客文章)对Cassandra的数据模型表示法)
(thanks Arin (and his excellent blog post) for the Cassandra data model notation)
这篇关于我可以使用卡桑德拉来存储对象?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!