1.下载resin4.0.40 解压
2.更改resin.properties
1) 设置服务监听接口app_servers : 127.0.0.1:6868
2)设置http接口 :app.http : 8888
3)注掉web cluster http接口 #web.http : 8888
3.更改resin.xml
1)优化配置
<cluster id="app">
<server-default>
<jvm-arg>-Xms2048m</jvm-arg>
<jvm-arg>-Xmx2048m</jvm-arg>
<jvm-arg>-Xmn512m</jvm-arg>
<jvm-arg>-XX:PermSize=256m</jvm-arg>
<jvm-arg>-XX:MaxPermSize=512m</jvm-arg>
<thread-max>1024</thread-max>
<socket-timeout>30s</socket-timeout>
<keepalive-max>512</keepalive-max>
<keepalive-timeout>60s</keepalive-timeout>
</server-default>
2)设置监听端口 和 watch dog端口
<server-multi id-prefix="app-" address-list="${app_servers}" port="6868">
<watchdog-port>6666</watchdog-port>
</server-multi>
3) 设置编码
<host-default>
<!-- creates the webapps directory for .war expansion -->
<web-app-deploy path="webapps"
expand-preserve-fileset="WEB-INF/work/**"
multiversion-routing="${webapp_multiversion_routing}"
path-suffix="${elastic_webapp?resin.id:''}"/>
<character-encoding>UTF-8</character-encoding>
</host-default>
4)设置web项目路径
<host id="" root-directory=".">
<!--
- webapps can be overridden/extended in the resin.xml
-->
<web-app id="/" root-directory="/opt/test_web/auto-search-platform/auto-search/auto-search-web/target/auto-search-web"/>
</host>
4.启动resin sh resin.sh start
5.resin配置说明:
Resin是CAUCHO公司的产品,pro版收费。过去几年在倒是一直用它,每天几百万PV,中规中矩。这次要部署一个服务,才把官方手册看了一遍
6800端口之谜
用resin.sh启动resin之后,会占有3个端口
watch dog 用的6600
http *:8080
cluster 127.0.0.1:6800
很多文章说6800是监控端口,因为它叫坑爹的 server.port。resin的手册说不是这样,6800是resin当初的主要工作端口,使用humx协议,方便搭配apache的 mod_caucho使用。
而http的8080端口,才是给程序员用的监控/调试 服务器的端口,类似路由器的console。 但是由于ningx的流行,http倒成了主流,不过nginx现在也也有了humx模块 ,可以继续用6800
https://github.com/wangbin579/nginx-hmux-module
resin.xml和resin.properties
resin 4之后把配置文件分成resin.xml和resin.properties两部分.端口/IP修改都在resin.properties文件里面
在resin.xml里面,CAUCHO意淫了这样一个场景:在resin 实例里面
网站分成: cluster -> server -> host -> web-app 4个层级
尼玛,我只是想找一个java container 来跑一个http服务,你胡扯一堆干什么
resin的绝大多数应用场景是 运行一个或者多个 war 包,有个屁的cluster/server/host 概念
谁会拿单机做cluster?
看到这定义,我第一感觉是 Caucho是想做去虚拟机生意,可做虚拟机生意的人也不会用resin
resin.xml 还默认定义了 4个cluster,分别叫做 app,web,memcached,proxycache 看这名字就知道这群程序员都是意淫狂
与其对应的是 resin.properties里面出现了这些定义
home_cluster : app
app.http
web.http
app_servers
home_server : app-0