Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Newer
Older
100644 140 lines (103 sloc) 4.289 kB
ad99a1c @tj docs
tj authored
1 # Cluster
2
1a61367 @tj link to site
tj authored
3 [Cluster](http://learnboost.github.com/cluster) is an extensible multi-core server manager for [node.js](http://nodejs.org).
3b732dd @tj Initial commit
tj authored
4
ea4aebb @tj docs
tj authored
5 ## Installation
6
e65edaf Added syntax highlighting.
Tony authored
7 ```bash
8 $ npm install cluster
9 ```
ea4aebb @tj docs
tj authored
10
1e75808 @tj features
tj authored
11 ## Features
12
c4f0cb5 @tj reload
tj authored
13 - zero-downtime restart
1e75808 @tj features
tj authored
14 - hard shutdown support
15 - graceful shutdown support
16 - resuscitates workers
1d68965 @tj docs
tj authored
17 - maintains worker count, even if worker was _SIGKILL_ed.
1e75808 @tj features
tj authored
18 - workers commit suicide when master dies
19 - spawns one worker per cpu (by default)
20 - extensible via plugins
21 - bundled plugins
8ad8521 @tj links
tj authored
22 - [cli](http://learnboost.github.com/cluster/docs/cli.html): provides a command-line interface for your cluster
23 - [debug](http://learnboost.github.com/cluster/docs/debug.html): verbose debugging information
24 - [logger](http://learnboost.github.com/cluster/docs/logger.html): master / worker logs
25 - [pidfiles](http://learnboost.github.com/cluster/docs/pidfiles.html): writes master / worker pidfiles
26 - [reload](http://learnboost.github.com/cluster/docs/reload.html): reloads workers when files change
27 - [repl](http://learnboost.github.com/cluster/docs/repl.html): perform real-time administration
28 - [stats](http://learnboost.github.com/cluster/docs/stats.html): adds real-time statistics to the `repl` plugin
6356d9e @tj docs
tj authored
29 - supports node 0.2.x
30 - supports node 0.4.x
39f8276 @tj tcp is all good
tj authored
31 - supports TCP servers
1e75808 @tj features
tj authored
32
f7638e0 @tj docs
tj authored
33 ## Example
ea4aebb @tj docs
tj authored
34
7fb49b5 @tj docs for new filename support in readme (you should use this)
tj authored
35 app.js:
36
e65edaf Added syntax highlighting.
Tony authored
37 ```javascript
38 var http = require('http');
ea4aebb @tj docs
tj authored
39
e65edaf Added syntax highlighting.
Tony authored
40 module.exports = http.createServer(function(req, res){
41 console.log('%s %s', req.method, req.url);
42 var body = 'Hello World';
43 res.writeHead(200, { 'Content-Length': body.length });
44 res.end(body);
45 });
46 ```
ea4aebb @tj docs
tj authored
47
7fb49b5 @tj docs for new filename support in readme (you should use this)
tj authored
48 server.js:
49
e65edaf Added syntax highlighting.
Tony authored
50 ```javascript
51 var cluster = require('cluster')
52 , app = require('./app');
53
54 cluster(app)
55 .use(cluster.logger('logs'))
56 .use(cluster.stats())
57 .use(cluster.pidfiles('pids'))
58 .use(cluster.cli())
59 .use(cluster.repl(8888))
60 .listen(3000);
61 ```
7fb49b5 @tj docs for new filename support in readme (you should use this)
tj authored
62
a4b561a @tj Docs for dir existance. Closes #138
tj authored
63 Note that cluster does _not_ create these directories for you, so you may want to:
64
65 $ mkdir {logs,pids}
66
7fb49b5 @tj docs for new filename support in readme (you should use this)
tj authored
67 recommended usage: passing the path to prevent unnecessary database connections in the master process, as `./app` is only `require()`ed within the workers.
68
e65edaf Added syntax highlighting.
Tony authored
69 ```javascript
70 var cluster = require('cluster');
71
72 cluster('./app')
73 .use(cluster.logger('logs'))
74 .use(cluster.stats())
75 .use(cluster.pidfiles('pids'))
76 .use(cluster.cli())
77 .use(cluster.repl(8888))
78 .listen(3000);
79 ```
ea4aebb @tj docs
tj authored
80
45fbe3a @tj plugins section
tj authored
81 ## Plugins
82
83 Below are the known 3rd-party plugins for cluster:
84
b53016a @TooTallNate Fix a typo in Readme.md
TooTallNate authored
85 - [cluster-log](https://github.com/LearnBoost/cluster-log) remote logger powered by redis
a1b85d4 @tj link to cluster-mail
tj authored
86 - [cluster-mail](https://github.com/LearnBoost/cluster-mail) email exception notifications
8ee82fc @tj added link to new plugin
tj authored
87 - [cluster-exception](https://github.com/3rd-eden/cluster.exception) extensive exception notifications
6b0f298 @tj added link to cluster-responsetimes
tj authored
88 - [cluster-responsetimes](https://github.com/mnutt/cluster-responsetimes) response time statistics for cluster's REPL
907c1db @AndreasMadsen added 3rd-party cluster-vhost plugin
AndreasMadsen authored
89 - [cluster-vhost](https://github.com/AndreasMadsen/cluster-vhost) add virtual host support to cluster
45fbe3a @tj plugins section
tj authored
90
ed6563c @tj docs
tj authored
91 ## Screencasts
0622c76 @tj screencast
tj authored
92
93 - Cluster [Introduction](http://screenr.com/X8v)
94
ad99a1c @tj docs
tj authored
95 ## Running Tests
96
a6902bd @tj docs
tj authored
97 Install development dependencies:
ad99a1c @tj docs
tj authored
98
e65edaf Added syntax highlighting.
Tony authored
99 ```bash
100 $ npm install
101 ```
ad99a1c @tj docs
tj authored
102
103 Then:
104
e65edaf Added syntax highlighting.
Tony authored
105 ```bash
106 $ make test
107 ```
ad99a1c @tj docs
tj authored
108
3d154fc @tj node versions tested
tj authored
109 Actively tested with node:
110
5d7c5ed @tj started removing 0.2.x compat
tj authored
111 - 0.4.9
3d154fc @tj node versions tested
tj authored
112
9a366d6 @tj Added MIT LICENSE file
tj authored
113 ## Authors
114
115 * TJ Holowaychuk
116
3b732dd @tj Initial commit
tj authored
117 ## License
118
119 (The MIT License)
120
9a366d6 @tj Added MIT LICENSE file
tj authored
121 Copyright (c) 2011 LearnBoost <dev@learnboost.com>
3b732dd @tj Initial commit
tj authored
122
123 Permission is hereby granted, free of charge, to any person obtaining
124 a copy of this software and associated documentation files (the
125 'Software'), to deal in the Software without restriction, including
126 without limitation the rights to use, copy, modify, merge, publish,
127 distribute, sublicense, and/or sell copies of the Software, and to
128 permit persons to whom the Software is furnished to do so, subject to
129 the following conditions:
130
131 The above copyright notice and this permission notice shall be
132 included in all copies or substantial portions of the Software.
133
134 THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
135 EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
136 MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
137 IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
138 CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
139 TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
140 SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
Something went wrong with that request. Please try again.