Tool to use Redis RedLock algorithm from command line/shell scripts
Project description
fredlock
- Redis RedLock based distributed log tool
fredlock distributed locking utility
fredlock is a distributed locking tool based on Redis RedLock algorithm intended as a replacement for "flock" command line utility, it allows to run commands on multiple machines with a guarantee that no two instances will be running at the same time.
fredlock requires a shared Redis instance to provide locking
fredlock
Release Notes
- 0.1.0 - Initial version
- Features
- Auto-release of a lock after x seconds if command does not
complete in allotted time. (
--auto-release-time x
) - Specify how long to wait for lock
- Indefinitely (
--wait-timeout -1
) - Limited Time (
--wait-timeout x
(x > 0)) - Do not wait (
--wait-timeout 0
)
- Indefinitely (
- Custom Optional Delays:
- After lock acquire, before command execution (
--delay-after-acquire x
) - After command execution, before lock release (
--delay-before-release x
)
- After lock acquire, before command execution (
- Auto-release of a lock after x seconds if command does not
complete in allotted time. (
- Features
TODOs:
Some other ideas/desired features:
- Quiet timeouts (no output/failure if not run due to timeout trying to get lock)
- Config file (currently we support cli and env variables)
- Redis Cluster support
- Lock Namespacing
Installation
From PyPi:
pip install fredlock
Usage
Full build-in usage is available with --help
flag.
AutoNamed lock
Simplest usage to run a command command arg1 arg2
with lock command:
fredlock run command arg1 arg2
With Specified Lock
Simplest usage to run a command command arg1 arg2
with lock lockname:
fredlock --name lockname run command arg1 arg2
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.