我可以使用Cassandra存储对象吗?

3

我的应用程序是这样工作的。

一个数据库(Mysql),其中有一个命令。该命令是一个对象(由许多字段组成,如整数和字符串)。有一个Web服务与数据库交互,并从DB获取命令并执行一些操作。

我将命令存储到数据库中的方式是剥离所有字段,并将它们插入到数据库中。

我能否使用Cassandra替换Mysql并存储命令对象?

1个回答

2
为什么您想要远离涉及关系型数据库的当前解决方案?我不会(信不信由你)建议您过早地更改数据存储方式。
如果您遇到问题并想要替换您的关系型数据库,那么我建议您调查一下Apache Cassandra
如果您发现Cassandra有趣,我建议使用类似以下这样的数据模型:
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"
  },
}  

“感谢Arin(以及他出色的博客文章)提供的Cassandra数据模型符号表示法。”

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接