Mongre cluster服务的安装与配置

来源:互联网 发布:网络商学院排名 编辑:程序博客网 时间:2024/05/17 18:26
STEP1.安装必备的gem包
  1. gem install –include-dependencies mongrel
  2. gem install –include-dependencies mongrel_cluster

STEP2.配置

Mongre_cluster的设置比较简单,进入Rails应用的根目录,执行

  1. cd /var/www/demo
  2. mongrel_rails cluster::configure -e production -p 8000 -a 127.0.0.1 -N 5 -c /var/www/demo

其中

-e 指定运行环境,有production(生产)、development(开发)、test(测试)三个选项。
-p 指定监听端口
-a 127.0.0.1 指定Mongrel在localhost下监听
-N 5 启动两个Mongrel进程,端口从8000~8004

执行以上命令后,会在/var/www/demo/config目录产生mongrel_cluster.yml文件

 

  1. --- 
  2. cwd: /var/www/demo
  3. log_file: log/mongrel.log
  4. port: "8000"
  5. environment: production
  6. address: 127.0.0.1
  7. pid_file: tmp/pids/mongrel.pid
  8. servers: 5

至于mongrel_rails cluster::configure 命令的详细用法,可以mongrel_rails cluster::configure  --help查看

  1. Usage: mongrel_rails <command> [options]
  2.     -e, --environment ENV            Rails environment to run as
  3.     -p, --port PORT                  Starting port to bind to
  4.     -a, --address ADDR               Address to bind to
  5.     -l, --log FILE                   Where to write log messages
  6.     -P, --pid FILE                   Where to write the PID
  7.     -c, --chdir PATH                 Change to dir before starting (will be expanded)
  8.     -o, --timeout TIME               Time to wait (in seconds) before killing a stalled thread
  9.     -t, --throttle TIME              Time to pause (in hundredths of a second) between accepting clients
  10.     -m, --mime PATH                  A YAML file that lists additional MIME types
  11.     -r, --root PATH                  Set the document root (default 'public')
  12.     -n, --num-procs INT              Number of processor threads to use
  13.     -B, --debug                      Enable debugging mode
  14.     -S, --script PATH                Load the given file as an extra config script.
  15.     -N, --num-servers INT            Number of Mongrel servers
  16.     -C, --config PATH                Path to cluster configuration file
  17.         --user USER
  18.                                      User to run as
  19.         --group GROUP
  20.                                      Group to run as
  21.         --prefix PREFIX
  22.                                      Rails prefix to use
  23.     -h, --help                       Show this message
  24.         --version                    Show version

STEP3. 启动
在终端下输入以下命令启动Mongrel:

mongrel_rails cluster::start

STEP4.停止
mongrel_rails cluster::stop

 

 

原创粉丝点击