- 浏览: 62915 次
- 性别:
- 来自: 成都
最新评论
-
sun_yang:
最近用到了dataTable
jquery插件之DataTables -
yuiezt:
...
jquery插件之DataTables -
fisk:
发现一些问题与不理解的地方,你看看哈。1. function ...
lglib.table API
介绍
Mongrel2是一款面向现代Web应用(Web 2.0 以及以后)而设计的Web浏览器。由干净的C语言写成,(目前)在Linux(及类似的Unix)系统上运行。它支持HTTP, Flash sockets, WebSockets, Long Polling,异步等技术,基本上走在当今Web服务端技术的最前沿。
主页
http://mongrel2.org/
手册
http://mongrel2.org/static/mongrel2-manual.html
Mongrel2的理念
按前面的描述,Mongrel2听起来是个很牛X的Web服务器,其实它真正独特的地方还不是前面的描述,而是它的理念:
关于语言中立,我们来八卦一下。Mongrel2的作者Zed Shaw,之前是Ruby社区的一位大牛,为Ruby社区设计了Mongrel服务器(针对Ruby设计的),这是个广受好评的Web Server,效率差不多是Ruby社区最高的了。后来,不知道咋回事儿(可能是关于一些Ruby技术的发展观点的分歧),Zed Shaw与Ruby界的其它某些人闹翻了。于是他一怒之下退出了Ruby圈子,发誓再也不搞Ruby了。退出之后,兴趣转向了python,写了一本书 Learn Python: The Hard Way。2010年开始,带着对Ruby界的愤怒(也许是很受伤),他开始了Mongrel2的设计。Mongrel2与Mongrel理念完全不一样,Mongrel2的目标就是要语言中立,并且宣称未来的软件开发一定是语言无关的(这种观念我蛮赞同)。就这么一年多的时间,到现在为止(2011年8月10日),发展到了1.7.5版,影响力逐渐大了起来。
Mongrel2与ZeroMQ社区也很有渊源——Mongrel2是ZeroMQ的第一个比较正式的有影响力的项目。ZeroMQ宣称是最牛逼的消息队列,是个新东西,可一直没有什么有影响力的应用。这次与Mongrel2的联姻,简直就是天作之合,我看行!
我关注Mongrel2,还是在其Tir示意框架出来之后,那时Mongrel2的版本为1.4。当时我正在估摸着设计一款Lua的Web框架,用于我们以后的产品中。发现Tir后,立即对这一套系统进行了消化,觉得Mongrel2, ZeroMQ, Redis, Lua的配合绝对有戏,重要的是在Mongrel2的基础上开发Web框架,能省很多事情(Mongrel2把许多以许需要框架来完成的事情包装好了)。于是立马开始了Bamboo项目。
配置文件写法
对象
内置变量
配置选项
先贴上,后面再翻译。
The list of available settings are:
control_port=ipc://run/control
This is where Mongrel2 will listen with 0MQ for control messages. You should use ipc:// for the spec, so that only a local user with file access can get at it.
limits.buffer_size=2 * 1024
Internal IO buffers, used for things like proxying and handling requests. This is a very conservative setting, so if you get HTTP headers greater than this, you’ll want to increase this setting. You’ll also want to shoot whoever is sending you those requests, because the average is 400-600 bytes.
limits.client_read_retries=5
How many times it will attempt to read a complete HTTP header from a client. This prevents attacks where a client trickles an incomplete request at you until you run out of resources.
limits.connection_stack_size=32 * 1024
Size of the stack used for connection coroutines. If you’re trying to cram a ton of connections into very little RAM, see how low this can go.
limits.content_length=20 * 1024
Maximum allowed content length on submitted requests. This is, right now, a hard limit so requests that go over it are rejected. Later versions of Mongrel2 will use an upload mechanism that will allow any size upload.
limits.dir_max_path=256
Max path length you can set for Dir handlers.
limits.dir_send_buffer=16 * 1024
Maximum buffer used for file sending when we need to use one.
limits.fdtask_stack=100 * 1024
Stack frame size for the main IO reactor task. There’s only one, so set it high if you can, but it could possibly go lower.
limits.handler_stack=100 * 1024
The stack frame size for any Handler tasks. You probably want this high, since there’s not many of these, but adjust and see what your system can handle.
limits.handler_targets=128
The maximum number of connection IDs a message from a Handler may target. It’s not smart to set this really high.
limits.header_count=128 * 10
Maximum number of allowed headers from a client connection.
limits.host_name=256
Maximum hostname for Host specifiers and other DNS related settings.
limits.mime_ext_len=128
Maximum length of MIME type extensions.
limits.proxy_read_retries=100
The number of read attempts Mongrel2 should make when reading from a backend proxy. Many backend servers don’t buffer their I/O properly and Mongrel2 will ditch their HTTP response if it doesn’t get a header after this many attempts.
limits.proxy_read_retry_warn=10
This is the threshold where you get a warning that a particular backend is having performance problems, useful for spotting potential errors before they become a problem.
limits.url_path=256
Max URL paths. Does not include query string, just path.
superpoll.hot_dividend=4
Ratio of the total (like 1/4th, 1/8th) that should be in the hot selection. Set this higher if you have lots of idle connections; set it lower if you have more active connections.
superpoll.max_fd=10 * 1024
Maximum possible open files. Do not set this above 64 * 1024, and expect it to take a bit while Mongrel2 sets up constant structures.
upload.temp_store=None
This is not set by default. If you want large requests to reach your handlers, then set this to a directory they can access, and make sure they can handle it. Read about it in the Hacking section under Uploads. The file has to end in XXXXXX chars to work (read man mkstemp).
upload.temp_store_mode=0666
The mode to chmod any files uploaded to upload.temp_store.
zeromq.threads=1
Number of 0MQ IO threads to run. Careful, we’ve experienced thread bugs in 0MQ sometimes with high numbers of these.
limits.tick_timer=10
Mongrel2 keeps an internal clock for efficiency and to run the timeouts. This is how often that clock updates, and defaults to 10 seconds.
limits.min_ping=120
Minimum time since last activity before considering closing a socket. Set to 0 to disable it.
limits.min_write_rate=300
Minimum bytes/second written before considering closing a socket. Set to 0 to disable it.
limits.min_read_rate=300
Minimum bytes/second read before considering closing a socket. Set to 0 to disable it.
limits.kill_limit=2
How many of min_ping, min_write_rate, and min_read_rate have to trigger before a socket is killed.
m2sh管理工具
Mongrel2的源码包里面自带一个工具m2sh,可以用来方便地从命令行管理Mongrel2。
在命令行中敲入 m2sh,回车。会进入下面的提示符:
==============================================
mongrel2> help
Mongrel2 m2sh has these commands available:
load Load a config.
config Alias for load.
shell Starts an interactive shell.
access Prints the access log.
servers Lists the servers in a config database.
hosts Lists the hosts in a server.
routes Lists the routes in a host.
commit Adds a message to the log.
log Prints the commit log.
start Starts a server.
stop Stops a server.
reload Reloads a server.
running Tells you what's running.
control Connects to the control port.
version Prints the Mongrel2 and m2sh version.
help Get help, lists commands.
uuid Prints out a randomly generated UUID.
==============================================
m2sh servers --db conf/config.sqlite
SERVERS:
------
main ipaste 505417b8-1de4-454f-98b6-07eb9225cca1
server2 tfzhw 505417b8-1de4-454f-98b6-07eb9225cca2
==============================================
mongrel2> hosts --db conf/config.sqlite -server name
HOSTS in name:
-----
[ERROR] (errno: No such file or directory) Invalid query, it has no columns, which is a bug.
mongrel2> hosts --db conf/config.sqlite -server main
HOSTS in main:
-----
1 ipaste
==============================================
mongrel2> routes --db conf/config.sqlite -server main -host ipaste
ROUTES in host ipaste, server main
-----
/
/media/
/favicon.ico
==============================================
mongrel2> log --db conf/config.sqlite
LOG MESSAGES:
------
2011-01-12 05:41:34 root legerobot-office conf/mongrel2.conf load command
2011-01-18 06:26:54 root legerobot-office conf/mongrel2.conf load command
2011-01-18 06:29:54 root legerobot-office conf/mongrel2.conf load command
2011-01-18 06:46:34 root legerobot-office conf/mongrel2.conf load command
2011-01-18 06:47:15 root legerobot-office conf/mongrel2.conf load command
2011-01-18 06:51:39 root legerobot-office conf/mongrel2.conf load command
2011-01-27 07:47:56 root legerobot-office conf/mongrel2.conf load command
==============================================
mongrel2> access --db conf/config.sqlite
[WARN] (errno: No such file or directory) No option --log given, using "logs/access.log" as the default.
[1312945845] 192.168.0.101:2633 ipaste "GET /get/ HTTP/1.1" 200 0
[1312945874] 192.168.0.101:2634 ipaste "GET / HTTP/1.1" 200 0
[1312945874] 192.168.0.101:2634 ipaste "GET /media/js/jquery.min.js HTTP/1.1" 304 0
[1312945874] 192.168.0.101:2635 ipaste "GET /media/css/fileuploader.css HTTP/1.1" 304 0
[1312945874] 192.168.0.101:2636 ipaste "GET /media/js/fileuploader.js HTTP/1.1" 304 0
[1312945874] 192.168.0.101:2637 ipaste "GET /get/ HTTP/1.1" 200 0
[1312945875] 192.168.0.101:2639 ipaste "GET / HTTP/1.1" 200 0
[1312945875] 192.168.0.101:2639 ipaste "GET /media/js/jquery.min.js HTTP/1.1" 304 0
[1312945875] 192.168.0.101:2640 ipaste "GET /media/css/fileuploader.css HTTP/1.1" 304 0
[1312945875] 192.168.0.101:2641 ipaste "GET /media/js/fileuploader.js HTTP/1.1" 304 0
[1312945875] 192.168.0.101:2642 ipaste "GET /get/ HTTP/1.1" 200 0
[1312945879] 192.168.0.101:2644 ipaste "GET /get/ HTTP/1.1" 200 0
==============================================
mongrel2> stop --db conf/config.sqlite -name main
mongrel2> servers --db conf/config.sqlite
SERVERS:
------
main ipaste 505417b8-1de4-454f-98b6-07eb9225cca1
server2 tfzhw 505417b8-1de4-454f-98b6-07eb9225cca2
mongrel2> running --db conf/config.sqlite -name main
mongrel2 at PID 2854 running.
mongrel2> running --db conf/config.sqlite -name main
mongrel2 at PID 3132 running.
mongrel2> running --db conf/config.sqlite -name server2
mongrel2 at PID 3191 running.
mongrel2> running --db conf/config.sqlite -name main
[ERROR] (errno: No such file or directory) Couldn't read the PID from .//run/mongrel2.pid
mongrel2 is not running because pid_file isn't there.
==============================================
mongrel2> start --db conf/config.sqlite -name main
[INFO] (src/mime.c:49) MAX limits.mime_ext_len=128
[INFO] (src/host.c:62) MAX limits.url_path=256, limits.host_name=256
[INFO] (src/handler.c:338) MAX limits.handler_stack=102400
[INFO] (src/config/config.c:84) Loaded handler 1:tcp://127.0.0.1:9999:e884a439-31be-4f74-8050-a93565795b25:tcp://127.0.0.1:9998:
[INFO] (src/config/config.c:226) Loaded route 1:/:handler for host 1:ipaste
[INFO] (src/dir.c:175) MAX limits.dir_send_buffer=16384, limits.dir_max_path=256
[INFO] (src/config/config.c:135) Loaded directory 1:sites/ipaste/:index.html
[INFO] (src/config/config.c:226) Loaded route 2:/media/:dir for host 1:ipaste
[INFO] (src/config/config.c:135) Loaded directory 1:sites/ipaste/:index.html
[INFO] (src/config/config.c:226) Loaded route 3:/favicon.ico:dir for host 1:ipaste
[INFO] (src/config/config.c:274) Loaded 1 hosts for server 1:505417b8-1de4-454f-98b6-07eb9225cca1
[INFO] (src/server.c:416) LOADING Handler tcp://127.0.0.1:9999
[INFO] (src/superpoll.c:285) MAX open file descriptors is 10240 now.
[ERROR] (src/unixy.c:99: errno: No such file or directory) Failed to open PID file .//run/mongrel2.pid for reading.
[INFO] (src/unixy.c:138) No previous Mongrel2 running, continuing on.
[INFO] (src/mongrel2.c:200) All loaded up, time to turn into a server.
mongrel2> start --db conf/config.sqlite -name server2
[INFO] (src/mime.c:49) MAX limits.mime_ext_len=128
[INFO] (src/host.c:62) MAX limits.url_path=256, limits.host_name=256
[INFO] (src/handler.c:338) MAX limits.handler_stack=102400
[INFO] (src/config/config.c:84) Loaded handler 2:tcp://127.0.0.1:9997:e884a439-31be-4f74-8050-a93565795b24:tcp://127.0.0.1:9996:
[INFO] (src/config/config.c:226) Loaded route 4:/:handler for host 2:tfzhw
[INFO] (src/dir.c:175) MAX limits.dir_send_buffer=16384, limits.dir_max_path=256
[INFO] (src/config/config.c:135) Loaded directory 2:sites/tfzhw/:index.html
[INFO] (src/config/config.c:226) Loaded route 5:/media/:dir for host 2:tfzhw
[INFO] (src/config/config.c:135) Loaded directory 2:sites/tfzhw/:index.html
[INFO] (src/config/config.c:226) Loaded route 6:/favicon.ico:dir for host 2:tfzhw
[INFO] (src/config/config.c:274) Loaded 1 hosts for server 2:505417b8-1de4-454f-98b6-07eb9225cca2
[INFO] (src/server.c:416) LOADING Handler tcp://127.0.0.1:9997
[INFO] (src/superpoll.c:285) MAX open file descriptors is 10240 now.
[ERROR] (src/unixy.c:99: errno: No such file or directory) Failed to open PID file .//run/mongrel2_server2.pid for reading.
[INFO] (src/unixy.c:138) No previous Mongrel2 running, continuing on.
[INFO] (src/mongrel2.c:200) All loaded up, time to turn into a server.
==============================================
运行期控制
在m2sh提示符下,执行下面语句,会进行远程控制提示符
mongrel2> control --db conf/config.sqlite -name server2
[INFO] Connecting to control port ipc://.//run/control
==============================================
m2 [server2]> help
name help
stop stop the server (SIGINT)
reload reload the server
help this command
control_stop stop control port
kill kill a connection
status status, what=['net'|'tasks']
terminate terminate the server (SIGTERM)
time the server's time
uuid the server's uuid
info information about this server
==============================================
m2 [server2]> status what=net
id fd type last_ping last_read last_write bytes_read bytes_written
m2 [server2]> status what=tasks
id system name state status
1 false SERVER read fd idle
2 false Handler_task read handler idle
3 false control read handler running
4 false ticker idle
5 true fdtask yield ready
==============================================
m2 [server2]> time
time: 1312946823
==============================================
m2 [server2]> uuid
uuid: 505417b8-1de4-454f-98b6-07eb9225cca2
==============================================
m2 [server2]> info
port: 6768
bind_addr: 0.0.0.0
uuid: 505417b8-1de4-454f-98b6-07eb9225cca2
chroot: ./
access_log: /logs/access_server2.log
error_log: /logs/error_server2.log
pid_file: /run/mongrel2_server2.pid
default_hostname: tfzhw
==============================================
m2 [main]> status what=net
id fd type last_ping last_read last_write bytes_read bytes_written
16 36 1 71 71 71 896 176
9 37 1 71 71 71 2052 5019
17 39 1 60 71 71 1358 117
14 41 1 71 71 71 2111 5019
m2 [main]> kill id=16
status: OK
m2 [main]> kill id=9
status: OK
m2 [main]> kill id=17
status: OK
m2 [main]> kill id=14
status: OK
m2 [main]> status what=net
id fd type last_ping last_read last_write bytes_read bytes_written
18 30 1 31 31 0 448 0
19 31 1 11 11 0 479 0
20 36 1 11 11 0 679 0
21 37 1 11 11 0 487 0
==============================================
注:使用类似 m2sh start --db conf/config.sqlite -name main 之类的命令也是可以的。
Mongrel2是一款面向现代Web应用(Web 2.0 以及以后)而设计的Web浏览器。由干净的C语言写成,(目前)在Linux(及类似的Unix)系统上运行。它支持HTTP, Flash sockets, WebSockets, Long Polling,异步等技术,基本上走在当今Web服务端技术的最前沿。
主页
http://mongrel2.org/
手册
http://mongrel2.org/static/mongrel2-manual.html
Mongrel2的理念
按前面的描述,Mongrel2听起来是个很牛X的Web服务器,其实它真正独特的地方还不是前面的描述,而是它的理念:
- Web服务框架。它提供了很多基础设施,封装了大量Web处理方面的细节,并且以消息的方式为服务器更里层的应用提供多种服务;
- 语言中立。Mongrel2本身是用C语言写成的,但是他力求做到提供的服务语言中立(包括内部协议的设计),理论上可以为任何语言使用(只要这种语言能处理字符串)。实际上,目前已经有17种语言为它写了接口模块,所以可以说到现在为止他已经实现这个目标;
- 多样灵活的控制接口,为管理员的精确控制提供了方便(甚至可以精确到控制一个持续性连接);
关于语言中立,我们来八卦一下。Mongrel2的作者Zed Shaw,之前是Ruby社区的一位大牛,为Ruby社区设计了Mongrel服务器(针对Ruby设计的),这是个广受好评的Web Server,效率差不多是Ruby社区最高的了。后来,不知道咋回事儿(可能是关于一些Ruby技术的发展观点的分歧),Zed Shaw与Ruby界的其它某些人闹翻了。于是他一怒之下退出了Ruby圈子,发誓再也不搞Ruby了。退出之后,兴趣转向了python,写了一本书 Learn Python: The Hard Way。2010年开始,带着对Ruby界的愤怒(也许是很受伤),他开始了Mongrel2的设计。Mongrel2与Mongrel理念完全不一样,Mongrel2的目标就是要语言中立,并且宣称未来的软件开发一定是语言无关的(这种观念我蛮赞同)。就这么一年多的时间,到现在为止(2011年8月10日),发展到了1.7.5版,影响力逐渐大了起来。
Mongrel2与ZeroMQ社区也很有渊源——Mongrel2是ZeroMQ的第一个比较正式的有影响力的项目。ZeroMQ宣称是最牛逼的消息队列,是个新东西,可一直没有什么有影响力的应用。这次与Mongrel2的联姻,简直就是天作之合,我看行!
我关注Mongrel2,还是在其Tir示意框架出来之后,那时Mongrel2的版本为1.4。当时我正在估摸着设计一款Lua的Web框架,用于我们以后的产品中。发现Tir后,立即对这一套系统进行了消化,觉得Mongrel2, ZeroMQ, Redis, Lua的配合绝对有戏,重要的是在Mongrel2的基础上开发Web框架,能省很多事情(Mongrel2把许多以许需要框架来完成的事情包装好了)。于是立马开始了Bamboo项目。
配置文件写法
对象
- Server
- Host
- Dir
- Proxy
内置变量
- settings
- servers
配置选项
先贴上,后面再翻译。
The list of available settings are:
control_port=ipc://run/control
This is where Mongrel2 will listen with 0MQ for control messages. You should use ipc:// for the spec, so that only a local user with file access can get at it.
limits.buffer_size=2 * 1024
Internal IO buffers, used for things like proxying and handling requests. This is a very conservative setting, so if you get HTTP headers greater than this, you’ll want to increase this setting. You’ll also want to shoot whoever is sending you those requests, because the average is 400-600 bytes.
limits.client_read_retries=5
How many times it will attempt to read a complete HTTP header from a client. This prevents attacks where a client trickles an incomplete request at you until you run out of resources.
limits.connection_stack_size=32 * 1024
Size of the stack used for connection coroutines. If you’re trying to cram a ton of connections into very little RAM, see how low this can go.
limits.content_length=20 * 1024
Maximum allowed content length on submitted requests. This is, right now, a hard limit so requests that go over it are rejected. Later versions of Mongrel2 will use an upload mechanism that will allow any size upload.
limits.dir_max_path=256
Max path length you can set for Dir handlers.
limits.dir_send_buffer=16 * 1024
Maximum buffer used for file sending when we need to use one.
limits.fdtask_stack=100 * 1024
Stack frame size for the main IO reactor task. There’s only one, so set it high if you can, but it could possibly go lower.
limits.handler_stack=100 * 1024
The stack frame size for any Handler tasks. You probably want this high, since there’s not many of these, but adjust and see what your system can handle.
limits.handler_targets=128
The maximum number of connection IDs a message from a Handler may target. It’s not smart to set this really high.
limits.header_count=128 * 10
Maximum number of allowed headers from a client connection.
limits.host_name=256
Maximum hostname for Host specifiers and other DNS related settings.
limits.mime_ext_len=128
Maximum length of MIME type extensions.
limits.proxy_read_retries=100
The number of read attempts Mongrel2 should make when reading from a backend proxy. Many backend servers don’t buffer their I/O properly and Mongrel2 will ditch their HTTP response if it doesn’t get a header after this many attempts.
limits.proxy_read_retry_warn=10
This is the threshold where you get a warning that a particular backend is having performance problems, useful for spotting potential errors before they become a problem.
limits.url_path=256
Max URL paths. Does not include query string, just path.
superpoll.hot_dividend=4
Ratio of the total (like 1/4th, 1/8th) that should be in the hot selection. Set this higher if you have lots of idle connections; set it lower if you have more active connections.
superpoll.max_fd=10 * 1024
Maximum possible open files. Do not set this above 64 * 1024, and expect it to take a bit while Mongrel2 sets up constant structures.
upload.temp_store=None
This is not set by default. If you want large requests to reach your handlers, then set this to a directory they can access, and make sure they can handle it. Read about it in the Hacking section under Uploads. The file has to end in XXXXXX chars to work (read man mkstemp).
upload.temp_store_mode=0666
The mode to chmod any files uploaded to upload.temp_store.
zeromq.threads=1
Number of 0MQ IO threads to run. Careful, we’ve experienced thread bugs in 0MQ sometimes with high numbers of these.
limits.tick_timer=10
Mongrel2 keeps an internal clock for efficiency and to run the timeouts. This is how often that clock updates, and defaults to 10 seconds.
limits.min_ping=120
Minimum time since last activity before considering closing a socket. Set to 0 to disable it.
limits.min_write_rate=300
Minimum bytes/second written before considering closing a socket. Set to 0 to disable it.
limits.min_read_rate=300
Minimum bytes/second read before considering closing a socket. Set to 0 to disable it.
limits.kill_limit=2
How many of min_ping, min_write_rate, and min_read_rate have to trigger before a socket is killed.
m2sh管理工具
Mongrel2的源码包里面自带一个工具m2sh,可以用来方便地从命令行管理Mongrel2。
在命令行中敲入 m2sh,回车。会进入下面的提示符:
==============================================
mongrel2> help
Mongrel2 m2sh has these commands available:
load Load a config.
config Alias for load.
shell Starts an interactive shell.
access Prints the access log.
servers Lists the servers in a config database.
hosts Lists the hosts in a server.
routes Lists the routes in a host.
commit Adds a message to the log.
log Prints the commit log.
start Starts a server.
stop Stops a server.
reload Reloads a server.
running Tells you what's running.
control Connects to the control port.
version Prints the Mongrel2 and m2sh version.
help Get help, lists commands.
uuid Prints out a randomly generated UUID.
==============================================
m2sh servers --db conf/config.sqlite
SERVERS:
------
main ipaste 505417b8-1de4-454f-98b6-07eb9225cca1
server2 tfzhw 505417b8-1de4-454f-98b6-07eb9225cca2
==============================================
mongrel2> hosts --db conf/config.sqlite -server name
HOSTS in name:
-----
[ERROR] (errno: No such file or directory) Invalid query, it has no columns, which is a bug.
mongrel2> hosts --db conf/config.sqlite -server main
HOSTS in main:
-----
1 ipaste
==============================================
mongrel2> routes --db conf/config.sqlite -server main -host ipaste
ROUTES in host ipaste, server main
-----
/
/media/
/favicon.ico
==============================================
mongrel2> log --db conf/config.sqlite
LOG MESSAGES:
------
2011-01-12 05:41:34 root legerobot-office conf/mongrel2.conf load command
2011-01-18 06:26:54 root legerobot-office conf/mongrel2.conf load command
2011-01-18 06:29:54 root legerobot-office conf/mongrel2.conf load command
2011-01-18 06:46:34 root legerobot-office conf/mongrel2.conf load command
2011-01-18 06:47:15 root legerobot-office conf/mongrel2.conf load command
2011-01-18 06:51:39 root legerobot-office conf/mongrel2.conf load command
2011-01-27 07:47:56 root legerobot-office conf/mongrel2.conf load command
==============================================
mongrel2> access --db conf/config.sqlite
[WARN] (errno: No such file or directory) No option --log given, using "logs/access.log" as the default.
[1312945845] 192.168.0.101:2633 ipaste "GET /get/ HTTP/1.1" 200 0
[1312945874] 192.168.0.101:2634 ipaste "GET / HTTP/1.1" 200 0
[1312945874] 192.168.0.101:2634 ipaste "GET /media/js/jquery.min.js HTTP/1.1" 304 0
[1312945874] 192.168.0.101:2635 ipaste "GET /media/css/fileuploader.css HTTP/1.1" 304 0
[1312945874] 192.168.0.101:2636 ipaste "GET /media/js/fileuploader.js HTTP/1.1" 304 0
[1312945874] 192.168.0.101:2637 ipaste "GET /get/ HTTP/1.1" 200 0
[1312945875] 192.168.0.101:2639 ipaste "GET / HTTP/1.1" 200 0
[1312945875] 192.168.0.101:2639 ipaste "GET /media/js/jquery.min.js HTTP/1.1" 304 0
[1312945875] 192.168.0.101:2640 ipaste "GET /media/css/fileuploader.css HTTP/1.1" 304 0
[1312945875] 192.168.0.101:2641 ipaste "GET /media/js/fileuploader.js HTTP/1.1" 304 0
[1312945875] 192.168.0.101:2642 ipaste "GET /get/ HTTP/1.1" 200 0
[1312945879] 192.168.0.101:2644 ipaste "GET /get/ HTTP/1.1" 200 0
==============================================
mongrel2> stop --db conf/config.sqlite -name main
mongrel2> servers --db conf/config.sqlite
SERVERS:
------
main ipaste 505417b8-1de4-454f-98b6-07eb9225cca1
server2 tfzhw 505417b8-1de4-454f-98b6-07eb9225cca2
mongrel2> running --db conf/config.sqlite -name main
mongrel2 at PID 2854 running.
mongrel2> running --db conf/config.sqlite -name main
mongrel2 at PID 3132 running.
mongrel2> running --db conf/config.sqlite -name server2
mongrel2 at PID 3191 running.
mongrel2> running --db conf/config.sqlite -name main
[ERROR] (errno: No such file or directory) Couldn't read the PID from .//run/mongrel2.pid
mongrel2 is not running because pid_file isn't there.
==============================================
mongrel2> start --db conf/config.sqlite -name main
[INFO] (src/mime.c:49) MAX limits.mime_ext_len=128
[INFO] (src/host.c:62) MAX limits.url_path=256, limits.host_name=256
[INFO] (src/handler.c:338) MAX limits.handler_stack=102400
[INFO] (src/config/config.c:84) Loaded handler 1:tcp://127.0.0.1:9999:e884a439-31be-4f74-8050-a93565795b25:tcp://127.0.0.1:9998:
[INFO] (src/config/config.c:226) Loaded route 1:/:handler for host 1:ipaste
[INFO] (src/dir.c:175) MAX limits.dir_send_buffer=16384, limits.dir_max_path=256
[INFO] (src/config/config.c:135) Loaded directory 1:sites/ipaste/:index.html
[INFO] (src/config/config.c:226) Loaded route 2:/media/:dir for host 1:ipaste
[INFO] (src/config/config.c:135) Loaded directory 1:sites/ipaste/:index.html
[INFO] (src/config/config.c:226) Loaded route 3:/favicon.ico:dir for host 1:ipaste
[INFO] (src/config/config.c:274) Loaded 1 hosts for server 1:505417b8-1de4-454f-98b6-07eb9225cca1
[INFO] (src/server.c:416) LOADING Handler tcp://127.0.0.1:9999
[INFO] (src/superpoll.c:285) MAX open file descriptors is 10240 now.
[ERROR] (src/unixy.c:99: errno: No such file or directory) Failed to open PID file .//run/mongrel2.pid for reading.
[INFO] (src/unixy.c:138) No previous Mongrel2 running, continuing on.
[INFO] (src/mongrel2.c:200) All loaded up, time to turn into a server.
mongrel2> start --db conf/config.sqlite -name server2
[INFO] (src/mime.c:49) MAX limits.mime_ext_len=128
[INFO] (src/host.c:62) MAX limits.url_path=256, limits.host_name=256
[INFO] (src/handler.c:338) MAX limits.handler_stack=102400
[INFO] (src/config/config.c:84) Loaded handler 2:tcp://127.0.0.1:9997:e884a439-31be-4f74-8050-a93565795b24:tcp://127.0.0.1:9996:
[INFO] (src/config/config.c:226) Loaded route 4:/:handler for host 2:tfzhw
[INFO] (src/dir.c:175) MAX limits.dir_send_buffer=16384, limits.dir_max_path=256
[INFO] (src/config/config.c:135) Loaded directory 2:sites/tfzhw/:index.html
[INFO] (src/config/config.c:226) Loaded route 5:/media/:dir for host 2:tfzhw
[INFO] (src/config/config.c:135) Loaded directory 2:sites/tfzhw/:index.html
[INFO] (src/config/config.c:226) Loaded route 6:/favicon.ico:dir for host 2:tfzhw
[INFO] (src/config/config.c:274) Loaded 1 hosts for server 2:505417b8-1de4-454f-98b6-07eb9225cca2
[INFO] (src/server.c:416) LOADING Handler tcp://127.0.0.1:9997
[INFO] (src/superpoll.c:285) MAX open file descriptors is 10240 now.
[ERROR] (src/unixy.c:99: errno: No such file or directory) Failed to open PID file .//run/mongrel2_server2.pid for reading.
[INFO] (src/unixy.c:138) No previous Mongrel2 running, continuing on.
[INFO] (src/mongrel2.c:200) All loaded up, time to turn into a server.
==============================================
运行期控制
在m2sh提示符下,执行下面语句,会进行远程控制提示符
mongrel2> control --db conf/config.sqlite -name server2
[INFO] Connecting to control port ipc://.//run/control
==============================================
m2 [server2]> help
name help
stop stop the server (SIGINT)
reload reload the server
help this command
control_stop stop control port
kill kill a connection
status status, what=['net'|'tasks']
terminate terminate the server (SIGTERM)
time the server's time
uuid the server's uuid
info information about this server
==============================================
m2 [server2]> status what=net
id fd type last_ping last_read last_write bytes_read bytes_written
m2 [server2]> status what=tasks
id system name state status
1 false SERVER read fd idle
2 false Handler_task read handler idle
3 false control read handler running
4 false ticker idle
5 true fdtask yield ready
==============================================
m2 [server2]> time
time: 1312946823
==============================================
m2 [server2]> uuid
uuid: 505417b8-1de4-454f-98b6-07eb9225cca2
==============================================
m2 [server2]> info
port: 6768
bind_addr: 0.0.0.0
uuid: 505417b8-1de4-454f-98b6-07eb9225cca2
chroot: ./
access_log: /logs/access_server2.log
error_log: /logs/error_server2.log
pid_file: /run/mongrel2_server2.pid
default_hostname: tfzhw
==============================================
m2 [main]> status what=net
id fd type last_ping last_read last_write bytes_read bytes_written
16 36 1 71 71 71 896 176
9 37 1 71 71 71 2052 5019
17 39 1 60 71 71 1358 117
14 41 1 71 71 71 2111 5019
m2 [main]> kill id=16
status: OK
m2 [main]> kill id=9
status: OK
m2 [main]> kill id=17
status: OK
m2 [main]> kill id=14
status: OK
m2 [main]> status what=net
id fd type last_ping last_read last_write bytes_read bytes_written
18 30 1 31 31 0 448 0
19 31 1 11 11 0 479 0
20 36 1 11 11 0 679 0
21 37 1 11 11 0 487 0
==============================================
注:使用类似 m2sh start --db conf/config.sqlite -name main 之类的命令也是可以的。
发表评论
-
发布Bamboo 1.0,一个 lua MVC web开发框架
2011-11-11 10:03 1764今天非常高兴,历经接近1年的开发,终于发布了 Bamboo v ... -
Bamboo中的字段描述表
2011-07-18 15:33 1046Bamboo中的模型定义的时候,需要为每个字段设置一个字段描述 ... -
Bamboo安装指导
2011-07-18 14:45 7647以Ubuntu 10.04为例。从前到后依次执行。 安装gc ... -
Bamboo开发者邮件列表
2011-07-18 11:40 1076之前在Google Groups上建了一个邮件列表,可以G。F ... -
Bamboo对Upload的支持
2011-07-15 15:44 2200Bamboo Web框架对上传提供了方便的接口。目前支持的特性 ... -
使用bamboo测试框架
2011-07-12 10:40 4514Bamboo测试框架好用是好用,但是有一套规则,必须按这套规则 ... -
Bamboo的测试框架的设计
2011-07-08 21:54 2443先说一下对Tir的测试框 ... -
Bamboo的custom操作API
2011-07-06 21:16 1931为了在封装性与灵活性 ... -
Bamboo的redis封装层API
2011-07-06 18:07 2270先扯一下Bamboo与Redis的关系:Bamboo对redi ... -
Bamboo存储抽象层与外键关系的讨论
2011-07-06 15:59 1100Bamboo的存储抽象层主要 ... -
Bamboo 命令参数格式及命令集
2011-06-19 21:27 4380Bamboo Web框架自带一套命令行工具,方便做代码的自动生 ... -
bamboo query & query_set API
2011-06-13 18:17 919get和filter是model API中两个重要的函数,用于 ... -
bamboo model API
2011-06-13 16:28 1026这里是Bamboo的最新版本Model的API文档。 本文档 ...
相关推荐
3. **Mongrel**:Mongrel是Ruby Web服务器,专门设计用于运行Rails应用。它能快速解析Ruby代码,提供高效的HTTP服务。然而,由于不再活跃维护,现在更多地被Passenger或Unicorn等其他服务器代替,但在本场景中,...
在“Mongrel”这个主题下,我们主要讨论的是MongoDB的特性和使用场景。首先,MongoDB使用一种称为BSON的数据格式,它是Binary JSON的缩写,提供了与JSON相似的数据表示,但以二进制形式存储,提高了存储效率和读取...
- 在RadRails中新建一个Rails项目,例如命名为`demo2`,并选择使用Mongrel Server作为服务器。 2. **启动服务器** - 在RadRails的`Servers`视图中选择`demo2 Server`,点击绿色箭头启动服务器。 - 点击绿色箭头...
2. **Rails应用部署**:如何配置Mongrel来托管Rails应用,包括端口设置、环境变量等。 3. **负载均衡**:Mongrel集群的设置,如何通过如HAProxy或Nginx实现请求分发以提高可用性和性能。 4. **安全和性能**:最佳...
2. **Redmine**:Redmine是一个开源的项目管理工具,支持多种版本控制系统,包括Git。`redmine-1.3.0.tar.gz`是Redmine的一个源代码包,需要通过Ruby环境来编译和安装。Ruby是红宝石编程语言,`rubyinstaller-1.8.7-...
Mongrel 是一个常用的 Web 服务器,可以用于开发和测试阶段: ```bash sudo gem install mongrel sudo gem install mongrel_cluster ``` **1.5 安装其他依赖库** 安装 OpenSSL 和 GD 库等其他依赖库,以便支持更...
mongrel2-uwsgi.conf是一个配置文件,用于设置uWSGI与Mongrel2(一个高性能的HTTP服务器)之间的通信。这种集成允许开发者构建更复杂的分布式Web系统,通过uWSGI处理动态内容,而Mongrel2负责静态资源的分发。 ...
2. **重启与信号**:你可以通过发送特定的信号来控制 Puma 的行为,如 `USR2` 信号用于平滑重启(热加载),`QUIT` 信号用于关闭服务器等。理解这些信号及其用途是管理 Puma 运行状态的关键。 3. **服务配置**:...
Deprec-2.x是对项目的完整重写,可以实现以下目的: 支持Capistrano 2 生成的配置文件存储在本地以启用编辑和版本控制支持更多服务(心跳,nagios,nginx,ntp,postfix等) 多个Rails部署选项(Passenger + Apache...
3. **兼容性**:Rack兼容多种Ruby Web服务器,如WEBrick、Mongrel、Thin等,同时也支持Ruby on Rails和其他基于Rack的应用框架,如Sinatra、Padrino等。这种兼容性使得开发者可以选择最适合他们的服务器环境。 4. *...