ZooKeeper
v0.2.2
Published
ZooKeeper is a NodeJS process manager focused on managing cluster processes.
Downloads
8
Maintainers
Readme
ZooKeeper
ZooKeeper is a production process manager for Node.JS with a build in cluster manager. ZooKeeper allows you to manage and control your production applications. ZooKeeper keeps your applications alive and enables you to reload your applications without down time.
The aim with ZooKeeper is to create and manage cluster environments easily through a intuitive command line interface and a robust API. ZooKeeper uses process events to check the health of a process and truly update a process without downtime.
ZooKeeper is currently in alpha development and it is strongly advised to not use it in a production environment.
Getting started
In order to start your application do we first need to make a few preparations. ZooKeeper makes use of process events and we need to add the required process events to let ZooKeeper manage your processes without any trouble.
When your application is ready to use do you need to send a 'ready' event to the master cluster manager. You can do this via 'process.send'
process.send('ready');
To gracefully shutdown your application do you have to catch the 'SIGTERM' signal that is send by the master cluster manager and gracefully shutdown your application before a new worker is spawned.
process.on('SIGTERM', function() {
process.exit(0);
});
Start your application
You can start your application by simply running the following command TIP: use the shortcut zk instead of zookeeper
zookeeper start <path> [-n (name of worker) -w (ammount of workers)]
Status of your running processes
To see the status of your running processes simply run:
zookeeper status
Workers
You can also easily add extra workers to your cluster:
zookeeper add <process> <amount>
Or if you want to reduce the amount of workers running:
zookeeper kill <process> <amount>
And that's it run zookeeper with the help flag in order to see all available remaining commands:
zookeeper --help