Prerequisites
Before you begin, ensure you have the following:- Docker installed on your machine.
- A working FalkorDB Docker image. You can pull it from Docker Hub.
- Basic knowledge of Docker commands and configurations.
Step 1: Setting Up Persistence
Persistence in FalkorDB allows you to store your data on the host machine, ensuring that it is not lost when the container restarts.1.1 Create a Persistent Volume
First, create a Docker volume to store the data:1.2 Start FalkorDB with the Persistent Volume
You can now run FalkorDB with the volume attached:- The
-v falkordb_data:/var/lib/falkordb/dataflag mounts the volume to the/var/lib/falkordb/datadirectory inside the container - FalkorDB stores its data in the
/var/lib/falkordb/datadirectory by default
Step 2: Verifying the Setup
To verify that persistence is working correctly, follow these steps:2.1 Create Test Data
2.2 Restart Container
2.3 Verify Data Persists
Best Practices
- Backup Regularly: Even with persistence, maintain regular backups of your data
- Monitor Disk Space: Ensure sufficient disk space is available for the volume
- Use Named Volumes: Named volumes are easier to manage than bind mounts
Understanding Durability Options
Docker volume configuration ensures your data persists across container restarts, but FalkorDB also provides multiple durability mechanisms (RDB snapshots, AOF logging) to protect against data loss and optimize for different use cases. For a comprehensive guide on configuring RDB, AOF, and graph-specific backup options, see Data Durability.ACL User Persistence
Docker volume configuration persists your graph data, but ACL users created withACL SETUSER are stored separately in an ACL file. To persist users, passwords, and permissions across restarts, see ACL Persistence on Docker.
Next Steps
With persistence configured, FalkorDB is now set up for reliable data storage that remains intact across container restarts. For high availability and data redundancy, explore Replication to set up multiple FalkorDB instances.Frequently Asked Questions
What directory does FalkorDB use for data inside the container?
What directory does FalkorDB use for data inside the container?
FalkorDB stores data in
/var/lib/falkordb/data by default. Mount your Docker volume to this path: -v falkordb_data:/var/lib/falkordb/data.Should I use named volumes or bind mounts?
Should I use named volumes or bind mounts?
Named volumes are recommended for most cases as they are easier to manage and portable. Use bind mounts only when you need to map a specific host directory for backups or shared access.
How do I verify persistence is working after a restart?
How do I verify persistence is working after a restart?
Create test data, stop and restart the container, then query the data again. If it returns your previously created nodes, persistence is configured correctly.
Does Docker volume persistence also save ACL users?
Does Docker volume persistence also save ACL users?
No. ACL users are stored separately in memory by default. To persist ACL users, configure an ACL file with
--aclfile and store it on the mounted volume. See ACL Persistence.