Skip to content

noxiouz/python-flock

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Configuration

You have to write the configuration file /etc/distributed-flock.json with the following content:

{
    "host"      :   ["hostname1:2181","hostname2:2181","hostname3:2181"],
    "timeout"   :   5,
    "app_id"    :   "my_application_namespace"
}
  • host - list of Zookeeper nodes
  • timeout - timeout for zookeper connection (sec)
  • app_id - namespace for your application in Zookeeper. This means that the lock will be stored
    in Zookeeper with path likes /app_id/your_lock_name

Usage

To run the application under the supervision of the zk-flock use the command:

zk-flock <pidname> <application coomand>

If your application requires command-line arguments enclose it in double quotes:

zk-flock my_test_lock "bash /home/user/test.sh arg1 arg2 arg3"

Warning

If you kill zk-flock application with kill -9, the lock will be released, but this will not stop your application.

About

Analog of flock. It uses Zookeeper to acquire/release lock

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Contributors 5