减少磁盘支持的 aerospike 的文件大小

Reducing File size for disk backed aerospike

如何减小 aerospike .dat 文件的大小? 我们当前的配置是

namespace test {
    memory-size 20G             # Maximum memory allocation for data and
                                    # primary and secondary indexes.
    storage-engine device {         # Configure the storage-engine to use
    file /opt/aerospike/test.dat  # Location of data file on server.
    filesize 100G                # Max size of each file in GiB.
    }
}

如果 test.dat 与标准 ls -ltrh 一样为 90GB,则当前文件大小。但在 AMC ui 上显示已使用 50GB。

我想将文件大小减小到 80GB。我尝试关注 this 文档

Decrease filesize Decreasing the size of the files with an Aerospike service restart will potentially end up deleting random data which can results in unexpected behavior on the Aerospike cluster due to the truncation, maybe even landing into low available percentage on the node. Thus, you would need to delete the file itself and let the data be migrated from the other nodes in the cluster.

  1. Stop Aerospike server.
  2. Delete the file and update the configuration with the new filesize.
  3. Start Aerospike server.

但是当我启动服务器时post数据删除,启动失败报错

Jan 20 2022 03:44:50 GMT: WARNING (drv_ssd): (drv_ssd.c:3784) unable to open file /opt/aerospike/test.dat: No such file or directory

关于这个我有几个问题

  1. 有没有办法在没有初始数据的情况下重新启动进程并让它从集群中的其他节点获取数据?
  2. 如果我想将大小从 100G 减小到 95G,我是否仍然需要做同样的事情?考虑到当前文件大小仅为 90GB。是否仍有丢失数据的风险?
  1. 停止 Aerospike 服务器,删除文件并重新启动它是可行的方法。还有其他方法(如冷启动空 - cold-start-empty),但推荐的方法是你完成它的方法。似乎有一些权限问题阻止服务器在该目录中创建该文件。

  2. 是的,如您所引用的文档中所述,您必须执行相同的操作来减小文件大小。