Cassandra是否适合存储文件?

时间:2012-01-12 21:47:09

标签: nosql cassandra data-storage file-storage

我正在开发一个php平台,它将大量使用我想到的图像,文档和任何文件格式,所以我想知道Cassandra是否适合我的需求。

如果没有,你能告诉我应该如何存储文件吗?我想继续使用cassandra,因为它具有容错能力,并且在节点之间使用自动复制。

感谢您的帮助。

3 个答案:

答案 0 :(得分:12)

来自cassandra wiki

Cassandra's public API is based on Thrift, which offers no streaming abilities 
any value written or fetched has to fit in memory. This is inherent to Thrift's 
design and is therefore unlikely to change. So adding large object support to
Cassandra would need a special API that manually split the large objects up 
into pieces. A potential approach is described in http://issues.apache.org/jira/browse/CASSANDRA-265.    
As a workaround in the meantime, you can manually split files into chunks of whatever 
size you are comfortable with -- at least one person is using 64MB -- and making a file correspond 
to a row, with the chunks as column values.

所以,如果您的文件是< 10MB你应该没问题,只要确保限制文件大小,或者将大文件分成几块。

答案 1 :(得分:5)

你应该可以使用10MB的文件。事实上,如果我没有弄错的话,DataStax Brisk会将文件系统置于Cassandra之上:http://www.datastax.com/products/enterprise

(我没有以任何方式与他们联系 - 这不是广告)

答案 2 :(得分:3)

作为最新信息,Netflix为其cassandra客户端提供了名为astyanax的实用程序,用于将文件存储为已处理的对象库。可以找到描述和示例here。使用astyanax编写一些测试并将Cassandra评估为文件存储是一个很好的起点。

相关问题