Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/python/323.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/cassandra/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Python 如何对cassandra表执行碎片整理_Python_Cassandra_Defragmentation - Fatal编程技术网

Python 如何对cassandra表执行碎片整理

Python 如何对cassandra表执行碎片整理,python,cassandra,defragmentation,Python,Cassandra,Defragmentation,我正在使用Python和一些NoSql数据库来创建文件存储(主要是因为内置的复制),我尝试了MongoDB及其工作原理,但由于MongoDB的“写贪婪”特性,我迁移到cassandra并实现了相同的功能。在它工作的时候,我想知道(给我指一下文档就可以了)如何对cassandra中的数据进行碎片整理。我将用一个例子来解释这一点,假设我上传了200MB的文件,然后是20MB的文件。现在cassandra中的数据大小约为220MB。如果我去删除200MB的文件,那么我还看到数据大小是~200MB,这样

我正在使用Python和一些NoSql数据库来创建文件存储(主要是因为内置的复制),我尝试了MongoDB及其工作原理,但由于MongoDB的“写贪婪”特性,我迁移到cassandra并实现了相同的功能。在它工作的时候,我想知道(给我指一下文档就可以了)如何对cassandra中的数据进行碎片整理。我将用一个例子来解释这一点,假设我上传了200MB的文件,然后是20MB的文件。现在cassandra中的数据大小约为220MB。如果我去删除200MB的文件,那么我还看到数据大小是~200MB,这样就不会获得空间。在mongoDB中有一个要获得的命令(重新使用相同的空间来创建新文件),我想知道如何在cassandra中实现同样的效果。我对压缩和压缩感到困惑


为了存储数据,我将文件分割成一部分,然后以“blob”的形式存储在表中。

Cassandra使用一个名为的过程清除已删除和过期的数据

虽然您可以自己使用强制压缩,但我不建议这样做,因为最好调整压缩并让它在后台发生


这可能不会完全奏效,因为cassandra有一个名为“gc_grace_seconds”的配置属性,它可以防止标记为已删除(带有墓碑)的数据在gc_grace_seconds过去之前被删除。默认值为10天,但您可以将其配置为较小的值,甚至将其设置为0以同时禁用墓碑。

谢谢andy:)移动应用程序不允许我向上投票,或者如预期的那样Ans无需担心,很乐意帮助!:)