2010-05-04 206 views
3

我的应用程序是这样工作的。我可以使用Cassandra存储对象吗?

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

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

我可以使用cassandra代替mysql并存储命令对象吗?

回答

2

为什么你想离开你的当前解决方案,它的关系数据库?我不会(相信也可能不会)建议改变你的数据存储过早。

如果您遇到问题并且想要替换您的关系数据库,那么我会建议您调查Apache 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" 
    }, 
} 

(感谢阿林(和他出色的blog post)对Cassandra的数据模型表示法)

相关问题