如何备份 Memgraph 数据库?
我正在 Ubuntu WSL 中运行 Memgraph。我想备份我的数据库。我无法找到数据库文件。
我发现了解决Memgraph 平台,但我需要一些 WSL 解决方案。
I'm running a Memgraph within Ubuntu WSL. I want to make a backup of my database. I'm having trouble locating the database files.
I've found the question that addresses Memgraph platform, but I need some solution for WSL.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
运行时,Memgraph 在其数据目录中生成几个不同的文件。这是 Memgraph 保存所有永久数据的位置。默认数据目录是
/var/lib/memgraph
。如果要触发创建当前数据库状态的快照,请在 mgconsole 或 Memgraph Lab 中运行以下查询:
创建 Memgraph 实例的备份只需复制数据目录。如果没有额外的帮助,这是不可能的,因为当触发事件(快照数量超过允许的最大数量)时,可以删除持久性文件。
要禁用此行为,您可以在 mgconsole 或 Memgraph Lab 中使用以下查询:
如果您使用 Linux 运行 Memgraph,则复制文件的步骤如下:
grep -A 1 'permanent data' /etc/memgraph/memgraph.conf
cp /var/lib/memgraph/snapshots/20220325125308366007_timestamp_3380 ~/backup/
到允许删除文件,请在 mgconsole 或 Memgraph Lab 中运行以下查询::
UNLOCK DATA DIRECTORY;
Memgraph 将删除之前应删除的文件,并允许将来删除其中包含的文件数据目录。
While running, Memgraph generates several different files in its data directory. This is the location where Memgraph saves all permanent data. The default data directory is
/var/lib/memgraph
.If you want to trigger creating a snapshot of the current database state, run the following query in mgconsole or Memgraph Lab:
Creating a backup of a Memgraph instance would consist of simply copying the data directory. This is impossible without additional help because the durability files can be deleted when an event is triggered (the number of snapshots exceeded the maximum allowed number).
To disable this behavior, you can use the following query in mgconsole or Memgraph Lab:
If you are using Linux to run Memgraph, here are the steps for copying files:
grep -A 1 'permanent data' /etc/memgraph/memgraph.conf
cp /var/lib/memgraph/snapshots/20220325125308366007_timestamp_3380 ~/backup/
To allow the deletion of the files, run the following query in mgconsole or Memgraph Lab::
UNLOCK DATA DIRECTORY;
Memgraph will delete the files which should have been deleted before and allow any future deletion of the files contained in the data directory.