A prerelease of a new mongrel_cluster is now available. Proceed at your own risk! If you have a staging or development server, please try it out.
gem install mongrel_cluster --source http://mongrel.rubyforge.org/releases/
This one has some new features in it that need to be tested on all unix platforms. Please
run —clean and
cluster::status on every *nix you can find. I run linux so the rest are up to you.
Thanks to the following for patches, bug reports, and suggestions:
Corey Donahue, Matt Trott, Donnie Jones, Matte Edens, Joey Geiger,
Nathan Vack, and others.
The cluster::start, stop and restart commands now support—clean. On start, any orphaned pid_files will be removed and any missing memberswill be started. Running members will be ignored. On stop, orphaned members (with missing pids) will be killed. On restart,—clean will be passed to stop and start. Feel the healing power of the pack!
cluster::status – Reports the status of the cluster members with respect to pid_file and the existence of the process. Returns 0 if ok, 2 if not.
- —only PORT – run a command only a specific port.
Capistrano – added variables for the mongrel_rails path, pid_file, log_file, clean, and a task for status.
- The init.d script (resources/mongrel_cluster) will now create /var/run/mongrel_cluster and chown to a defined user on start (see file). To fully use this feature, update your cluster yml files to store the pidfile in /var/run/mongrel_cluster. This will support cleaning up orphaned pidfiles at boot time. For example: pid_file: /var/run/mongrel_cluster/foo.pid
- Each mongrel_rails process now has its own log file.
Improved parsing of log_file and pid_file filenames to support ”.” in
- start/stop messages for each port
- Fixed a parameter bug with mongrel_cluster_ctl calling mongrel_rails.
- Default pid_file is now “tmp/pids/mongrel.pid” to match Rails rake
tasks. NOTE: I recommend using /var/run/mongrel_cluster so pids are
properly cleaned up after a crash.
How does it work?
check status of your cluster
[me at fluxura ~]$ mongrel_rails cluster::status -C /etc/mongrel_cluster/fluxura.conf found pid_file: /var/run/mongrel_cluster/fluxura.8000.pid mongrel_rails (port: 8000, pid:27286) is running... found pid_file: /var/run/mongrel_cluster/fluxura.8001.pid mongrel_rails (port: 8001, pid:27289) is running...
simulate process death
[me at fluxura ~]$ kill -9 27289
[me at fluxura ~]$ mongrel_rails cluster::status -C /etc/mongrel_cluster/fluxura.conf found pid_file: /var/run/mongrel_cluster/fluxura.8000.pid mongrel_rails (port: 8000, pid:27286) is running... found pid_file: /var/run/mongrel_cluster/fluxura.8001.pid !! mongrel_rails (port: 8001) is not running...
clean ignores the good process, removes orphaned pid_file, and starts
new process. healing pack power!
[me at fluxura ~]$ mongrel_rails cluster::start --clean -C /etc/mongrel_cluster/fluxura.conf already started port 8000 missing process: removing /var/run/mongrel_cluster/fluxura.8001.pid starting port 8001
Give it a go and let me know…