如果Memgraph创建快照,我是否需要卷?

huangapple go评论50阅读模式
英文:

If Memgraph creates snapshots, do I need volume?

问题

我正在阅读https://memgraph.com/docs/memgraph/how-to-guides/work-with-docker的文档,在那里我找到了我需要创建卷来保留数据的信息(-v mg_lib:/var/lib/memgraph)。

在另一个地方(https://memgraph.com/docs/memgraph/2.5.0/reference-guide/backup#snapshots),我找到了以下信息:Memgraph在运行时定期创建快照。当触发快照时,整个数据存储被写入驱动器。在启动时,数据库状态将从最近的快照文件中恢复。

如果已经创建了快照,为什么我需要卷来保留我的数据?创建卷是否多余?

英文:

I was reading the documentation at https://memgraph.com/docs/memgraph/how-to-guides/work-with-docker and there I found the info that I need to create volume if I want to keep the data (-v mg_lib:/var/lib/memgraph).

On another place (https://memgraph.com/docs/memgraph/2.5.0/reference-guide/backup#snapshots) I've found the following info: Memgraph periodically takes snapshots during runtime. When a snapshot is triggered, the entire data storage is written to the drive. On startup, the database state is recovered from the most recent snapshot file.

If the snapshots are created why would I need volume to keep my data? Is creating volume redundant?

答案1

得分: 1

Creating a Docker volume and having Memgraph create snapshots are two separate aspects of managing data persistence in Memgraph. Docker volumes are used for data persistence beyond the lifecycle of the container and Memgraph snapshots are used for faster recovery and backup.

Docker volume is essentially a mechanism provided by Docker that allows data to persist beyond the lifecycle of a single container. When a Docker container stops or is deleted, any data that was written to the file system inside that container is lost. By mapping a directory inside the container to a Docker volume on the host system, you're ensuring that data persists even if the container is stopped or removed.

Memgraph snapshots are a feature of the Memgraph database system itself. They provide a mechanism for periodically storing the state of the database to disk. This can help improve recovery time in case of a crash, and can also be used as a form of backup.

If Memgraph is running inside a Docker container and is taking snapshots, but there's no Docker volume set up, then those snapshots will be stored inside the container's filesystem. If that container is stopped or deleted, those snapshots (along with any other data) will be lost, because they're not persistent beyond the lifecycle of the container.

So, in this context, creating a Docker volume isn't redundant. It's actually necessary to ensure that the snapshots (and other data) persist beyond the lifecycle of the container. That's why the documentation instructs to map the Memgraph data directory to a Docker volume. This way, even if the container stops or is deleted, the data, including snapshots, will still be available on the host system.

英文:

Creating a Docker volume and having Memgraph create snapshots are two separate aspects of managing data persistence in Memgraph. Docker volumes are used for data persistence beyond the lifecycle of the container and Memgraph snapshots are used for faster recovery and backup.

Docker volume is essentially a mechanism provided by Docker that allows data to persist beyond the lifecycle of a single container. When a Docker container stops or is deleted, any data that was written to the file system inside that container is lost. By mapping a directory inside the container to a Docker volume on the host system, you're ensuring that data persists even if the container is stopped or removed.

Memgraph snapshots are a feature of the Memgraph database system itself. They provide a mechanism for periodically storing the state of the database to disk. This can help improve recovery time in case of a crash, and can also be used as a form of backup.

If Memgraph is running inside a Docker container and is taking snapshots, but there's no Docker volume set up, then those snapshots will be stored inside the container's filesystem. If that container is stopped or deleted, those snapshots (along with any other data) will be lost, because they're not persistent beyond the lifecycle of the container.

So, in this context, creating a Docker volume isn't redundant. It's actually necessary to ensure that the snapshots (and other data) persist beyond the lifecycle of the container. That's why the documentation instructs to map the Memgraph data directory to a Docker volume. This way, even if the container stops or is deleted, the data, including snapshots, will still be available on the host system.

huangapple
  • 本文由 发表于 2023年5月10日 22:19:13
  • 转载请务必保留本文链接:https://go.coder-hub.com/76219531.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定