FalkorDB is a fork of RedisGraph, and under the hood it runs on Redis. That’s why you see references to Sentinel.
⸻
🔹 What is is_sentinel?
• It’s usually a configuration flag/parameter in client libraries (Python, Node, etc.) when connecting to Redis/FalkorDB.
• is_sentinel=True tells the driver:
“Don’t connect directly to a single Redis instance. Instead, connect to a Redis Sentinel node to discover the master/replica topology.”
⸻
🔹 What is a Sentinel Connection?
Redis Sentinel is a high-availability (HA) system for Redis.
• It monitors Redis instances.
• Automatically handles failover (if master goes down, promote a replica).
• Provides service discovery for clients.
So in FalkorDB:
• If you deploy in standalone mode, you connect directly (no Sentinel).
• If you deploy in HA mode (with replication & failover), you connect through Sentinel, and the driver will auto-route queries to the current master.
⸻
🔹 Example (Python FalkorDB client)
from redis.sentinel import Sentinel
# Connect to Sentinel
sentinel = Sentinel([('localhost', 26379)], socket_timeout=0.1)
# Get master connection
master = sentinel.master_for('mymaster', password="yourpassword", db=0)
# Get replica connection (read-only queries can go here)
replica = sentinel.slave_for('mymaster', password="yourpassword", db=0)
# Use master to run queries (FalkorDB graph calls are still Redis commands)
print(master.execute_command("GRAPH.QUERY", "MyGraph", "MATCH (n) RETURN n"))
Here:
• "mymaster" = name of the Redis master group managed by Sentinel.
• Sentinel runs separately (usually on port 26379).
• is_sentinel=True just signals to use this connection mode.
⸻
🔑 Summary
• is_sentinel → flag to tell the driver to connect via Redis Sentinel.
• Sentinel connection → allows HA setup (failover, replication, service discovery) in FalkorDB just like Redis.
• Useful if you run FalkorDB in production with clustering + replicas, not needed in local/dev (single-node) setups.
⸻
No comments:
Post a Comment