BeatCop-1.0
توضیحات
Cluster singleton manager
| ویژگی | مقدار |
|---|---|
| سیستم عامل | - |
| نام فایل | BeatCop-1.0 |
| نام | BeatCop |
| نسخه کتابخانه | 1.0 |
| نگهدارنده | [] |
| ایمیل نگهدارنده | [] |
| نویسنده | HoverHell |
| ایمیل نویسنده | hoverhell@gmail.com |
| آدرس صفحه اصلی | https://github.com/Luluvise/BeatCop |
| آدرس اینترنتی | https://pypi.org/project/BeatCop/ |
| مجوز | UNKNOWN |
BeatCop
=======
BeatCop is a simple cluster singleton manager. It ensures that a managed
process runs on exactly one node in a cluster at a time, no more, no
less (assuming there is at least one node left alive).
It was created for managing `Celery
beat <http://celery.readthedocs.org/en/latest/userguide/periodic-tasks.html>`__
in an autoscaling pool of Celery workers but was written as generic
process manager and can therefore be used for pretty much anything. It
uses `Redis <http://redis.io/>`__ to communicate.
Mechanism
---------
BeatCop uses an expiring Redis key (`SET EX
NX <http://redis.io/commands/set>`__) as a lock, which it continually
refreshes while the controlled process is running. If the BeatCop or the
whole node dies for any reason, drops off the network or loses
connection to Redis, the lock expires and a waiting BeatCop on another
node will then acquire the lock and launch a new process.
The lock is acquired (via SET NX) and refreshed (via a short LUA script)
atomically, so there should be no race conditions.
BeatCop also tries very hard to make sure that if anything goes wrong,
the monitored process is stopped.
Prerequisites
-------------
- A server running Redis 2.6.12 or higher to which all nodes can
connect.
Installation
------------
::
# Make a virtualenv if you like first
pip install -r requirements.txt
./beatcop.py /path/to/beatcop.ini
It is typically a good idea to run BeatCop in something that will
restart it if it dies, such as
`daemon-tools <http://cr.yp.to/daemontools.html>`__ or the dreaded
Upstart.
Configuration
-------------
See example ``beatcop.ini``.
Caveats
-------
BeatCop relies on Redis connectivity. If Redis updates fail, BeatCop
will stop the controlled process and exit, hoping that at least one
other node can still talk to Redis and spawn a new process. If all nodes
lose Redis connectivity, this will obviously fail. BeatCop now supports
Redis Cluster (see example ``beatcop.ini``), which means Redis no longer
has to be the single point of failure.
BeatCop does not currently work via `nutcracker
(twemproxy) <https://github.com/twitter/twemproxy/blob/master/notes/redis.md#scripting>`__.
License
-------
MIT - see `LICENSE <LICENSE>`__ file.
نحوه نصب
نصب پکیج whl BeatCop-1.0:
pip install BeatCop-1.0.whl
نصب پکیج tar.gz BeatCop-1.0:
pip install BeatCop-1.0.tar.gz